tdesktop/Telegram/SourceFiles/data/data_user_photos.h

57 lines
1.4 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "storage/storage_user_photos.h"
#include "base/weak_ptr.h"
class UserPhotosSlice {
public:
using Key = Storage::UserPhotosKey;
UserPhotosSlice(Key key);
2017-09-06 14:50:11 +00:00
UserPhotosSlice(
Key key,
2017-11-23 09:58:12 +00:00
std::deque<PhotoId> &&ids,
2018-09-21 16:28:46 +00:00
std::optional<int> fullCount,
std::optional<int> skippedBefore,
std::optional<int> skippedAfter);
2017-11-23 09:58:12 +00:00
void reverse();
const Key &key() const { return _key; }
2018-09-21 16:28:46 +00:00
std::optional<int> fullCount() const { return _fullCount; }
std::optional<int> skippedBefore() const { return _skippedBefore; }
std::optional<int> skippedAfter() const { return _skippedAfter; }
std::optional<int> indexOf(PhotoId msgId) const;
int size() const { return _ids.size(); }
PhotoId operator[](int index) const;
2018-09-21 16:28:46 +00:00
std::optional<int> distance(const Key &a, const Key &b) const;
private:
Key _key;
std::deque<PhotoId> _ids;
2018-09-21 16:28:46 +00:00
std::optional<int> _fullCount;
std::optional<int> _skippedBefore;
std::optional<int> _skippedAfter;
2017-09-06 14:50:11 +00:00
friend class UserPhotosSliceBuilder;
};
2017-09-06 14:50:11 +00:00
rpl::producer<UserPhotosSlice> UserPhotosViewer(
UserPhotosSlice::Key key,
int limitBefore,
int limitAfter);
2017-11-23 09:58:12 +00:00
rpl::producer<UserPhotosSlice> UserPhotosReversedViewer(
UserPhotosSlice::Key key,
int limitBefore,
int limitAfter);