diff --git a/.clang-tidy b/.clang-tidy index 4fe0bb846..5d3a0d09e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -23,7 +23,6 @@ Checks: "-*, -performance-noexcept-move-constructor, -misc-non-private-member-variables-in-classes, -cppcoreguidelines-non-private-member-variables-in-classes, - -cppcoreguidelines-special-member-functions, -modernize-use-nodiscard, -modernize-use-trailing-return-type, -readability-identifier-length, diff --git a/CHANGELOG.md b/CHANGELOG.md index 200326e17..be8d0ff38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767) - Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774) - Dev: Do a pretty major refactor of the Settings classes. List settings (e.g. highlights) are most heavily modified, and should have an extra eye kept on them. (#4775) +- Dev: Remove `boost::noncopyable` use & `boost_random` dependency. (#4776) ## 2.4.5 diff --git a/CMakeLists.txt b/CMakeLists.txt index caa3990b4..40f1144f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,9 +115,7 @@ endif () find_package(Sanitizers QUIET) # Find boost on the system -# `OPTIONAL_COMPONENTS random` is required for vcpkg builds to link. -# `OPTIONAL` is required, because conan doesn't set `boost_random_FOUND`. -find_package(Boost REQUIRED OPTIONAL_COMPONENTS random) +find_package(Boost REQUIRED OPTIONAL_COMPONENTS headers) # Find OpenSSL on the system find_package(OpenSSL REQUIRED) diff --git a/src/PrecompiledHeader.hpp b/src/PrecompiledHeader.hpp index a774d57d8..f430a099c 100644 --- a/src/PrecompiledHeader.hpp +++ b/src/PrecompiledHeader.hpp @@ -2,7 +2,6 @@ # include # include # include -# include # include # include # include diff --git a/src/common/Atomic.hpp b/src/common/Atomic.hpp index 4ea3e8ae3..30943e239 100644 --- a/src/common/Atomic.hpp +++ b/src/common/Atomic.hpp @@ -1,24 +1,26 @@ #pragma once -#include - #include namespace chatterino { template -class Atomic : boost::noncopyable +class Atomic { public: - Atomic() - { - } + Atomic() = default; Atomic(T &&val) : value_(val) { } + Atomic(const Atomic &) = delete; + Atomic &operator=(const Atomic &) = delete; + + Atomic(Atomic &&) = delete; + Atomic &operator=(Atomic &&) = delete; + T get() const { std::lock_guard guard(this->mutex_); diff --git a/src/common/SignalVector.hpp b/src/common/SignalVector.hpp index 3de5be899..e0f2a4e6f 100644 --- a/src/common/SignalVector.hpp +++ b/src/common/SignalVector.hpp @@ -2,7 +2,6 @@ #include "debug/AssertInGuiThread.hpp" -#include #include #include #include @@ -19,7 +18,7 @@ struct SignalVectorItemEvent { }; template -class SignalVector : boost::noncopyable +class SignalVector { public: pajlada::Signals::Signal> itemInserted; @@ -42,6 +41,12 @@ public: this->itemCompare_ = std::move(compare); } + SignalVector(const SignalVector &) = delete; + SignalVector &operator=(const SignalVector &) = delete; + + SignalVector(SignalVector &&) = delete; + SignalVector &operator=(SignalVector &&) = delete; + bool isSorted() const { return bool(this->itemCompare_); diff --git a/src/common/Singleton.hpp b/src/common/Singleton.hpp index 401716d78..2e47dec3f 100644 --- a/src/common/Singleton.hpp +++ b/src/common/Singleton.hpp @@ -1,17 +1,22 @@ #pragma once -#include - namespace chatterino { class Settings; class Paths; -class Singleton : boost::noncopyable +class Singleton { public: + Singleton() = default; virtual ~Singleton() = default; + Singleton(const Singleton &) = delete; + Singleton &operator=(const Singleton &) = delete; + + Singleton(Singleton &&) = delete; + Singleton &operator=(Singleton &&) = delete; + virtual void initialize(Settings &settings, Paths &paths) { (void)(settings); diff --git a/src/debug/Benchmark.hpp b/src/debug/Benchmark.hpp index 4b0d4767f..e9b058ba7 100644 --- a/src/debug/Benchmark.hpp +++ b/src/debug/Benchmark.hpp @@ -1,16 +1,22 @@ #pragma once -#include #include #include namespace chatterino { -class BenchmarkGuard : boost::noncopyable +class BenchmarkGuard { public: BenchmarkGuard(const QString &_name); ~BenchmarkGuard(); + + BenchmarkGuard(const BenchmarkGuard &) = delete; + BenchmarkGuard &operator=(const BenchmarkGuard &) = delete; + + BenchmarkGuard(BenchmarkGuard &&) = delete; + BenchmarkGuard &operator=(BenchmarkGuard &&) = delete; + qreal getElapsedMs(); private: diff --git a/src/messages/Image.hpp b/src/messages/Image.hpp index 98c964eac..24091e447 100644 --- a/src/messages/Image.hpp +++ b/src/messages/Image.hpp @@ -3,7 +3,6 @@ #include "common/Aliases.hpp" #include "common/Common.hpp" -#include #include #include #include @@ -26,13 +25,19 @@ namespace detail { Image image; int duration; }; - class Frames : boost::noncopyable + class Frames { public: Frames(); Frames(QVector> &&frames); ~Frames(); + Frames(const Frames &) = delete; + Frames &operator=(const Frames &) = delete; + + Frames(Frames &&) = delete; + Frames &operator=(Frames &&) = delete; + void clear(); bool empty() const; bool animated() const; @@ -54,7 +59,7 @@ class Image; using ImagePtr = std::shared_ptr; /// This class is thread safe. -class Image : public std::enable_shared_from_this, boost::noncopyable +class Image : public std::enable_shared_from_this { public: // Maximum amount of RAM used by the image in bytes. @@ -62,6 +67,12 @@ public: ~Image(); + Image(const Image &) = delete; + Image &operator=(const Image &) = delete; + + Image(Image &&) = delete; + Image &operator=(Image &&) = delete; + static ImagePtr fromUrl(const Url &url, qreal scale = 1); static ImagePtr fromResourcePixmap(const QPixmap &pixmap, qreal scale = 1); static ImagePtr getEmpty(); diff --git a/src/messages/Message.hpp b/src/messages/Message.hpp index 83e311b1c..b248c93a1 100644 --- a/src/messages/Message.hpp +++ b/src/messages/Message.hpp @@ -3,7 +3,6 @@ #include "common/FlagsEnum.hpp" #include "util/QStringHash.hpp" -#include #include #include @@ -54,10 +53,16 @@ enum class MessageFlag : int64_t { }; using MessageFlags = FlagsEnum; -struct Message : boost::noncopyable { +struct Message { Message(); ~Message(); + Message(const Message &) = delete; + Message &operator=(const Message &) = delete; + + Message(Message &&) = delete; + Message &operator=(Message &&) = delete; + // Making this a mutable means that we can update a messages flags, // while still keeping Message constant. This means that a message's flag // can be updated without the renderer being made aware, which might be bad. diff --git a/src/messages/MessageElement.hpp b/src/messages/MessageElement.hpp index ddff4bf7a..175537bf1 100644 --- a/src/messages/MessageElement.hpp +++ b/src/messages/MessageElement.hpp @@ -6,7 +6,6 @@ #include "messages/MessageColor.hpp" #include "singletons/Fonts.hpp" -#include #include #include #include @@ -158,7 +157,7 @@ enum class MessageElementFlag : int64_t { }; using MessageElementFlags = FlagsEnum; -class MessageElement : boost::noncopyable +class MessageElement { public: enum UpdateFlags : char { @@ -173,6 +172,12 @@ public: virtual ~MessageElement(); + MessageElement(const MessageElement &) = delete; + MessageElement &operator=(const MessageElement &) = delete; + + MessageElement(MessageElement &&) = delete; + MessageElement &operator=(MessageElement &&) = delete; + MessageElement *setLink(const Link &link); MessageElement *setText(const QString &text); MessageElement *setTooltip(const QString &tooltip); diff --git a/src/messages/layouts/MessageLayout.hpp b/src/messages/layouts/MessageLayout.hpp index 81d7e4035..b5d47ba15 100644 --- a/src/messages/layouts/MessageLayout.hpp +++ b/src/messages/layouts/MessageLayout.hpp @@ -4,7 +4,6 @@ #include "common/FlagsEnum.hpp" #include "messages/layouts/MessageLayoutContainer.hpp" -#include #include #include @@ -33,12 +32,18 @@ enum class MessageLayoutFlag : uint8_t { }; using MessageLayoutFlags = FlagsEnum; -class MessageLayout : boost::noncopyable +class MessageLayout { public: MessageLayout(MessagePtr message_); ~MessageLayout(); + MessageLayout(const MessageLayout &) = delete; + MessageLayout &operator=(const MessageLayout &) = delete; + + MessageLayout(MessageLayout &&) = delete; + MessageLayout &operator=(MessageLayout &&) = delete; + const Message *getMessage(); const MessagePtr &getMessagePtr() const; diff --git a/src/messages/layouts/MessageLayoutElement.hpp b/src/messages/layouts/MessageLayoutElement.hpp index 2a4ec030e..1cdc16edc 100644 --- a/src/messages/layouts/MessageLayoutElement.hpp +++ b/src/messages/layouts/MessageLayoutElement.hpp @@ -3,7 +3,6 @@ #include "common/FlagsEnum.hpp" #include "messages/Link.hpp" -#include #include #include #include @@ -23,12 +22,18 @@ enum class FontStyle : uint8_t; enum class MessageElementFlag : int64_t; struct MessageColors; -class MessageLayoutElement : boost::noncopyable +class MessageLayoutElement { public: MessageLayoutElement(MessageElement &creator_, const QSize &size); virtual ~MessageLayoutElement(); + MessageLayoutElement(const MessageLayoutElement &) = delete; + MessageLayoutElement &operator=(const MessageLayoutElement &) = delete; + + MessageLayoutElement(MessageLayoutElement &&) = delete; + MessageLayoutElement &operator=(MessageLayoutElement &&) = delete; + bool reversedNeutral = false; const QRect &getRect() const; diff --git a/src/providers/IvrApi.hpp b/src/providers/IvrApi.hpp index 9aca14543..b20be5ba8 100644 --- a/src/providers/IvrApi.hpp +++ b/src/providers/IvrApi.hpp @@ -3,7 +3,6 @@ #include "common/NetworkRequest.hpp" #include "providers/twitch/TwitchEmotes.hpp" -#include #include #include @@ -74,7 +73,7 @@ struct IvrEmote { } }; -class IvrApi final : boost::noncopyable +class IvrApi final { public: // https://api.ivr.fi/v2/docs/static/index.html#/Twitch/get_twitch_subage__user___channel_ @@ -89,6 +88,14 @@ public: static void initialize(); + IvrApi() = default; + + IvrApi(const IvrApi &) = delete; + IvrApi &operator=(const IvrApi &) = delete; + + IvrApi(IvrApi &&) = delete; + IvrApi &operator=(IvrApi &&) = delete; + private: NetworkRequest makeRequest(QString url, QUrlQuery urlQuery); }; diff --git a/src/singletons/Fonts.hpp b/src/singletons/Fonts.hpp index a34635000..40932d20f 100644 --- a/src/singletons/Fonts.hpp +++ b/src/singletons/Fonts.hpp @@ -3,7 +3,6 @@ #include "common/ChatterinoSetting.hpp" #include "common/Singleton.hpp" -#include #include #include #include diff --git a/src/singletons/helper/LoggingChannel.hpp b/src/singletons/helper/LoggingChannel.hpp index 9970baaef..753a63b91 100644 --- a/src/singletons/helper/LoggingChannel.hpp +++ b/src/singletons/helper/LoggingChannel.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include #include @@ -13,13 +12,20 @@ class Logging; struct Message; using MessagePtr = std::shared_ptr; -class LoggingChannel : boost::noncopyable +class LoggingChannel { explicit LoggingChannel(const QString &_channelName, const QString &platform); public: ~LoggingChannel(); + + LoggingChannel(const LoggingChannel &) = delete; + LoggingChannel &operator=(const LoggingChannel &) = delete; + + LoggingChannel(LoggingChannel &&) = delete; + LoggingChannel &operator=(LoggingChannel &&) = delete; + void addMessage(MessagePtr message); private: diff --git a/vcpkg.json b/vcpkg.json index b6a60506a..99aa00b38 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -9,7 +9,6 @@ "boost-circular-buffer", "boost-foreach", "boost-interprocess", - "boost-random", "boost-signals2", "boost-variant", "gtest",