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
+2 -2
View File
@@ -312,9 +312,9 @@ void NativeMessagingServer::syncChannels(const QJsonArray &twitchChannels)
this->channelWarmer_ = std::move(updated);
}
Atomic<boost::optional<QString>> &nmIpcError()
Atomic<std::optional<QString>> &nmIpcError()
{
static Atomic<boost::optional<QString>> x;
static Atomic<std::optional<QString>> x;
return x;
}
+2 -2
View File
@@ -2,10 +2,10 @@
#include "common/Atomic.hpp"
#include <boost/optional.hpp>
#include <QString>
#include <QThread>
#include <optional>
#include <vector>
namespace chatterino {
@@ -19,7 +19,7 @@ using ChannelPtr = std::shared_ptr<Channel>;
void registerNmHost(Paths &paths);
std::string &getNmQueueName(Paths &paths);
Atomic<boost::optional<QString>> &nmIpcError();
Atomic<std::optional<QString>> &nmIpcError();
namespace nm::client {
+1 -1
View File
@@ -83,7 +83,7 @@ void Paths::initCheckPortable()
void Paths::initRootDirectory()
{
assert(this->portable_.is_initialized());
assert(this->portable_.has_value());
// Root path = %APPDATA%/Chatterino or the folder that the executable
// resides in
+3 -2
View File
@@ -1,8 +1,9 @@
#pragma once
#include <boost/optional.hpp>
#include <QString>
#include <optional>
namespace chatterino {
class Paths
@@ -51,7 +52,7 @@ private:
void initRootDirectory();
void initSubDirectories();
boost::optional<bool> portable_;
std::optional<bool> portable_;
// Directory for cache files. Same as <appDataDirectory>/Misc
QString cacheDirectory_;
+2 -2
View File
@@ -87,7 +87,7 @@ bool Settings::isMutedChannel(const QString &channelName)
return false;
}
boost::optional<QString> Settings::matchNickname(const QString &usernameText)
std::optional<QString> Settings::matchNickname(const QString &usernameText)
{
auto nicknames = this->nicknames.readOnly();
@@ -99,7 +99,7 @@ boost::optional<QString> Settings::matchNickname(const QString &usernameText)
}
}
return boost::none;
return std::nullopt;
}
void Settings::mute(const QString &channelName)
+1 -1
View File
@@ -593,7 +593,7 @@ public:
bool isBlacklistedUser(const QString &username);
bool isMutedChannel(const QString &channelName);
bool toggleMutedChannel(const QString &channelName);
boost::optional<QString> matchNickname(const QString &username);
std::optional<QString> matchNickname(const QString &username);
private:
void mute(const QString &channelName);
+3 -3
View File
@@ -24,7 +24,6 @@
#include "widgets/splits/SplitContainer.hpp"
#include "widgets/Window.hpp"
#include <boost/optional.hpp>
#include <QDebug>
#include <QJsonArray>
#include <QJsonDocument>
@@ -34,13 +33,14 @@
#include <QScreen>
#include <chrono>
#include <optional>
namespace chatterino {
namespace {
boost::optional<bool> &shouldMoveOutOfBoundsWindow()
std::optional<bool> &shouldMoveOutOfBoundsWindow()
{
static boost::optional<bool> x;
static std::optional<bool> x;
return x;
}