Replace boost::optional with std::optional (#4877)
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user