2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Move to std::optional.

This commit is contained in:
John Preston
2018-09-21 19:28:46 +03:00
parent 850efbde95
commit 2e5a0e056c
115 changed files with 632 additions and 672 deletions

View File

@@ -239,7 +239,7 @@ void MoveFavedToFront(Set &set, int index) {
void RequestSetToPushFaved(not_null<DocumentData*> document);
void SetIsFaved(not_null<DocumentData*> document, base::optional<std::vector<not_null<EmojiPtr>>> emojiList = base::none) {
void SetIsFaved(not_null<DocumentData*> document, std::optional<std::vector<not_null<EmojiPtr>>> emojiList = std::nullopt) {
auto &sets = Auth().data().stickerSetsRef();
auto it = sets.find(FavedSetId);
if (it == sets.end()) {
@@ -825,17 +825,17 @@ std::vector<not_null<DocumentData*>> GetListByEmoji(
}) | ranges::to_vector;
}
base::optional<std::vector<not_null<EmojiPtr>>> GetEmojiListFromSet(
std::optional<std::vector<not_null<EmojiPtr>>> GetEmojiListFromSet(
not_null<DocumentData*> document) {
if (auto sticker = document->sticker()) {
auto &inputSet = sticker->set;
if (inputSet.type() != mtpc_inputStickerSetID) {
return base::none;
return std::nullopt;
}
auto &sets = Auth().data().stickerSets();
auto it = sets.constFind(inputSet.c_inputStickerSetID().vid.v);
if (it == sets.cend()) {
return base::none;
return std::nullopt;
}
auto result = std::vector<not_null<EmojiPtr>>();
for (auto i = it->emoji.cbegin(), e = it->emoji.cend(); i != e; ++i) {
@@ -844,11 +844,11 @@ base::optional<std::vector<not_null<EmojiPtr>>> GetEmojiListFromSet(
}
}
if (result.empty()) {
return base::none;
return std::nullopt;
}
return std::move(result);
}
return base::none;
return std::nullopt;
}
Set *FeedSet(const MTPDstickerSet &set) {