Replace mapbox variant with std::variant.

This commit is contained in:
John Preston 2020-08-31 12:14:53 +04:00
parent b3eb41b989
commit 734d834a20
58 changed files with 207 additions and 194 deletions

View File

@ -2684,14 +2684,14 @@ void ApiWrap::requestFileReference(
// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87122 // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87122
const auto &origin = p.first; const auto &origin = p.first;
const auto &reference = p.second; const auto &reference = p.second;
const auto documentId = base::get_if<DocumentFileLocationId>( const auto documentId = std::get_if<DocumentFileLocationId>(
&origin); &origin);
if (documentId) { if (documentId) {
_session->data().document( _session->data().document(
documentId->id documentId->id
)->refreshFileReference(reference); )->refreshFileReference(reference);
} }
const auto photoId = base::get_if<PhotoFileLocationId>(&origin); const auto photoId = std::get_if<PhotoFileLocationId>(&origin);
if (photoId) { if (photoId) {
_session->data().photo( _session->data().photo(
photoId->id photoId->id
@ -2826,7 +2826,7 @@ void ApiWrap::refreshFileReference(
MTP_long(data.themeId), MTP_long(data.themeId),
MTP_long(data.accessHash)), MTP_long(data.accessHash)),
MTP_long(0))); MTP_long(0)));
}, [&](std::nullopt_t) { }, [&](v::null_t) {
fail(); fail();
}); });
} }

View File

@ -446,7 +446,7 @@ int BackgroundBox::Inner::getSelectionIndex(
return data.index; return data.index;
}, [](const DeleteSelected &data) { }, [](const DeleteSelected &data) {
return data.index; return data.index;
}, [](std::nullopt_t) { }, [](v::null_t) {
return -1; return -1;
}); });
} }

View File

