Replace boost::optional with std::optional (#4877)

This commit is contained in:
pajlada
2023-10-08 18:50:48 +02:00
committed by GitHub
parent fe4d6121a2
commit fec45889a8
88 changed files with 428 additions and 383 deletions
+6 -5
View File
@@ -2,12 +2,13 @@
#include "providers/seventv/eventapi/Subscription.hpp"
#include <boost/optional.hpp>
#include <magic_enum.hpp>
#include <QJsonDocument>
#include <QJsonObject>
#include <QString>
#include <optional>
namespace chatterino::seventv::eventapi {
struct Message {
@@ -18,22 +19,22 @@ struct Message {
Message(QJsonObject _json);
template <class InnerClass>
boost::optional<InnerClass> toInner();
std::optional<InnerClass> toInner();
};
template <class InnerClass>
boost::optional<InnerClass> Message::toInner()
std::optional<InnerClass> Message::toInner()
{
return InnerClass{this->data};
}
static boost::optional<Message> parseBaseMessage(const QString &blob)
static std::optional<Message> parseBaseMessage(const QString &blob)
{
QJsonDocument jsonDoc(QJsonDocument::fromJson(blob.toUtf8()));
if (jsonDoc.isNull())
{
return boost::none;
return std::nullopt;
}
return Message(jsonDoc.object());