mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Move to std::optional.
This commit is contained in:
@@ -32,7 +32,7 @@ bool File::empty() const {
|
||||
Result File::writeBlock(const QByteArray &block) {
|
||||
const auto result = writeBlockAttempt(block);
|
||||
if (!result) {
|
||||
_file.clear();
|
||||
_file.reset();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ private:
|
||||
|
||||
QString _path;
|
||||
int _offset = 0;
|
||||
base::optional<QFile> _file;
|
||||
std::optional<QFile> _file;
|
||||
|
||||
Stats *_stats = nullptr;
|
||||
bool _inStats = false;
|
||||
|
@@ -1058,7 +1058,7 @@ auto HtmlWriter::Wrap::pushMessage(
|
||||
}
|
||||
return "You have sent the following documents: "
|
||||
+ SerializeList(list);
|
||||
}, [](const base::none_type &) { return QByteArray(); });
|
||||
}, [](std::nullopt_t) { return QByteArray(); });
|
||||
|
||||
if (!serviceText.isEmpty()) {
|
||||
const auto &content = message.action.content;
|
||||
@@ -1658,7 +1658,7 @@ MediaData HtmlWriter::Wrap::prepareMediaData(
|
||||
result.status = Data::FormatMoneyAmount(data.amount, data.currency);
|
||||
}, [](const UnsupportedMedia &data) {
|
||||
Unexpected("Unsupported message.");
|
||||
}, [](const base::none_type &) {});
|
||||
}, [](std::nullopt_t) {});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2276,7 +2276,7 @@ Result HtmlWriter::writeDialogSlice(const Data::MessagesSlice &data) {
|
||||
? ((_messagesCount - 1) / kMessagesInFile)
|
||||
: 0;
|
||||
auto previous = _lastMessageInfo.get();
|
||||
auto saved = base::optional<MessageInfo>();
|
||||
auto saved = std::optional<MessageInfo>();
|
||||
auto block = QByteArray();
|
||||
for (const auto &message : data.list) {
|
||||
const auto newIndex = (_messagesCount / kMessagesInFile);
|
||||
@@ -2291,7 +2291,7 @@ Result HtmlWriter::writeDialogSlice(const Data::MessagesSlice &data) {
|
||||
block = QByteArray();
|
||||
_lastMessageInfo = nullptr;
|
||||
previous = nullptr;
|
||||
saved = base::none;
|
||||
saved = std::nullopt;
|
||||
oldIndex = newIndex;
|
||||
} else {
|
||||
return next;
|
||||
|
@@ -458,7 +458,7 @@ QByteArray SerializeMessage(
|
||||
}()));
|
||||
}
|
||||
pushBare("values", SerializeArray(context, list));
|
||||
}, [](const base::none_type &) {});
|
||||
}, [](std::nullopt_t) {});
|
||||
|
||||
if (!message.action.content) {
|
||||
pushFrom();
|
||||
@@ -572,7 +572,7 @@ QByteArray SerializeMessage(
|
||||
}));
|
||||
}, [](const UnsupportedMedia &data) {
|
||||
Unexpected("Unsupported message.");
|
||||
}, [](const base::none_type &) {});
|
||||
}, [](std::nullopt_t) {});
|
||||
|
||||
pushBare("text", SerializeText(context, message.text));
|
||||
|
||||
|
@@ -332,7 +332,7 @@ QByteArray SerializeMessage(
|
||||
} else if (!list.empty()) {
|
||||
push("Values", JoinList(", ", list));
|
||||
}
|
||||
}, [](const base::none_type &) {});
|
||||
}, [](std::nullopt_t) {});
|
||||
|
||||
if (!message.action.content) {
|
||||
pushFrom();
|
||||
@@ -435,7 +435,7 @@ QByteArray SerializeMessage(
|
||||
}));
|
||||
}, [](const UnsupportedMedia &data) {
|
||||
Unexpected("Unsupported message.");
|
||||
}, [](const base::none_type &) {});
|
||||
}, [](std::nullopt_t) {});
|
||||
|
||||
auto value = JoinList(QByteArray(), ranges::view::all(
|
||||
message.text
|
||||
|
Reference in New Issue
Block a user