@ -225,7 +225,7 @@ auto AddButtonWithLoader(
buttonState->value( buttonState->value(
) | rpl::start_with_next([=](const DictState &state) { ) | rpl::start_with_next([=](const DictState &state) {
const auto isToggledSet = state.is<Active>(); const auto isToggledSet = v::is<Active>(state);
const auto toggled = isToggledSet ? 1. : 0.; const auto toggled = isToggledSet ? 1. : 0.;
const auto over = !button->isDisabled() const auto over = !button->isDisabled()
&& (button->isDown() || button->isOver()); && (button->isDown() || button->isOver());
@ -252,7 +252,7 @@ auto AddButtonWithLoader(
dictionaryRemoved->events(), dictionaryRemoved->events(),
buttonState->value( buttonState->value(
) | rpl::filter([](const DictState &state) { ) | rpl::filter([](const DictState &state) {
return state.is<Failed>(); return v::is<Failed>(state);
}) | rpl::to_empty }) | rpl::to_empty
) | rpl::map_to(false) ) | rpl::map_to(false)
) )
@ -276,13 +276,14 @@ auto AddButtonWithLoader(
}); });
}) | rpl::flatten_latest( }) | rpl::flatten_latest(
) | rpl::filter([=](const DictState &state) { ) | rpl::filter([=](const DictState &state) {
return !buttonState->current().is<Failed>() || !state.is<Available>(); return !v::is<Failed>(buttonState->current())
|| !v::is<Available>(state);
}); });
button->toggledValue( button->toggledValue(
) | rpl::start_with_next([=](bool toggled) { ) | rpl::start_with_next([=](bool toggled) {
const auto &state = buttonState->current(); const auto &state = buttonState->current();
if (toggled && (state.is<Available>() || state.is<Failed>())) { if (toggled && (v::is<Available>(state) || v::is<Failed>(state))) {
const auto weak = Ui::MakeWeak(button); const auto weak = Ui::MakeWeak(button);
setLocalLoader(base::make_unique_q<Loader>( setLocalLoader(base::make_unique_q<Loader>(
QCoreApplication::instance(), QCoreApplication::instance(),
@ -292,7 +293,7 @@ auto AddButtonWithLoader(
Spellchecker::DictPathByLangId(id), Spellchecker::DictPathByLangId(id),
Spellchecker::GetDownloadSize(id), Spellchecker::GetDownloadSize(id),
crl::guard(weak, destroyLocalLoader))); crl::guard(weak, destroyLocalLoader)));
} else if (!toggled && state.is<Loading>()) { } else if (!toggled && v::is<Loading>(state)) {
if (const auto g = rawGlobalLoaderPtr()) { if (const auto g = rawGlobalLoaderPtr()) {
g->destroy(); g->destroy();
return; return;

View File

@ -431,7 +431,7 @@ void EditCaptionBox::setupStreamedPreview(std::shared_ptr<Document> shared) {
} }
void EditCaptionBox::handleStreamingUpdate(Update &&update) { void EditCaptionBox::handleStreamingUpdate(Update &&update) {
update.data.match([&](Information &update) { v::match(update.data, [&](Information &update) {
streamingReady(std::move(update)); streamingReady(std::move(update));
}, [&](const PreloadedVideo &update) { }, [&](const PreloadedVideo &update) {
}, [&](const UpdateVideo &update) { }, [&](const UpdateVideo &update) {

View File

@ -395,7 +395,7 @@ void Rows::mouseReleaseEvent(QMouseEvent *e) {
activateByIndex(data.index); activateByIndex(data.index);
}, [&](MenuSelection data) { }, [&](MenuSelection data) {
showMenu(data.index); showMenu(data.index);
}, [](std::nullopt_t) {}); }, [](v::null_t) {});
} }
} }
@ -601,7 +601,7 @@ int Rows::indexFromSelection(Selection selected) const {
return data.index; return data.index;
}, [&](MenuSelection data) { }, [&](MenuSelection data) {
return data.index; return data.index;
}, [](std::nullopt_t) { }, [](v::null_t) {
return -1; return -1;
}); });
} }
@ -648,7 +648,7 @@ rpl::producer<bool> Rows::isEmpty() const {
} }
void Rows::repaint(Selection selected) { void Rows::repaint(Selection selected) {
selected.match([](std::nullopt_t) { selected.match([](v::null_t) {
}, [&](const auto &data) { }, [&](const auto &data) {
repaint(data.index); repaint(data.index);
}); });

View File

@ -263,8 +263,8 @@ void Row::paintRadio(Painter &p) {
const auto loading = _loading const auto loading = _loading
? _loading->computeState() ? _loading->computeState()
: Ui::RadialState{ 0., 0, FullArcLength }; : Ui::RadialState{ 0., 0, FullArcLength };
const auto isToggledSet = _state.current().is<Active>(); const auto isToggledSet = v::is<Active>(_state.current());
const auto isActiveSet = isToggledSet || _state.current().is<Loading>(); const auto isActiveSet = isToggledSet || v::is<Loading>(_state.current());
const auto toggled = _toggled.value(isToggledSet ? 1. : 0.); const auto toggled = _toggled.value(isToggledSet ? 1. : 0.);
const auto active = _active.value(isActiveSet ? 1. : 0.); const auto active = _active.value(isActiveSet ? 1. : 0.);
const auto _st = &st::defaultRadio; const auto _st = &st::defaultRadio;
@ -345,7 +345,7 @@ void Row::onStateChanged(State was, StateChangeSource source) {
} }
void Row::updateStatusColorOverride() { void Row::updateStatusColorOverride() {
const auto isToggledSet = _state.current().is<Active>(); const auto isToggledSet = v::is<Active>(_state.current());
const auto toggled = _toggled.value(isToggledSet ? 1. : 0.); const auto toggled = _toggled.value(isToggledSet ? 1. : 0.);
const auto over = showOver(); const auto over = showOver();
if (toggled == 0. && !over) { if (toggled == 0. && !over) {
@ -373,7 +373,8 @@ void Row::setupContent(const Set &set) {
}); });
}) | rpl::flatten_latest( }) | rpl::flatten_latest(
) | rpl::filter([=](const SetState &state) { ) | rpl::filter([=](const SetState &state) {
return !_state.current().is<Failed>() || !state.is<Available>(); return !v::is<Failed>(_state.current())
|| !v::is<Available>(state);
}); });
setupLabels(set); setupLabels(set);
@ -390,9 +391,10 @@ void Row::setupHandler() {
clicks( clicks(
) | rpl::filter([=] { ) | rpl::filter([=] {
const auto &state = _state.current(); const auto &state = _state.current();
return !_switching && (state.is<Ready>() || state.is<Available>()); return !_switching && (v::is<Ready>(state)
|| v::is<Available>(state));
}) | rpl::start_with_next([=] { }) | rpl::start_with_next([=] {
if (_state.current().is<Available>()) { if (v::is<Available>(_state.current())) {
load(); load();
return; return;
} }
@ -409,7 +411,7 @@ void Row::setupHandler() {
_state.value( _state.value(
) | rpl::map([=](const SetState &state) { ) | rpl::map([=](const SetState &state) {
return state.is<Ready>() || state.is<Available>(); return v::is<Ready>(state) || v::is<Available>(state);
}) | rpl::start_with_next([=](bool active) { }) | rpl::start_with_next([=](bool active) {
setDisabled(!active); setDisabled(!active);
setPointerCursor(active); setPointerCursor(active);
@ -463,7 +465,7 @@ void Row::setupPreview(const Set &set) {
void Row::updateLoadingToFinished() { void Row::updateLoadingToFinished() {
_loading->update( _loading->update(
_state.current().is<Failed>() ? 0. : 1., v::is<Failed>(_state.current()) ? 0. : 1.,
true, true,
crl::now()); crl::now());
} }
@ -471,7 +473,7 @@ void Row::updateLoadingToFinished() {
void Row::radialAnimationCallback(crl::time now) { void Row::radialAnimationCallback(crl::time now) {
const auto updated = [&] { const auto updated = [&] {
const auto state = _state.current(); const auto state = _state.current();
if (const auto loading = base::get_if<Loading>(&state)) { if (const auto loading = std::get_if<Loading>(&state)) {
return _loading->update(CountProgress(loading), false, now); return _loading->update(CountProgress(loading), false, now);
} else { } else {
updateLoadingToFinished(); updateLoadingToFinished();
@ -493,7 +495,7 @@ void Row::setupAnimation() {
_state.value( _state.value(
) | rpl::map( ) | rpl::map(
_1 == Active() _1 == SetState{ Active() }
) | rpl::distinct_until_changed( ) | rpl::distinct_until_changed(
) | rpl::start_with_next([=](bool toggled) { ) | rpl::start_with_next([=](bool toggled) {
_toggled.start( _toggled.start(
@ -505,7 +507,7 @@ void Row::setupAnimation() {
_state.value( _state.value(
) | rpl::map([](const SetState &state) { ) | rpl::map([](const SetState &state) {
return state.is<Loading>() || state.is<Active>(); return v::is<Loading>(state) || v::is<Active>(state);
}) | rpl::distinct_until_changed( }) | rpl::distinct_until_changed(
) | rpl::start_with_next([=](bool active) { ) | rpl::start_with_next([=](bool active) {
_active.start( _active.start(
@ -517,7 +519,7 @@ void Row::setupAnimation() {
_state.value( _state.value(
) | rpl::map([](const SetState &state) { ) | rpl::map([](const SetState &state) {
return base::get_if<Loading>(&state); return std::get_if<Loading>(&state);
}) | rpl::distinct_until_changed( }) | rpl::distinct_until_changed(
) | rpl::start_with_next([=](const Loading *loading) { ) | rpl::start_with_next([=](const Loading *loading) {
if (loading && !_loading) { if (loading && !_loading) {

View File

@ -143,7 +143,7 @@ private:
Search, Search,
Settings, Settings,
}; };
using OverState = base::variant<SpecialOver, int>; using OverState = std::variant<SpecialOver, int>;
template <typename Callback> template <typename Callback>
void enumerateVisibleIcons(Callback callback); void enumerateVisibleIcons(Callback callback);
@ -548,7 +548,7 @@ void StickersListWidget::Footer::mouseMoveEvent(QMouseEvent *e) {
if (!_iconsDragging if (!_iconsDragging
&& !_icons.empty() && !_icons.empty()
&& base::get_if<int>(&_iconDown) != nullptr) { && v::is<int>(_iconDown)) {
if ((_iconsMousePos - _iconsMouseDown).manhattanLength() >= QApplication::startDragDistance()) { if ((_iconsMousePos - _iconsMouseDown).manhattanLength() >= QApplication::startDragDistance()) {
_iconsDragging = true; _iconsDragging = true;
} }
@ -579,7 +579,7 @@ void StickersListWidget::Footer::mouseReleaseEvent(QMouseEvent *e) {
updateSelected(); updateSelected();
if (wasDown == _iconOver) { if (wasDown == _iconOver) {
if (const auto index = base::get_if<int>(&_iconOver)) { if (const auto index = std::get_if<int>(&_iconOver)) {
_iconSelX = anim::value( _iconSelX = anim::value(
*index * st::stickerIconWidth, *index * st::stickerIconWidth,
*index * st::stickerIconWidth); *index * st::stickerIconWidth);
@ -604,7 +604,7 @@ bool StickersListWidget::Footer::eventHook(QEvent *e) {
if (e->type() == QEvent::TouchBegin) { if (e->type() == QEvent::TouchBegin) {
} else if (e->type() == QEvent::Wheel) { } else if (e->type() == QEvent::Wheel) {
if (!_icons.empty() if (!_icons.empty()
&& (base::get_if<int>(&_iconOver) != nullptr) && v::is<int>(_iconOver)
&& (_iconDown == SpecialOver::None)) { && (_iconDown == SpecialOver::None)) {
scrollByWheelEvent(static_cast<QWheelEvent*>(e)); scrollByWheelEvent(static_cast<QWheelEvent*>(e));
} }
@ -635,7 +635,7 @@ void StickersListWidget::Footer::scrollByWheelEvent(
} }
void StickersListWidget::Footer::updateSelected() { void StickersListWidget::Footer::updateSelected() {
if (_iconDown >= 0) { if (_iconDown != SpecialOver::None) {
return; return;
} }
@ -2109,7 +2109,7 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
_previewTimer.cancel(); _previewTimer.cancel();
auto pressed = _pressed; auto pressed = _pressed;
setPressed(std::nullopt); setPressed(v::null);
if (pressed != _selected) { if (pressed != _selected) {
update(); update();
} }
@ -2271,8 +2271,8 @@ void StickersListWidget::enterFromChildEvent(QEvent *e, QWidget *child) {
} }
void StickersListWidget::clearSelection() { void StickersListWidget::clearSelection() {
setPressed(std::nullopt); setPressed(v::null);
setSelected(std::nullopt); setSelected(v::null);
update(); update();
} }
@ -2754,7 +2754,7 @@ void StickersListWidget::updateSelected() {
return; return;
} }
auto newSelected = OverState { std::nullopt }; auto newSelected = OverState { v::null };
auto p = mapFromGlobal(_lastMousePosition); auto p = mapFromGlobal(_lastMousePosition);
if (!rect().contains(p) if (!rect().contains(p)
|| p.y() < getVisibleTop() || p.y() >= getVisibleBottom() || p.y() < getVisibleTop() || p.y() >= getVisibleBottom()

View File

@ -157,7 +157,7 @@ CloudPasswordResult ComputeCheck(
} }
bytes::vector ComputeHash( bytes::vector ComputeHash(
std::nullopt_t, v::null_t,
bytes::const_span password) { bytes::const_span password) {
Unexpected("Bad secure secret algorithm."); Unexpected("Bad secure secret algorithm.");
} }
@ -200,7 +200,7 @@ CloudPasswordCheckRequest ParseCloudPasswordCheckRequest(
CloudPasswordAlgo ValidateNewCloudPasswordAlgo(CloudPasswordAlgo &&parsed) { CloudPasswordAlgo ValidateNewCloudPasswordAlgo(CloudPasswordAlgo &&parsed) {
if (!parsed.is<CloudPasswordAlgoModPow>()) { if (!parsed.is<CloudPasswordAlgoModPow>()) {
return std::nullopt; return v::null;
} }
auto &value = parsed.get_unchecked<CloudPasswordAlgoModPow>(); auto &value = parsed.get_unchecked<CloudPasswordAlgoModPow>();
const auto already = value.salt1.size(); const auto already = value.salt1.size();
@ -216,7 +216,7 @@ MTPPasswordKdfAlgo PrepareCloudPasswordAlgo(const CloudPasswordAlgo &data) {
MTP_bytes(data.salt2), MTP_bytes(data.salt2),
MTP_int(data.g), MTP_int(data.g),
MTP_bytes(data.p)); MTP_bytes(data.p));
}, [](std::nullopt_t) { }, [](v::null_t) {
return MTP_passwordKdfAlgoUnknown(); return MTP_passwordKdfAlgoUnknown();
}); });
} }
@ -230,7 +230,7 @@ bytes::vector ComputeCloudPasswordHash(
bytes::const_span password) { bytes::const_span password) {
return algo.match([&](const CloudPasswordAlgoModPow &data) { return algo.match([&](const CloudPasswordAlgoModPow &data) {
return ComputeHash(data, password); return ComputeHash(data, password);
}, [](std::nullopt_t) -> bytes::vector { }, [](v::null_t) -> bytes::vector {
Unexpected("Bad cloud password algorithm."); Unexpected("Bad cloud password algorithm.");
}); });
} }
@ -240,7 +240,7 @@ CloudPasswordDigest ComputeCloudPasswordDigest(
bytes::const_span password) { bytes::const_span password) {
return algo.match([&](const CloudPasswordAlgoModPow &data) { return algo.match([&](const CloudPasswordAlgoModPow &data) {
return ComputeDigest(data, password); return ComputeDigest(data, password);
}, [](std::nullopt_t) -> CloudPasswordDigest { }, [](v::null_t) -> CloudPasswordDigest {
Unexpected("Bad cloud password algorithm."); Unexpected("Bad cloud password algorithm.");
}); });
} }
@ -250,7 +250,7 @@ CloudPasswordResult ComputeCloudPasswordCheck(
bytes::const_span hash) { bytes::const_span hash) {
return request.algo.match([&](const CloudPasswordAlgoModPow &data) { return request.algo.match([&](const CloudPasswordAlgoModPow &data) {
return ComputeCheck(request, data, hash); return ComputeCheck(request, data, hash);
}, [](std::nullopt_t) -> CloudPasswordResult { }, [](v::null_t) -> CloudPasswordResult {
Unexpected("Bad cloud password algorithm."); Unexpected("Bad cloud password algorithm.");
}); });
} }
@ -271,7 +271,7 @@ SecureSecretAlgo ParseSecureSecretAlgo(
SecureSecretAlgo ValidateNewSecureSecretAlgo(SecureSecretAlgo &&parsed) { SecureSecretAlgo ValidateNewSecureSecretAlgo(SecureSecretAlgo &&parsed) {
if (!parsed.is<SecureSecretAlgoPBKDF2>()) { if (!parsed.is<SecureSecretAlgoPBKDF2>()) {
return std::nullopt; return v::null;
} }
auto &value = parsed.get_unchecked<SecureSecretAlgoPBKDF2>(); auto &value = parsed.get_unchecked<SecureSecretAlgoPBKDF2>();
const auto already = value.salt.size(); const auto already = value.salt.size();
@ -287,7 +287,7 @@ MTPSecurePasswordKdfAlgo PrepareSecureSecretAlgo(
MTP_bytes(data.salt)); MTP_bytes(data.salt));
}, [](const SecureSecretAlgoSHA512 &data) { }, [](const SecureSecretAlgoSHA512 &data) {
return MTP_securePasswordKdfAlgoSHA512(MTP_bytes(data.salt)); return MTP_securePasswordKdfAlgoSHA512(MTP_bytes(data.salt));
}, [](std::nullopt_t) { }, [](v::null_t) {
return MTP_securePasswordKdfAlgoUnknown(); return MTP_securePasswordKdfAlgoUnknown();
}); });
} }

View File

@ -35,7 +35,7 @@ enum Status {
Started Started
}; };
// Open status or crash report dump. // Open status or crash report dump.
using StartResult = base::variant<Status, QByteArray>; using StartResult = std::variant<Status, QByteArray>;
StartResult Start(); StartResult Start();
Status Restart(); // can be only CantOpen or Started Status Restart(); // can be only CantOpen or Started
void Finish(); void Finish();

View File

@ -315,7 +315,7 @@ void Sandbox::singleInstanceChecked() {
return; return;
} }
const auto result = CrashReports::Start(); const auto result = CrashReports::Start();
result.match([&](CrashReports::Status status) { v::match(result, [&](CrashReports::Status status) {
if (status == CrashReports::CantOpen) { if (status == CrashReports::CantOpen) {
new NotStartedWindow(); new NotStartedWindow();
} else { } else {

View File

@ -54,7 +54,7 @@ void CloudImage::set(
_file.flags = CloudFile::Flag(); _file.flags = CloudFile::Flag();
_view = std::weak_ptr<CloudImageView>(); _view = std::weak_ptr<CloudImageView>();
} else if (was != now } else if (was != now
&& (!was.is<InMemoryLocation>() || now.is<InMemoryLocation>())) { && (!v::is<InMemoryLocation>(was) || v::is<InMemoryLocation>(now))) {
_file.location = ImageLocation(); _file.location = ImageLocation();
_view = std::weak_ptr<CloudImageView>(); _view = std::weak_ptr<CloudImageView>();
} }
@ -176,8 +176,8 @@ void UpdateCloudFile(
} }
auto cacheBytes = !data.bytes.isEmpty() auto cacheBytes = !data.bytes.isEmpty()
? data.bytes ? data.bytes
: file.location.file().data.is<InMemoryLocation>() : v::is<InMemoryLocation>(file.location.file().data)
? file.location.file().data.get_unchecked<InMemoryLocation>().bytes ? std::get<InMemoryLocation>(file.location.file().data).bytes
: QByteArray(); : QByteArray();
if (!cacheBytes.isEmpty()) { if (!cacheBytes.isEmpty()) {
if (const auto cacheKey = data.location.file().cacheKey()) { if (const auto cacheKey = data.location.file().cacheKey()) {

View File

@ -148,7 +148,7 @@ inline bool operator<(PhotoFileLocationId a, PhotoFileLocationId b) {
return a.id < b.id; return a.id < b.id;
} }
using FileLocationId = base::variant< using FileLocationId = std::variant<
DocumentFileLocationId, DocumentFileLocationId,
PhotoFileLocationId>; PhotoFileLocationId>;

View File

@ -445,10 +445,10 @@ auto PhotoData::createStreamingLoader(
return Media::Streaming::MakeBytesLoader(media->videoContent()); return Media::Streaming::MakeBytesLoader(media->videoContent());
} }
} }
return videoLocation().file().data.is<StorageFileLocation>() return v::is<StorageFileLocation>(videoLocation().file().data)
? std::make_unique<Media::Streaming::LoaderMtproto>( ? std::make_unique<Media::Streaming::LoaderMtproto>(
&session().downloader(), &session().downloader(),
videoLocation().file().data.get_unchecked<StorageFileLocation>(), std::get<StorageFileLocation>(videoLocation().file().data),
videoByteSize(), videoByteSize(),
origin) origin)
: nullptr; : nullptr;

View File

@ -231,11 +231,11 @@ std::optional<int> SharedMediaWithLastSlice::skippedAfter() const {
} }
std::optional<int> SharedMediaWithLastSlice::indexOfImpl(Value value) const { std::optional<int> SharedMediaWithLastSlice::indexOfImpl(Value value) const {
return base::get_if<FullMsgId>(&value) return std::get_if<FullMsgId>(&value)
? _slice.indexOf(*base::get_if<FullMsgId>(&value)) ? _slice.indexOf(*std::get_if<FullMsgId>(&value))
: (isolatedInSlice() : (isolatedInSlice()
|| !_lastPhotoId || !_lastPhotoId
|| (*base::get_if<not_null<PhotoData*>>(&value))->id != *_lastPhotoId) || (*std::get_if<not_null<PhotoData*>>(&value))->id != *_lastPhotoId)
? std::nullopt ? std::nullopt
: Add(_slice.size() - 1, lastPhotoSkip()); : Add(_slice.size() - 1, lastPhotoSkip());
} }
@ -267,14 +267,14 @@ std::optional<int> SharedMediaWithLastSlice::indexOf(Value value) const {
info.push_back((_ending && _ending->skippedAfter()) info.push_back((_ending && _ending->skippedAfter())
? QString::number(*_ending->skippedAfter()) ? QString::number(*_ending->skippedAfter())
: QString("-")); : QString("-"));
if (const auto msgId = base::get_if<FullMsgId>(&value)) { if (const auto msgId = std::get_if<FullMsgId>(&value)) {
info.push_back("value:" + QString::number(msgId->channel)); info.push_back("value:" + QString::number(msgId->channel));
info.push_back(QString::number(msgId->msg)); info.push_back(QString::number(msgId->msg));
const auto index = _slice.indexOf(*base::get_if<FullMsgId>(&value)); const auto index = _slice.indexOf(*std::get_if<FullMsgId>(&value));
info.push_back("index:" + (index info.push_back("index:" + (index
? QString::number(*index) ? QString::number(*index)
: QString("-"))); : QString("-")));
} else if (const auto photo = base::get_if<not_null<PhotoData*>>(&value)) { } else if (const auto photo = std::get_if<not_null<PhotoData*>>(&value)) {
info.push_back("value:" + QString::number((*photo)->id)); info.push_back("value:" + QString::number((*photo)->id));
} else { } else {
info.push_back("value:bad"); info.push_back("value:bad");
@ -373,7 +373,7 @@ rpl::producer<SharedMediaWithLastSlice> SharedMediaWithLastViewer(
int limitBefore, int limitBefore,
int limitAfter) { int limitAfter) {
return [=](auto consumer) { return [=](auto consumer) {
if (base::get_if<not_null<PhotoData*>>(&key.universalId)) { if (std::get_if<not_null<PhotoData*>>(&key.universalId)) {
return SharedMediaMergedViewer( return SharedMediaMergedViewer(
session, session,
SharedMediaMergedKey( SharedMediaMergedKey(

View File

@ -60,9 +60,9 @@ class SharedMediaWithLastSlice {
public: public:
using Type = Storage::SharedMediaType; using Type = Storage::SharedMediaType;
using Value = base::variant<FullMsgId, not_null<PhotoData*>>; using Value = std::variant<FullMsgId, not_null<PhotoData*>>;
using MessageId = SparseIdsMergedSlice::UniversalMsgId; using MessageId = SparseIdsMergedSlice::UniversalMsgId;
using UniversalMsgId = base::variant< using UniversalMsgId = std::variant<
MessageId, MessageId,
not_null<PhotoData*>>; not_null<PhotoData*>>;
@ -76,8 +76,7 @@ public:
, migratedPeerId(migratedPeerId) , migratedPeerId(migratedPeerId)
, type(type) , type(type)
, universalId(universalId) { , universalId(universalId) {
Expects(base::get_if<MessageId>(&universalId) != nullptr Expects(v::is<MessageId>(universalId) || type == Type::ChatPhoto);
|| type == Type::ChatPhoto);
} }
bool operator==(const Key &other) const { bool operator==(const Key &other) const {
@ -120,8 +119,8 @@ public:
return { return {
key.peerId, key.peerId,
key.migratedPeerId, key.migratedPeerId,
base::get_if<MessageId>(&key.universalId) v::is<MessageId>(key.universalId)
? (*base::get_if<MessageId>(&key.universalId)) ? std::get<MessageId>(key.universalId)
: ServerMaxMsgId - 1 : ServerMaxMsgId - 1
}; };
} }
@ -135,7 +134,7 @@ public:
private: private:
static std::optional<SparseIdsMergedSlice> EndingSlice(const Key &key) { static std::optional<SparseIdsMergedSlice> EndingSlice(const Key &key) {
return base::get_if<MessageId>(&key.universalId) return v::is<MessageId>(key.universalId)
? base::make_optional(SparseIdsMergedSlice(EndingKey(key))) ? base::make_optional(SparseIdsMergedSlice(EndingKey(key)))
: std::nullopt; : std::nullopt;
} }
@ -161,12 +160,12 @@ private:
msgId); msgId);
} }
static Value ComputeId(const Key &key) { static Value ComputeId(const Key &key) {
if (auto messageId = base::get_if<MessageId>(&key.universalId)) { if (const auto messageId = std::get_if<MessageId>(&key.universalId)) {
return (*messageId >= 0) return (*messageId >= 0)
? ComputeId(key.peerId, *messageId) ? ComputeId(key.peerId, *messageId)
: ComputeId(key.migratedPeerId, ServerMaxMsgId + *messageId); : ComputeId(key.migratedPeerId, ServerMaxMsgId + *messageId);
} }
return *base::get_if<not_null<PhotoData*>>(&key.universalId); return std::get<not_null<PhotoData*>>(key.universalId);
} }
bool isolatedInSlice() const { bool isolatedInSlice() const {

View File

@ -29,7 +29,7 @@ enum class WebPageType {
WebPageType ParseWebPageType(const MTPDwebPage &type); WebPageType ParseWebPageType(const MTPDwebPage &type);
struct WebPageCollage { struct WebPageCollage {
using Item = base::variant<PhotoData*, DocumentData*>; using Item = std::variant<PhotoData*, DocumentData*>;
WebPageCollage() = default; WebPageCollage() = default;
explicit WebPageCollage( explicit WebPageCollage(

View File

@ -786,10 +786,10 @@ Utf8String User::name() const {
} }
const User *Peer::user() const { const User *Peer::user() const {
return base::get_if<User>(&data); return std::get_if<User>(&data);
} }
const Chat *Peer::chat() const { const Chat *Peer::chat() const {
return base::get_if<Chat>(&data); return std::get_if<Chat>(&data);
} }
PeerId Peer::id() const { PeerId Peer::id() const {

View File

@ -240,7 +240,7 @@ struct Peer {
const User *user() const; const User *user() const;
const Chat *chat() const; const Chat *chat() const;
base::variant<User, Chat> data; std::variant<User, Chat> data;
}; };

View File

@ -1090,7 +1090,7 @@ auto HtmlWriter::Wrap::pushMessage(
return serviceFrom + " joined Telegram"; return serviceFrom + " joined Telegram";
}, [&](const ActionPhoneNumberRequest &data) { }, [&](const ActionPhoneNumberRequest &data) {
return serviceFrom + " requested your phone number"; return serviceFrom + " requested your phone number";
}, [](std::nullopt_t) { return QByteArray(); }); }, [](v::null_t) { return QByteArray(); });
if (!serviceText.isEmpty()) { if (!serviceText.isEmpty()) {
const auto &content = message.action.content; const auto &content = message.action.content;
@ -1753,7 +1753,7 @@ MediaData HtmlWriter::Wrap::prepareMediaData(
}, [](const Poll &data) { }, [](const Poll &data) {
}, [](const UnsupportedMedia &data) { }, [](const UnsupportedMedia &data) {
Unexpected("Unsupported message."); Unexpected("Unsupported message.");
}, [](std::nullopt_t) {}); }, [](v::null_t) {});
return result; return result;
} }

View File

@ -471,7 +471,7 @@ QByteArray SerializeMessage(
}, [&](const ActionPhoneNumberRequest &data) { }, [&](const ActionPhoneNumberRequest &data) {
pushActor(); pushActor();
pushAction("requested_phone_number"); pushAction("requested_phone_number");
}, [](std::nullopt_t) {}); }, [](v::null_t) {});
if (!message.action.content) { if (!message.action.content) {
pushFrom(); pushFrom();
@ -612,7 +612,7 @@ QByteArray SerializeMessage(
})); }));
}, [](const UnsupportedMedia &data) { }, [](const UnsupportedMedia &data) {
Unexpected("Unsupported message."); Unexpected("Unsupported message.");
}, [](std::nullopt_t) {}); }, [](v::null_t) {});
pushBare("text", SerializeText(context, message.text)); pushBare("text", SerializeText(context, message.text));

View File

@ -338,7 +338,7 @@ QByteArray SerializeMessage(
}, [&](const ActionPhoneNumberRequest &data) { }, [&](const ActionPhoneNumberRequest &data) {
pushActor(); pushActor();
pushAction("Request Phone Number"); pushAction("Request Phone Number");
}, [](std::nullopt_t) {}); }, [](v::null_t) {});
if (!message.action.content) { if (!message.action.content) {
pushFrom(); pushFrom();
@ -456,7 +456,7 @@ QByteArray SerializeMessage(
} }
}, [](const UnsupportedMedia &data) { }, [](const UnsupportedMedia &data) {
Unexpected("Unsupported message."); Unexpected("Unsupported message.");
}, [](std::nullopt_t) {}); }, [](v::null_t) {});
auto value = JoinList(QByteArray(), ranges::view::all( auto value = JoinList(QByteArray(), ranges::view::all(
message.text message.text

View File

@ -1444,7 +1444,7 @@ void Gif::setStreamed(std::unique_ptr<Streamed> value) {
void Gif::handleStreamingUpdate(::Media::Streaming::Update &&update) { void Gif::handleStreamingUpdate(::Media::Streaming::Update &&update) {
using namespace ::Media::Streaming; using namespace ::Media::Streaming;
update.data.match([&](Information &update) { v::match(update.data, [&](Information &update) {
streamingReady(std::move(update)); streamingReady(std::move(update));
}, [&](const PreloadedVideo &update) { }, [&](const PreloadedVideo &update) {
}, [&](const UpdateVideo &update) { }, [&](const UpdateVideo &update) {

View File

@ -704,7 +704,7 @@ void Photo::setStreamed(std::unique_ptr<Streamed> value) {
void Photo::handleStreamingUpdate(::Media::Streaming::Update &&update) { void Photo::handleStreamingUpdate(::Media::Streaming::Update &&update) {
using namespace ::Media::Streaming; using namespace ::Media::Streaming;
update.data.match([&](Information &update) { v::match(update.data, [&](Information &update) {
streamingReady(std::move(update)); streamingReady(std::move(update));
}, [&](const PreloadedVideo &update) { }, [&](const PreloadedVideo &update) {
}, [&](const UpdateVideo &update) { }, [&](const UpdateVideo &update) {

View File

@ -313,7 +313,7 @@ void Sticker::lottieCreated() {
_lottie->updates( _lottie->updates(
) | rpl::start_with_next([=](Lottie::Update update) { ) | rpl::start_with_next([=](Lottie::Update update) {
update.data.match([&](const Lottie::Information &information) { v::match(update.data, [&](const Lottie::Information &information) {
_parent->history()->owner().requestViewResize(_parent); _parent->history()->owner().requestViewResize(_parent);
}, [&](const Lottie::DisplayFrameRequest &request) { }, [&](const Lottie::DisplayFrameRequest &request) {
_parent->history()->owner().requestViewRepaint(_parent); _parent->history()->owner().requestViewRepaint(_parent);

View File

@ -53,11 +53,11 @@ std::vector<std::unique_ptr<Data::Media>> PrepareCollageMedia(
auto result = std::vector<std::unique_ptr<Data::Media>>(); auto result = std::vector<std::unique_ptr<Data::Media>>();
result.reserve(data.items.size()); result.reserve(data.items.size());
for (const auto item : data.items) { for (const auto item : data.items) {
if (const auto document = base::get_if<DocumentData*>(&item)) { if (const auto document = std::get_if<DocumentData*>(&item)) {
result.push_back(std::make_unique<Data::MediaFile>( result.push_back(std::make_unique<Data::MediaFile>(
parent, parent,
*document)); *document));
} else if (const auto photo = base::get_if<PhotoData*>(&item)) { } else if (const auto photo = std::get_if<PhotoData*>(&item)) {
result.push_back(std::make_unique<Data::MediaPhoto>( result.push_back(std::make_unique<Data::MediaPhoto>(
parent, parent,
*photo)); *photo));

View File

@ -40,7 +40,7 @@ Key::Key(not_null<PollData*> poll, FullMsgId contextId)
} }
PeerData *Key::peer() const { PeerData *Key::peer() const {
if (const auto peer = base::get_if<not_null<PeerData*>>(&_value)) { if (const auto peer = std::get_if<not_null<PeerData*>>(&_value)) {
return *peer; return *peer;
} }
return nullptr; return nullptr;
@ -54,21 +54,21 @@ PeerData *Key::peer() const {
//} //}
UserData *Key::settingsSelf() const { UserData *Key::settingsSelf() const {
if (const auto tag = base::get_if<Settings::Tag>(&_value)) { if (const auto tag = std::get_if<Settings::Tag>(&_value)) {
return tag->self; return tag->self;
} }
return nullptr; return nullptr;
} }
PollData *Key::poll() const { PollData *Key::poll() const {
if (const auto data = base::get_if<PollKey>(&_value)) { if (const auto data = std::get_if<PollKey>(&_value)) {
return data->poll; return data->poll;
} }
return nullptr; return nullptr;
} }
FullMsgId Key::pollContextId() const { FullMsgId Key::pollContextId() const {
if (const auto data = base::get_if<PollKey>(&_value)) { if (const auto data = std::get_if<PollKey>(&_value)) {
return data->contextId; return data->contextId;
} }
return FullMsgId(); return FullMsgId();

View File

@ -46,7 +46,7 @@ private:
not_null<PollData*> poll; not_null<PollData*> poll;
FullMsgId contextId; FullMsgId contextId;
}; };
base::variant< std::variant<
not_null<PeerData*>, not_null<PeerData*>,
//not_null<Data::Feed*>, // #feed //not_null<Data::Feed*>, // #feed
Settings::Tag, Settings::Tag,

View File

@ -758,7 +758,7 @@ void Instance::handleStreamingUpdate(
Streaming::Update &&update) { Streaming::Update &&update) {
using namespace Streaming; using namespace Streaming;
update.data.match([&](Information &update) { v::match(update.data, [&](Information &update) {
if (!update.video.size.isEmpty()) { if (!update.video.size.isEmpty()) {
data->streamed->progress.setValueChangedCallback([=]( data->streamed->progress.setValueChangedCallback([=](
float64, float64,

View File

@ -96,7 +96,7 @@ struct Finished {
}; };
struct Update { struct Update {
base::variant< std::variant<
Information, Information,
PreloadedVideo, PreloadedVideo,
UpdateVideo, UpdateVideo,

View File

@ -138,7 +138,7 @@ Ui::RadialState Document::waitingState() const {
} }
void Document::handleUpdate(Update &&update) { void Document::handleUpdate(Update &&update) {
update.data.match([&](Information &update) { v::match(update.data, [&](Information &update) {
ready(std::move(update)); ready(std::move(update));
}, [&](const PreloadedVideo &update) { }, [&](const PreloadedVideo &update) {
_info.video.state.receivedTill = update.till; _info.video.state.receivedTill = update.till;

View File

@ -228,7 +228,7 @@ void File::Context::seekToPosition(
return logFatal(qstr("av_seek_frame"), error); return logFatal(qstr("av_seek_frame"), error);
} }
base::variant<FFmpeg::Packet, FFmpeg::AvErrorWrap> File::Context::readPacket() { std::variant<FFmpeg::Packet, FFmpeg::AvErrorWrap> File::Context::readPacket() {
auto error = FFmpeg::AvErrorWrap(); auto error = FFmpeg::AvErrorWrap();
auto result = FFmpeg::Packet(); auto result = FFmpeg::Packet();
@ -312,7 +312,7 @@ void File::Context::readNextPacket() {
auto result = readPacket(); auto result = readPacket();
if (unroll()) { if (unroll()) {
return; return;
} else if (const auto packet = base::get_if<FFmpeg::Packet>(&result)) { } else if (const auto packet = std::get_if<FFmpeg::Packet>(&result)) {
const auto index = packet->fields().stream_index; const auto index = packet->fields().stream_index;
const auto i = _queuedPackets.find(index); const auto i = _queuedPackets.find(index);
if (i == end(_queuedPackets)) { if (i == end(_queuedPackets)) {
@ -325,8 +325,8 @@ void File::Context::readNextPacket() {
Assert(i->second.size() < kMaxQueuedPackets); Assert(i->second.size() < kMaxQueuedPackets);
} else { } else {
// Still trying to read by drain. // Still trying to read by drain.
Assert(result.is<FFmpeg::AvErrorWrap>()); Assert(v::is<FFmpeg::AvErrorWrap>(result));
Assert(result.get<FFmpeg::AvErrorWrap>().code() == AVERROR_EOF); Assert(std::get<FFmpeg::AvErrorWrap>(result).code() == AVERROR_EOF);
processQueuedPackets(SleepPolicy::Allowed); processQueuedPackets(SleepPolicy::Allowed);
if (!finished()) { if (!finished()) {
handleEndOfFile(); handleEndOfFile();

View File

@ -82,7 +82,7 @@ private:
// TODO base::expected. // TODO base::expected.
[[nodiscard]] auto readPacket() [[nodiscard]] auto readPacket()
-> base::variant<FFmpeg::Packet, FFmpeg::AvErrorWrap>; -> std::variant<FFmpeg::Packet, FFmpeg::AvErrorWrap>;
void processQueuedPackets(SleepPolicy policy); void processQueuedPackets(SleepPolicy policy);
void handleEndOfFile(); void handleEndOfFile();

View File

@ -31,7 +31,9 @@ LoaderMtproto::LoaderMtproto(
} }
Storage::Cache::Key LoaderMtproto::baseCacheKey() const { Storage::Cache::Key LoaderMtproto::baseCacheKey() const {
return location().data.get<StorageFileLocation>().bigFileBaseCacheKey(); return std::get<StorageFileLocation>(
location().data
).bigFileBaseCacheKey();
} }
int LoaderMtproto::size() const { int LoaderMtproto::size() const {

View File

@ -239,7 +239,7 @@ void VideoTrackObject::readFrames() {
if (delay != kTimeUnknown) { if (delay != kTimeUnknown) {
queueReadFrames(delay); queueReadFrames(delay);
} }
}, [](std::nullopt_t) { }, [](v::null_t) {
}); });
if (result.has_value()) { if (result.has_value()) {
break; break;
@ -258,12 +258,12 @@ auto VideoTrackObject::readEnoughFrames(crl::time trackTime)
return result; return result;
} else if (!dropStaleFrames } else if (!dropStaleFrames
|| !VideoTrack::IsStale(frame, trackTime)) { || !VideoTrack::IsStale(frame, trackTime)) {
return std::nullopt; return v::null;
} }
} }
}, [&](Shared::PrepareNextCheck delay) -> ReadEnoughState { }, [&](Shared::PrepareNextCheck delay) -> ReadEnoughState {
return delay; return delay;
}, [&](std::nullopt_t) -> ReadEnoughState { }, [&](v::null_t) -> ReadEnoughState {
return FrameResult::Done; return FrameResult::Done;
}); });
} }

View File

@ -38,7 +38,7 @@ using Context = GroupThumbs::Context;
using Key = GroupThumbs::Key; using Key = GroupThumbs::Key;
Data::FileOrigin ComputeFileOrigin(const Key &key, const Context &context) { Data::FileOrigin ComputeFileOrigin(const Key &key, const Context &context) {
return key.match([&](PhotoId photoId) { return v::match(key, [&](PhotoId photoId) {
return context.match([&](PeerId peerId) { return context.match([&](PeerId peerId) {
return peerIsUser(peerId) return peerIsUser(peerId)
? Data::FileOriginUserPhoto(peerToUser(peerId), photoId) ? Data::FileOriginUserPhoto(peerToUser(peerId), photoId)
@ -64,12 +64,12 @@ Context ComputeContext(
Expects(index >= 0 && index < slice.size()); Expects(index >= 0 && index < slice.size());
const auto value = slice[index]; const auto value = slice[index];
if (const auto photo = base::get_if<not_null<PhotoData*>>(&value)) { if (const auto photo = std::get_if<not_null<PhotoData*>>(&value)) {
if (const auto peer = (*photo)->peer) { if (const auto peer = (*photo)->peer) {
return peer->id; return peer->id;
} }
return std::nullopt; return v::null;
} else if (const auto msgId = base::get_if<FullMsgId>(&value)) { } else if (const auto msgId = std::get_if<FullMsgId>(&value)) {
if (const auto item = session->data().message(*msgId)) { if (const auto item = session->data().message(*msgId)) {
if (!item->toHistoryMessage()) { if (!item->toHistoryMessage()) {
return item->history()->peer->id; return item->history()->peer->id;
@ -77,7 +77,7 @@ Context ComputeContext(
return groupId; return groupId;
} }
} }
return std::nullopt; return v::null;
} }
Unexpected("Variant in ComputeContext(SharedMediaWithLastSlice::Value)"); Unexpected("Variant in ComputeContext(SharedMediaWithLastSlice::Value)");
} }
@ -100,9 +100,9 @@ Key ComputeKey(const SharedMediaWithLastSlice &slice, int index) {
Expects(index >= 0 && index < slice.size()); Expects(index >= 0 && index < slice.size());
const auto value = slice[index]; const auto value = slice[index];
if (const auto photo = base::get_if<not_null<PhotoData*>>(&value)) { if (const auto photo = std::get_if<not_null<PhotoData*>>(&value)) {
return (*photo)->id; return (*photo)->id;
} else if (const auto msgId = base::get_if<FullMsgId>(&value)) { } else if (const auto msgId = std::get_if<FullMsgId>(&value)) {
return *msgId; return *msgId;
} }
Unexpected("Variant in ComputeKey(SharedMediaWithLastSlice::Value)"); Unexpected("Variant in ComputeKey(SharedMediaWithLastSlice::Value)");
@ -564,10 +564,10 @@ void GroupThumbs::animatePreviouslyAlive(
auto GroupThumbs::createThumb(Key key) auto GroupThumbs::createThumb(Key key)
-> std::unique_ptr<Thumb> { -> std::unique_ptr<Thumb> {
if (const auto photoId = base::get_if<PhotoId>(&key)) { if (const auto photoId = std::get_if<PhotoId>(&key)) {
const auto photo = _session->data().photo(*photoId); const auto photo = _session->data().photo(*photoId);
return createThumb(key, photo); return createThumb(key, photo);
} else if (const auto msgId = base::get_if<FullMsgId>(&key)) { } else if (const auto msgId = std::get_if<FullMsgId>(&key)) {
if (const auto item = _session->data().message(*msgId)) { if (const auto item = _session->data().message(*msgId)) {
if (const auto media = item->media()) { if (const auto media = item->media()) {
if (const auto photo = media->photo()) { if (const auto photo = media->photo()) {
@ -578,7 +578,7 @@ auto GroupThumbs::createThumb(Key key)
} }
} }
return createThumb(key, nullptr); return createThumb(key, nullptr);
} else if (const auto collageKey = base::get_if<CollageKey>(&key)) { } else if (const auto collageKey = std::get_if<CollageKey>(&key)) {
if (const auto itemId = base::get_if<FullMsgId>(&_context)) { if (const auto itemId = base::get_if<FullMsgId>(&_context)) {
if (const auto item = _session->data().message(*itemId)) { if (const auto item = _session->data().message(*itemId)) {
if (const auto media = item->media()) { if (const auto media = item->media()) {
@ -605,9 +605,9 @@ auto GroupThumbs::createThumb(
return createThumb(key, nullptr); return createThumb(key, nullptr);
} }
const auto &item = collage.items[index]; const auto &item = collage.items[index];
if (const auto photo = base::get_if<PhotoData*>(&item)) { if (const auto photo = std::get_if<PhotoData*>(&item)) {
return createThumb(key, (*photo)); return createThumb(key, (*photo));
} else if (const auto document = base::get_if<DocumentData*>(&item)) { } else if (const auto document = std::get_if<DocumentData*>(&item)) {
return createThumb(key, (*document)); return createThumb(key, (*document));
} }
return createThumb(key, nullptr); return createThumb(key, nullptr);

View File

@ -37,7 +37,7 @@ public:
int size() const; int size() const;
}; };
using Key = base::variant<PhotoId, FullMsgId, CollageKey>; using Key = std::variant<PhotoId, FullMsgId, CollageKey>;
static void Refresh( static void Refresh(
not_null<Main::Session*> session, not_null<Main::Session*> session,

View File

@ -1116,7 +1116,7 @@ void OverlayWidget::clearSession() {
clearStreaming(); clearStreaming();
delete _menu; delete _menu;
_menu = nullptr; _menu = nullptr;
setContext(std::nullopt); setContext(v::null);
_from = nullptr; _from = nullptr;
_fromName = QString(); _fromName = QString();
assignMediaPointer(nullptr); assignMediaPointer(nullptr);
@ -1589,7 +1589,7 @@ auto OverlayWidget::sharedMediaKey() const -> std::optional<SharedMediaKey> {
_history->peer->id, _history->peer->id,
_migrated ? _migrated->peer->id : 0, _migrated ? _migrated->peer->id : 0,
SharedMediaType::ChatPhoto, SharedMediaType::ChatPhoto,
_peer->userpicPhotoId() _photo
}; };
} }
if (!IsServerMsgId(_msgid.msg)) { if (!IsServerMsgId(_msgid.msg)) {
@ -1947,12 +1947,12 @@ void OverlayWidget::initGroupThumbs() {
_groupThumbs->activateRequests( _groupThumbs->activateRequests(
) | rpl::start_with_next([this](View::GroupThumbs::Key key) { ) | rpl::start_with_next([this](View::GroupThumbs::Key key) {
using CollageKey = View::GroupThumbs::CollageKey; using CollageKey = View::GroupThumbs::CollageKey;
if (const auto photoId = base::get_if<PhotoId>(&key)) { if (const auto photoId = std::get_if<PhotoId>(&key)) {
const auto photo = _session->data().photo(*photoId); const auto photo = _session->data().photo(*photoId);
moveToEntity({ photo, nullptr }); moveToEntity({ photo, nullptr });
} else if (const auto itemId = base::get_if<FullMsgId>(&key)) { } else if (const auto itemId = std::get_if<FullMsgId>(&key)) {
moveToEntity(entityForItemId(*itemId)); moveToEntity(entityForItemId(*itemId));
} else if (const auto collageKey = base::get_if<CollageKey>(&key)) { } else if (const auto collageKey = std::get_if<CollageKey>(&key)) {
if (_collageData) { if (_collageData) {
moveToEntity(entityForCollage(collageKey->index)); moveToEntity(entityForCollage(collageKey->index));
} }
@ -1990,7 +1990,7 @@ void OverlayWidget::showPhoto(
if (context) { if (context) {
setContext(context); setContext(context);
} else { } else {
setContext(std::nullopt); setContext(v::null);
} }
clearControlsState(); clearControlsState();
@ -2039,7 +2039,7 @@ void OverlayWidget::showDocument(
if (context) { if (context) {
setContext(context); setContext(context);
} else { } else {
setContext(std::nullopt); setContext(v::null);
} }
clearControlsState(); clearControlsState();
@ -2490,7 +2490,7 @@ QImage OverlayWidget::transformStaticContent(QPixmap content) const {
void OverlayWidget::handleStreamingUpdate(Streaming::Update &&update) { void OverlayWidget::handleStreamingUpdate(Streaming::Update &&update) {
using namespace Streaming; using namespace Streaming;
update.data.match([&](Information &update) { v::match(update.data, [&](Information &update) {
streamingReady(std::move(update)); streamingReady(std::move(update));
}, [&](const PreloadedVideo &update) { }, [&](const PreloadedVideo &update) {
updatePlaybackState(); updatePlaybackState();
@ -3535,29 +3535,29 @@ OverlayWidget::Entity OverlayWidget::entityForUserPhotos(int index) const {
Expects(_session != nullptr); Expects(_session != nullptr);
if (index < 0 || index >= _userPhotosData->size()) { if (index < 0 || index >= _userPhotosData->size()) {
return { std::nullopt, nullptr }; return { v::null, nullptr };
} }
const auto id = (*_userPhotosData)[index]; const auto id = (*_userPhotosData)[index];
if (const auto photo = _session->data().photo(id)) { if (const auto photo = _session->data().photo(id)) {
return { photo, nullptr }; return { photo, nullptr };
} }
return { std::nullopt, nullptr }; return { v::null, nullptr };
} }
OverlayWidget::Entity OverlayWidget::entityForSharedMedia(int index) const { OverlayWidget::Entity OverlayWidget::entityForSharedMedia(int index) const {
Expects(_sharedMediaData.has_value()); Expects(_sharedMediaData.has_value());
if (index < 0 || index >= _sharedMediaData->size()) { if (index < 0 || index >= _sharedMediaData->size()) {
return { std::nullopt, nullptr }; return { v::null, nullptr };
} }
auto value = (*_sharedMediaData)[index]; auto value = (*_sharedMediaData)[index];
if (const auto photo = base::get_if<not_null<PhotoData*>>(&value)) { if (const auto photo = std::get_if<not_null<PhotoData*>>(&value)) {
// Last peer photo. // Last peer photo.
return { *photo, nullptr }; return { *photo, nullptr };
} else if (const auto itemId = base::get_if<FullMsgId>(&value)) { } else if (const auto itemId = std::get_if<FullMsgId>(&value)) {
return entityForItemId(*itemId); return entityForItemId(*itemId);
} }
return { std::nullopt, nullptr }; return { v::null, nullptr };
} }
OverlayWidget::Entity OverlayWidget::entityForCollage(int index) const { OverlayWidget::Entity OverlayWidget::entityForCollage(int index) const {
@ -3567,14 +3567,14 @@ OverlayWidget::Entity OverlayWidget::entityForCollage(int index) const {
const auto item = _session->data().message(_msgid); const auto item = _session->data().message(_msgid);
const auto &items = _collageData->items; const auto &items = _collageData->items;
if (!item || index < 0 || index >= items.size()) { if (!item || index < 0 || index >= items.size()) {
return { std::nullopt, nullptr }; return { v::null, nullptr };
} }
if (const auto document = base::get_if<DocumentData*>(&items[index])) { if (const auto document = std::get_if<DocumentData*>(&items[index])) {
return { *document, item }; return { *document, item };
} else if (const auto photo = base::get_if<PhotoData*>(&items[index])) { } else if (const auto photo = std::get_if<PhotoData*>(&items[index])) {
return { *photo, item }; return { *photo, item };
} }
return { std::nullopt, nullptr }; return { v::null, nullptr };
} }
OverlayWidget::Entity OverlayWidget::entityForItemId(const FullMsgId &itemId) const { OverlayWidget::Entity OverlayWidget::entityForItemId(const FullMsgId &itemId) const {
@ -3588,9 +3588,9 @@ OverlayWidget::Entity OverlayWidget::entityForItemId(const FullMsgId &itemId) co
return { document, item }; return { document, item };
} }
} }
return { std::nullopt, item }; return { v::null, item };
} }
return { std::nullopt, nullptr }; return { v::null, nullptr };
} }
OverlayWidget::Entity OverlayWidget::entityByIndex(int index) const { OverlayWidget::Entity OverlayWidget::entityByIndex(int index) const {
@ -3601,7 +3601,7 @@ OverlayWidget::Entity OverlayWidget::entityByIndex(int index) const {
} else if (_collageData) { } else if (_collageData) {
return entityForCollage(index); return entityForCollage(index);
} }
return { std::nullopt, nullptr }; return { v::null, nullptr };
} }
void OverlayWidget::setContext( void OverlayWidget::setContext(
@ -3689,7 +3689,7 @@ bool OverlayWidget::moveToEntity(const Entity &entity, int preloadDelta) {
} else if (_peer) { } else if (_peer) {
setContext(_peer); setContext(_peer);
} else { } else {
setContext(std::nullopt); setContext(v::null);
} }
clearStreaming(); clearStreaming();
_streamingStartPaused = false; _streamingStartPaused = false;

View File

@ -1326,7 +1326,7 @@ void Pip::paintPlaybackTexts(QPainter &p) const {
void Pip::handleStreamingUpdate(Streaming::Update &&update) { void Pip::handleStreamingUpdate(Streaming::Update &&update) {
using namespace Streaming; using namespace Streaming;
update.data.match([&](Information &update) { v::match(update.data, [&](Information &update) {
_panel.setAspectRatio( _panel.setAspectRatio(
FlipSizeByRotation(update.video.size, _rotation)); FlipSizeByRotation(update.video.size, _rotation));
}, [&](const PreloadedVideo &update) { }, [&](const PreloadedVideo &update) {

View File

@ -162,12 +162,18 @@ class Sender {
return std::move(_done); return std::move(_done);
} }
RPCFailHandlerPtr takeOnFail() { RPCFailHandlerPtr takeOnFail() {
if (auto handler = base::get_if<FailPlainHandler>(&_fail)) { return v::match(_fail, [&](FailPlainHandler &value)
return std::make_shared<FailHandler<FailPlainPolicy>>(_sender, std::move(*handler), _failSkipPolicy); -> RPCFailHandlerPtr {
} else if (auto handler = base::get_if<FailRequestIdHandler>(&_fail)) { return std::make_shared<FailHandler<FailPlainPolicy>>(
return std::make_shared<FailHandler<FailRequestIdPolicy>>(_sender, std::move(*handler), _failSkipPolicy); _sender,
} std::move(value),
return RPCFailHandlerPtr(); _failSkipPolicy);
}, [&](FailRequestIdHandler &value) -> RPCFailHandlerPtr {
return std::make_shared<FailHandler<FailRequestIdPolicy>>(
_sender,
std::move(value),
_failSkipPolicy);
});
} }
mtpRequestId takeAfter() const noexcept { mtpRequestId takeAfter() const noexcept {
return _afterRequestId; return _afterRequestId;
@ -185,7 +191,7 @@ class Sender {
ShiftedDcId _dcId = 0; ShiftedDcId _dcId = 0;
crl::time _canWait = 0; crl::time _canWait = 0;
RPCDoneHandlerPtr _done; RPCDoneHandlerPtr _done;
base::variant<FailPlainHandler, FailRequestIdHandler> _fail; std::variant<FailPlainHandler, FailRequestIdHandler> _fail;
FailSkipPolicy _failSkipPolicy = FailSkipPolicy::Simple; FailSkipPolicy _failSkipPolicy = FailSkipPolicy::Simple;
mtpRequestId _afterRequestId = 0; mtpRequestId _afterRequestId = 0;

View File

@ -64,7 +64,7 @@ struct ScopeError {
// FileKey - file_hash error (bad scan / selfie / translation) // FileKey - file_hash error (bad scan / selfie / translation)
// General - general value error (or scan / translation missing) // General - general value error (or scan / translation missing)
// QString - data_hash with such key error (bad value) // QString - data_hash with such key error (bad value)
base::variant<FileKey, General, QString> key; std::variant<FileKey, General, QString> key;
QString text; QString text;
}; };

View File

@ -37,7 +37,7 @@ constexpr auto kJpegQuality = 89;
static_assert(kMaxSize <= Storage::kUseBigFilesFrom); static_assert(kMaxSize <= Storage::kUseBigFilesFrom);
base::variant<ReadScanError, QByteArray> ProcessImage(QByteArray &&bytes) { std::variant<ReadScanError, QByteArray> ProcessImage(QByteArray &&bytes) {
auto image = App::readImage(base::take(bytes)); auto image = App::readImage(base::take(bytes));
if (image.isNull()) { if (image.isNull()) {
return ReadScanError::CantReadImage; return ReadScanError::CantReadImage;
@ -901,10 +901,10 @@ void EditScans::ChooseScan(
remainingFiles = std::move(remainingFiles) remainingFiles = std::move(remainingFiles)
]() mutable { ]() mutable {
auto result = ProcessImage(std::move(bytes)); auto result = ProcessImage(std::move(bytes));
if (const auto error = base::get_if<ReadScanError>(&result)) { if (const auto error = std::get_if<ReadScanError>(&result)) {
onMainError(*error); onMainError(*error);
} else { } else {
auto content = base::get_if<QByteArray>(&result); auto content = std::get_if<QByteArray>(&result);
Assert(content != nullptr); Assert(content != nullptr);
crl::on_main([ crl::on_main([
=, =,

View File

@ -216,7 +216,11 @@ private:
}; };
struct ClearFinish { struct ClearFinish {
}; };
using ClearTask = base::variant<ClearFromHistory, ClearFromSession, ClearAll, ClearFinish>; using ClearTask = std::variant<
ClearFromHistory,
ClearFromSession,
ClearAll,
ClearFinish>;
std::vector<ClearTask> _clearingTasks; std::vector<ClearTask> _clearingTasks;
}; };
@ -285,21 +289,20 @@ void Manager::Private::clearingThreadLoop() {
auto clearFromSessions = base::flat_set<uint64>(); auto clearFromSessions = base::flat_set<uint64>();
{ {
std::unique_lock<std::mutex> lock(_clearingMutex); std::unique_lock<std::mutex> lock(_clearingMutex);
while (_clearingTasks.empty()) { while (_clearingTasks.empty()) {
_clearingCondition.wait(lock); _clearingCondition.wait(lock);
} }
for (auto &task : _clearingTasks) { for (auto &task : _clearingTasks) {
if (base::get_if<ClearFinish>(&task)) { v::match(task, [&](ClearFinish) {
finished = true; finished = true;
clearAll = true; clearAll = true;
} else if (base::get_if<ClearAll>(&task)) { }, [&](ClearAll) {
clearAll = true; clearAll = true;
} else if (auto fromHistory = base::get_if<ClearFromHistory>(&task)) { }, [&](const ClearFromHistory &value) {
clearFromPeers.emplace(fromHistory->fullPeer); clearFromPeers.emplace(value.fullPeer);
} else if (auto fromSession = base::get_if<ClearFromSession>(&task)) { }, [&](const ClearFromSession &value) {
clearFromSessions.emplace(fromSession->sessionId); clearFromSessions.emplace(value.sessionId);
} });
} }
_clearingTasks.clear(); _clearingTasks.clear();
} }

View File

@ -442,7 +442,7 @@ Data::FileOrigin DownloadMtprotoTask::fileOrigin() const {
} }
uint64 DownloadMtprotoTask::objectId() const { uint64 DownloadMtprotoTask::objectId() const {
if (const auto v = base::get_if<StorageFileLocation>(&_location.data)) { if (const auto v = std::get_if<StorageFileLocation>(&_location.data)) {
return v->objectId(); return v->objectId();
} }
return 0; return 0;
@ -456,7 +456,7 @@ void DownloadMtprotoTask::refreshFileReferenceFrom(
const Data::UpdatedFileReferences &updates, const Data::UpdatedFileReferences &updates,
int requestId, int requestId,
const QByteArray &current) { const QByteArray &current) {
if (const auto v = base::get_if<StorageFileLocation>(&_location.data)) { if (const auto v = std::get_if<StorageFileLocation>(&_location.data)) {
v->refreshFileReference(updates); v->refreshFileReference(updates);
if (v->fileReference() == current) { if (v->fileReference() == current) {
cancelOnFail(); cancelOnFail();
@ -525,7 +525,7 @@ mtpRequestId DownloadMtprotoTask::sendRequest(
cdnPartFailed(error, id); cdnPartFailed(error, id);
}).toDC(shiftedDcId).send(); }).toDC(shiftedDcId).send();
} }
return _location.data.match([&](const WebFileLocation &location) { return v::match(_location.data, [&](const WebFileLocation &location) {
return api().request(MTPupload_GetWebFile( return api().request(MTPupload_GetWebFile(
MTP_inputWebFileLocation( MTP_inputWebFileLocation(
MTP_bytes(location.url()), MTP_bytes(location.url()),

View File

@ -120,7 +120,7 @@ private:
class DownloadMtprotoTask : public base::has_weak_ptr { class DownloadMtprotoTask : public base::has_weak_ptr {
public: public:
struct Location { struct Location {
base::variant< std::variant<
StorageFileLocation, StorageFileLocation,
WebFileLocation, WebFileLocation,
GeoPointLocation> data; GeoPointLocation> data;

View File

@ -488,7 +488,7 @@ std::unique_ptr<FileLoader> CreateFileLoader(
bool autoLoading, bool autoLoading,
uint8 cacheTag) { uint8 cacheTag) {
auto result = std::unique_ptr<FileLoader>(); auto result = std::unique_ptr<FileLoader>();
location.data.match([&](const StorageFileLocation &data) { v::match(location.data, [&](const StorageFileLocation &data) {
result = std::make_unique<mtpFileLoader>( result = std::make_unique<mtpFileLoader>(
session, session,
data, data,

View File

@ -179,7 +179,7 @@ void mtpFileLoader::cancelHook() {
} }
Storage::Cache::Key mtpFileLoader::cacheKey() const { Storage::Cache::Key mtpFileLoader::cacheKey() const {
return location().data.match([&](const WebFileLocation &location) { return v::match(location().data, [&](const WebFileLocation &location) {
return Data::WebDocumentCacheKey(location); return Data::WebDocumentCacheKey(location);
}, [&](const GeoPointLocation &location) { }, [&](const GeoPointLocation &location) {
return Data::GeoPointCacheKey(location); return Data::GeoPointCacheKey(location);

View File

@ -44,7 +44,7 @@ struct Progress {
qint64 total = 0; qint64 total = 0;
}; };
using Update = base::variant<Progress, QByteArray, Error>; using Update = std::variant<Progress, QByteArray, Error>;
struct UpdateForLoader { struct UpdateForLoader {
not_null<webFileLoader*> loader; not_null<webFileLoader*> loader;
@ -473,9 +473,9 @@ void webFileLoader::startLoading() {
_manager->updates( _manager->updates(
this this
) | rpl::start_with_next([=](const Update &data) { ) | rpl::start_with_next([=](const Update &data) {
if (const auto progress = base::get_if<Progress>(&data)) { if (const auto progress = std::get_if<Progress>(&data)) {
loadProgress(progress->ready, progress->total); loadProgress(progress->ready, progress->total);
} else if (const auto bytes = base::get_if<QByteArray>(&data)) { } else if (const auto bytes = std::get_if<QByteArray>(&data)) {
loadFinished(*bytes); loadFinished(*bytes);
} else { } else {
loadFailed(); loadFailed();

View File

@ -144,7 +144,7 @@ DocumentData *Document::readFromStreamHelper(
} }
} }
const auto storage = base::get_if<StorageFileLocation>( const auto storage = std::get_if<StorageFileLocation>(
&thumb->file().data); &thumb->file().data);
if ((stream.status() != QDataStream::Ok) if ((stream.status() != QDataStream::Ok)
|| (!dc && !access) || (!dc && !access)

View File

@ -69,7 +69,7 @@ bool UnpackBlob(
} }
QString StateDescription(const BlobState &state, tr::phrase<> activeText) { QString StateDescription(const BlobState &state, tr::phrase<> activeText) {
return state.match([](const Available &data) { return v::match(state, [](const Available &data) {
return tr::lng_emoji_set_download( return tr::lng_emoji_set_download(
tr::now, tr::now,
lt_size, lt_size,

View File

@ -65,7 +65,7 @@ struct Failed {
}; };
using Loading = MTP::DedicatedLoader::Progress; using Loading = MTP::DedicatedLoader::Progress;
using BlobState = base::variant< using BlobState = std::variant<
Available, Available,
Ready, Ready,
Active, Active,

View File

@ -621,7 +621,7 @@ InMemoryKey inMemoryKey(const InMemoryLocation &location) {
} }
InMemoryKey inMemoryKey(const DownloadLocation &location) { InMemoryKey inMemoryKey(const DownloadLocation &location) {
return location.data.match([](const auto &data) { return v::match(location.data, [](const auto &data) {
return inMemoryKey(data); return inMemoryKey(data);
}); });
} }
@ -681,8 +681,8 @@ std::optional<StorageImageLocation> StorageImageLocation::FromSerialized(
} }
QByteArray DownloadLocation::serialize() const { QByteArray DownloadLocation::serialize() const {
if (!valid() || data.is<StorageFileLocation>()) { if (!valid() || v::is<StorageFileLocation>(data)) {
return data.get_unchecked<StorageFileLocation>().serialize(); return std::get<StorageFileLocation>(data).serialize();
} }
auto result = QByteArray(); auto result = QByteArray();
auto buffer = QBuffer(&result); auto buffer = QBuffer(&result);
@ -691,7 +691,7 @@ QByteArray DownloadLocation::serialize() const {
stream.setVersion(QDataStream::Qt_5_1); stream.setVersion(QDataStream::Qt_5_1);
stream << quint16(0) << kNonStorageLocationToken; stream << quint16(0) << kNonStorageLocationToken;
data.match([&](const StorageFileLocation &data) { v::match(data, [&](const StorageFileLocation &data) {
Unexpected("Variant in DownloadLocation::serialize."); Unexpected("Variant in DownloadLocation::serialize.");
}, [&](const WebFileLocation &data) { }, [&](const WebFileLocation &data) {
stream stream
@ -718,11 +718,11 @@ QByteArray DownloadLocation::serialize() const {
} }
int DownloadLocation::serializeSize() const { int DownloadLocation::serializeSize() const {
if (!valid() || data.is<StorageFileLocation>()) { if (!valid() || v::is<StorageFileLocation>(data)) {
return data.get_unchecked<StorageFileLocation>().serializeSize(); return std::get<StorageFileLocation>(data).serializeSize();
} }
auto result = sizeof(quint16) + sizeof(quint8) + sizeof(quint8); auto result = sizeof(quint16) + sizeof(quint8) + sizeof(quint8);
data.match([&](const StorageFileLocation &data) { v::match(data, [&](const StorageFileLocation &data) {
Unexpected("Variant in DownloadLocation::serializeSize."); Unexpected("Variant in DownloadLocation::serializeSize.");
}, [&](const WebFileLocation &data) { }, [&](const WebFileLocation &data) {
result += Serialize::bytearraySize(data.url()) + sizeof(quint64); result += Serialize::bytearraySize(data.url()) + sizeof(quint64);
@ -809,15 +809,15 @@ DownloadLocation DownloadLocation::convertToModern(
StorageFileLocation::Type type, StorageFileLocation::Type type,
uint64 id, uint64 id,
uint64 accessHash) const { uint64 accessHash) const {
if (!data.is<StorageFileLocation>()) { if (!v::is<StorageFileLocation>(data)) {
return *this; return *this;
} }
auto &file = data.get_unchecked<StorageFileLocation>(); auto &file = std::get<StorageFileLocation>(data);
return DownloadLocation{ file.convertToModern(type, id, accessHash) }; return DownloadLocation{ file.convertToModern(type, id, accessHash) };
} }
Storage::Cache::Key DownloadLocation::cacheKey() const { Storage::Cache::Key DownloadLocation::cacheKey() const {
return data.match([](const GeoPointLocation &data) { return v::match(data, [](const GeoPointLocation &data) {
return Data::GeoPointCacheKey(data); return Data::GeoPointCacheKey(data);
}, [](const StorageFileLocation &data) { }, [](const StorageFileLocation &data) {
return data.valid() return data.valid()
@ -837,13 +837,13 @@ Storage::Cache::Key DownloadLocation::cacheKey() const {
} }
Storage::Cache::Key DownloadLocation::bigFileBaseCacheKey() const { Storage::Cache::Key DownloadLocation::bigFileBaseCacheKey() const {
return data.is<StorageFileLocation>() return v::is<StorageFileLocation>(data)
? data.get_unchecked<StorageFileLocation>().bigFileBaseCacheKey() ? std::get<StorageFileLocation>(data).bigFileBaseCacheKey()
: Storage::Cache::Key(); : Storage::Cache::Key();
} }
bool DownloadLocation::valid() const { bool DownloadLocation::valid() const {
return data.match([](const GeoPointLocation &data) { return v::match(data, [](const GeoPointLocation &data) {
return true; return true;
}, [](const StorageFileLocation &data) { }, [](const StorageFileLocation &data) {
return data.valid(); return data.valid();
@ -857,32 +857,32 @@ bool DownloadLocation::valid() const {
} }
bool DownloadLocation::isLegacy() const { bool DownloadLocation::isLegacy() const {
return data.is<StorageFileLocation>() return v::is<StorageFileLocation>(data)
? data.get_unchecked<StorageFileLocation>().isLegacy() ? std::get<StorageFileLocation>(data).isLegacy()
: false; : false;
} }
QByteArray DownloadLocation::fileReference() const { QByteArray DownloadLocation::fileReference() const {
if (!data.is<StorageFileLocation>()) { if (!v::is<StorageFileLocation>(data)) {
return QByteArray(); return QByteArray();
} }
return data.get_unchecked<StorageFileLocation>().fileReference(); return std::get<StorageFileLocation>(data).fileReference();
} }
bool DownloadLocation::refreshFileReference(const QByteArray &data) { bool DownloadLocation::refreshFileReference(const QByteArray &data) {
if (!this->data.is<StorageFileLocation>()) { if (!v::is<StorageFileLocation>(this->data)) {
return false; return false;
} }
auto &file = this->data.get_unchecked<StorageFileLocation>(); auto &file = std::get<StorageFileLocation>(this->data);
return file.refreshFileReference(data); return file.refreshFileReference(data);
} }
bool DownloadLocation::refreshFileReference( bool DownloadLocation::refreshFileReference(
const Data::UpdatedFileReferences &updates) { const Data::UpdatedFileReferences &updates) {
if (!data.is<StorageFileLocation>()) { if (!v::is<StorageFileLocation>(data)) {
return false; return false;
} }
auto &file = data.get_unchecked<StorageFileLocation>(); auto &file = std::get<StorageFileLocation>(data);
return file.refreshFileReference(updates); return file.refreshFileReference(updates);
} }

View File

@ -446,7 +446,7 @@ inline bool operator>=(
class DownloadLocation { class DownloadLocation {
public: public:
base::variant< std::variant<
StorageFileLocation, StorageFileLocation,
WebFileLocation, WebFileLocation,
GeoPointLocation, GeoPointLocation,

View File

@ -865,7 +865,7 @@ void UserpicButton::clearStreaming() {
void UserpicButton::handleStreamingUpdate(Media::Streaming::Update &&update) { void UserpicButton::handleStreamingUpdate(Media::Streaming::Update &&update) {
using namespace Media::Streaming; using namespace Media::Streaming;
update.data.match([&](Information &update) { v::match(update.data, [&](Information &update) {
streamingReady(std::move(update)); streamingReady(std::move(update));
}, [&](const PreloadedVideo &update) { }, [&](const PreloadedVideo &update) {
}, [&](const UpdateVideo &update) { }, [&](const UpdateVideo &update) {

View File

@ -248,7 +248,7 @@ void MediaPreviewWidget::setupLottie() {
_lottie->updates( _lottie->updates(
) | rpl::start_with_next([=](Lottie::Update update) { ) | rpl::start_with_next([=](Lottie::Update update) {
update.data.match([&](const Lottie::Information &) { v::match(update.data, [&](const Lottie::Information &) {
this->update(); this->update();
}, [&](const Lottie::DisplayFrameRequest &) { }, [&](const Lottie::DisplayFrameRequest &) {
this->update(updateArea()); this->update(updateArea());

@ -1 +1 @@
Subproject commit e94515700a622c2424f58d32e670581e9185f7e7 Subproject commit 0060349806529cd517201bec2d25208ad8d0bb89

@ -1 +1 @@
Subproject commit b666e438be285b2781d93ac64138ab32ab4a85e0 Subproject commit b060b25b45bf0100ae6d35f558eb0818380ebc13

@ -1 +1 @@
Subproject commit b58d2804acda906119c53c1fa1a2593fa9895878 Subproject commit e654c5ee98199b47a426aaaf6a1f7331aca0ebcd

@ -1 +1 @@
Subproject commit 538a72e5d3aedb660d3a399cc883067ada16e9cf Subproject commit 52b8d0456fec25f80ca96e6d354dd7583f7fa350