/* 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); UserPhotosSlice( Key key, std::deque &&ids, std::optional fullCount, std::optional skippedBefore, std::optional skippedAfter); void reverse(); const Key &key() const { return _key; } std::optional fullCount() const { return _fullCount; } std::optional skippedBefore() const { return _skippedBefore; } std::optional skippedAfter() const { return _skippedAfter; } std::optional indexOf(PhotoId msgId) const; int size() const { return _ids.size(); } PhotoId operator[](int index) const; std::optional distance(const Key &a, const Key &b) const; private: Key _key; std::deque _ids; std::optional _fullCount; std::optional _skippedBefore; std::optional _skippedAfter; friend class UserPhotosSliceBuilder; }; rpl::producer UserPhotosViewer( UserPhotosSlice::Key key, int limitBefore, int limitAfter); rpl::producer UserPhotosReversedViewer( UserPhotosSlice::Key key, int limitBefore, int limitAfter);