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
+4 -4
View File
@@ -1,9 +1,9 @@
#include "providers/bttv/BttvLiveUpdates.hpp"
#include <boost/optional.hpp>
#include <gtest/gtest.h>
#include <QString>
#include <optional>
#include <tuple>
using namespace chatterino;
@@ -18,9 +18,9 @@ TEST(BttvLiveUpdates, AllEvents)
chatterino::BttvLiveUpdates liveUpdates(host);
liveUpdates.start();
boost::optional<BttvLiveUpdateEmoteUpdateAddMessage> addMessage;
boost::optional<BttvLiveUpdateEmoteUpdateAddMessage> updateMessage;
boost::optional<BttvLiveUpdateEmoteRemoveMessage> removeMessage;
std::optional<BttvLiveUpdateEmoteUpdateAddMessage> addMessage;
std::optional<BttvLiveUpdateEmoteUpdateAddMessage> updateMessage;
std::optional<BttvLiveUpdateEmoteRemoveMessage> removeMessage;
std::ignore = liveUpdates.signals_.emoteAdded.connect([&](const auto &m) {
addMessage = m;
+13 -14
View File
@@ -11,7 +11,6 @@
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
#include <boost/optional/optional_io.hpp>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <QDebug>
@@ -268,7 +267,7 @@ TEST_F(HighlightControllerTest, LoggedInAndConfigured)
{
false, // alert
false, // playsound
boost::none, // custom sound url
std::nullopt, // custom sound url
std::make_shared<QColor>("#7fffffff"), // color
false,
},
@@ -307,7 +306,7 @@ TEST_F(HighlightControllerTest, LoggedInAndConfigured)
{
true, // alert
false, // playsound
boost::none, // custom sound url
std::nullopt, // custom sound url
std::make_shared<QColor>("#7fe8b7eb"), // color
false, //showInMentions
},
@@ -332,7 +331,7 @@ TEST_F(HighlightControllerTest, LoggedInAndConfigured)
{
true, // alert
false, // playsound
boost::none, // custom sound url
std::nullopt, // custom sound url
std::make_shared<QColor>("#7fffffff"), // color
false, //showInMentions
},
@@ -358,7 +357,7 @@ TEST_F(HighlightControllerTest, LoggedInAndConfigured)
{
false, // alert
false, // playsound
boost::none, // custom sound url
std::nullopt, // custom sound url
std::make_shared<QColor>("#7fe8b7ec"), // color
true, // showInMentions
},
@@ -379,7 +378,7 @@ TEST_F(HighlightControllerTest, LoggedInAndConfigured)
{
true, // alert
false, // playsound
boost::none, // custom sound url
std::nullopt, // custom sound url
std::make_shared<QColor>("#7ff19900"), // color
true, // showInMentions
},
@@ -399,7 +398,7 @@ TEST_F(HighlightControllerTest, LoggedInAndConfigured)
{
true, // alert
true, // playsound
boost::none, // custom sound url
std::nullopt, // custom sound url
std::make_shared<QColor>("#7f7f3f49"), // color
true, // showInMentions
},
@@ -420,7 +419,7 @@ TEST_F(HighlightControllerTest, LoggedInAndConfigured)
{
false, // alert
false, // playsound
boost::none, // custom sound url
std::nullopt, // custom sound url
std::make_shared<QColor>("#6fffffff"), // color
false,
},
@@ -442,9 +441,9 @@ TEST_F(HighlightControllerTest, LoggedInAndConfigured)
.state = true, // state
.result =
{
false, // alert
false, // playsound
boost::none, // custom sound url
false, // alert
false, // playsound
std::nullopt, // custom sound url
std::make_shared<QColor>(
HighlightPhrase::
FALLBACK_HIGHLIGHT_COLOR), // color
@@ -468,9 +467,9 @@ TEST_F(HighlightControllerTest, LoggedInAndConfigured)
.state = true, // state
.result =
{
true, // alert
true, // playsound
boost::none, // custom sound url
true, // alert
true, // playsound
std::nullopt, // custom sound url
std::make_shared<QColor>("#7f7f3f49"), // color
true, // showInMentions
},
-1
View File
@@ -13,7 +13,6 @@
#include "singletons/Settings.hpp"
#include "widgets/splits/InputCompletionPopup.hpp"
#include <boost/optional/optional_io.hpp>
#include <gtest/gtest.h>
#include <QDir>
#include <QFile>
+9 -8
View File
@@ -4,10 +4,11 @@
#include "providers/seventv/eventapi/Dispatch.hpp"
#include "providers/seventv/eventapi/Message.hpp"
#include <boost/optional.hpp>
#include <gtest/gtest.h>
#include <QString>
#include <optional>
using namespace chatterino;
using namespace chatterino::seventv::eventapi;
using namespace std::chrono_literals;
@@ -22,10 +23,10 @@ TEST(SeventvEventAPI, AllEvents)
SeventvEventAPI eventAPI(host, std::chrono::milliseconds(1000));
eventAPI.start();
boost::optional<EmoteAddDispatch> addDispatch;
boost::optional<EmoteUpdateDispatch> updateDispatch;
boost::optional<EmoteRemoveDispatch> removeDispatch;
boost::optional<UserConnectionUpdateDispatch> userDispatch;
std::optional<EmoteAddDispatch> addDispatch;
std::optional<EmoteUpdateDispatch> updateDispatch;
std::optional<EmoteRemoveDispatch> removeDispatch;
std::optional<UserConnectionUpdateDispatch> userDispatch;
eventAPI.signals_.emoteAdded.connect([&](const auto &d) {
addDispatch = d;
@@ -67,9 +68,9 @@ TEST(SeventvEventAPI, AllEvents)
ASSERT_EQ(rem.emoteID, QString("621d13967cc2d4e1953838ed"));
ASSERT_EQ(userDispatch.has_value(), false);
addDispatch = boost::none;
updateDispatch = boost::none;
removeDispatch = boost::none;
addDispatch = std::nullopt;
updateDispatch = std::nullopt;
removeDispatch = std::nullopt;
eventAPI.subscribeUser(TARGET_USER_ID, "");
std::this_thread::sleep_for(50ms);