Remove boost::noncopyable use & boost::random dependency (#4776)

The use has been removed from the following files:
* Atomic.hpp
* SignalVector.hpp
* Benchmark.hpp
* IvrApi
* LoggingChannel.hpp
* Singleton.hpp
* Image.hpp
* PrecompiledHeader.hpp
* Message.hpp
* MessageElement.hpp
* MessageLayout.hpp
* MessageLayoutElement.hpp
* Fonts.hpp (just include)
This commit is contained in:
pajlada 2023-09-09 12:23:20 +02:00 committed by GitHub
parent ba440e0ccb
commit 877a4e05fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 92 additions and 35 deletions

View file

@ -23,7 +23,6 @@ Checks: "-*,
-performance-noexcept-move-constructor, -performance-noexcept-move-constructor,
-misc-non-private-member-variables-in-classes, -misc-non-private-member-variables-in-classes,
-cppcoreguidelines-non-private-member-variables-in-classes, -cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-special-member-functions,
-modernize-use-nodiscard, -modernize-use-nodiscard,
-modernize-use-trailing-return-type, -modernize-use-trailing-return-type,
-readability-identifier-length, -readability-identifier-length,

View file

@ -8,6 +8,7 @@
- Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767) - 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: 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: 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 ## 2.4.5

View file

@ -115,9 +115,7 @@ endif ()
find_package(Sanitizers QUIET) find_package(Sanitizers QUIET)
# Find boost on the system # Find boost on the system
# `OPTIONAL_COMPONENTS random` is required for vcpkg builds to link. find_package(Boost REQUIRED OPTIONAL_COMPONENTS headers)
# `OPTIONAL` is required, because conan doesn't set `boost_random_FOUND`.
find_package(Boost REQUIRED OPTIONAL_COMPONENTS random)
# Find OpenSSL on the system # Find OpenSSL on the system
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)

View file

@ -2,7 +2,6 @@
# include <boost/circular_buffer.hpp> # include <boost/circular_buffer.hpp>
# include <boost/current_function.hpp> # include <boost/current_function.hpp>
# include <boost/foreach.hpp> # include <boost/foreach.hpp>
# include <boost/noncopyable.hpp>
# include <boost/optional.hpp> # include <boost/optional.hpp>
# include <boost/signals2.hpp> # include <boost/signals2.hpp>
# include <IrcCommand> # include <IrcCommand>

View file

@ -1,24 +1,26 @@
#pragma once #pragma once
#include <boost/noncopyable.hpp>
#include <mutex> #include <mutex>
namespace chatterino { namespace chatterino {
template <typename T> template <typename T>
class Atomic : boost::noncopyable class Atomic
{ {
public: public:
Atomic() Atomic() = default;
{
}
Atomic(T &&val) Atomic(T &&val)
: value_(val) : value_(val)
{ {
} }
Atomic(const Atomic &) = delete;
Atomic &operator=(const Atomic &) = delete;
Atomic(Atomic &&) = delete;
Atomic &operator=(Atomic &&) = delete;
T get() const T get() const
{ {
std::lock_guard<std::mutex> guard(this->mutex_); std::lock_guard<std::mutex> guard(this->mutex_);

View file

@ -2,7 +2,6 @@
#include "debug/AssertInGuiThread.hpp" #include "debug/AssertInGuiThread.hpp"
#include <boost/noncopyable.hpp>
#include <pajlada/signals/signal.hpp> #include <pajlada/signals/signal.hpp>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QTimer> #include <QTimer>
@ -19,7 +18,7 @@ struct SignalVectorItemEvent {
}; };
template <typename T> template <typename T>
class SignalVector : boost::noncopyable class SignalVector
{ {
public: public:
pajlada::Signals::Signal<SignalVectorItemEvent<T>> itemInserted; pajlada::Signals::Signal<SignalVectorItemEvent<T>> itemInserted;
@ -42,6 +41,12 @@ public:
this->itemCompare_ = std::move(compare); this->itemCompare_ = std::move(compare);
} }
SignalVector(const SignalVector &) = delete;
SignalVector &operator=(const SignalVector &) = delete;
SignalVector(SignalVector &&) = delete;
SignalVector &operator=(SignalVector &&) = delete;
bool isSorted() const bool isSorted() const
{ {
return bool(this->itemCompare_); return bool(this->itemCompare_);

View file

@ -1,17 +1,22 @@
#pragma once #pragma once
#include <boost/noncopyable.hpp>
namespace chatterino { namespace chatterino {
class Settings; class Settings;
class Paths; class Paths;
class Singleton : boost::noncopyable class Singleton
{ {
public: public:
Singleton() = default;
virtual ~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) virtual void initialize(Settings &settings, Paths &paths)
{ {
(void)(settings); (void)(settings);

View file

@ -1,16 +1,22 @@
#pragma once #pragma once
#include <boost/noncopyable.hpp>
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QString> #include <QString>
namespace chatterino { namespace chatterino {
class BenchmarkGuard : boost::noncopyable class BenchmarkGuard
{ {
public: public:
BenchmarkGuard(const QString &_name); BenchmarkGuard(const QString &_name);
~BenchmarkGuard(); ~BenchmarkGuard();
BenchmarkGuard(const BenchmarkGuard &) = delete;
BenchmarkGuard &operator=(const BenchmarkGuard &) = delete;
BenchmarkGuard(BenchmarkGuard &&) = delete;
BenchmarkGuard &operator=(BenchmarkGuard &&) = delete;
qreal getElapsedMs(); qreal getElapsedMs();
private: private:

View file

@ -3,7 +3,6 @@
#include "common/Aliases.hpp" #include "common/Aliases.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <pajlada/signals/signal.hpp> #include <pajlada/signals/signal.hpp>
@ -26,13 +25,19 @@ namespace detail {
Image image; Image image;
int duration; int duration;
}; };
class Frames : boost::noncopyable class Frames
{ {
public: public:
Frames(); Frames();
Frames(QVector<Frame<QPixmap>> &&frames); Frames(QVector<Frame<QPixmap>> &&frames);
~Frames(); ~Frames();
Frames(const Frames &) = delete;
Frames &operator=(const Frames &) = delete;
Frames(Frames &&) = delete;
Frames &operator=(Frames &&) = delete;
void clear(); void clear();
bool empty() const; bool empty() const;
bool animated() const; bool animated() const;
@ -54,7 +59,7 @@ class Image;
using ImagePtr = std::shared_ptr<Image>; using ImagePtr = std::shared_ptr<Image>;
/// This class is thread safe. /// This class is thread safe.
class Image : public std::enable_shared_from_this<Image>, boost::noncopyable class Image : public std::enable_shared_from_this<Image>
{ {
public: public:
// Maximum amount of RAM used by the image in bytes. // Maximum amount of RAM used by the image in bytes.
@ -62,6 +67,12 @@ public:
~Image(); ~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 fromUrl(const Url &url, qreal scale = 1);
static ImagePtr fromResourcePixmap(const QPixmap &pixmap, qreal scale = 1); static ImagePtr fromResourcePixmap(const QPixmap &pixmap, qreal scale = 1);
static ImagePtr getEmpty(); static ImagePtr getEmpty();

View file

@ -3,7 +3,6 @@
#include "common/FlagsEnum.hpp" #include "common/FlagsEnum.hpp"
#include "util/QStringHash.hpp" #include "util/QStringHash.hpp"
#include <boost/noncopyable.hpp>
#include <QColor> #include <QColor>
#include <QTime> #include <QTime>
@ -54,10 +53,16 @@ enum class MessageFlag : int64_t {
}; };
using MessageFlags = FlagsEnum<MessageFlag>; using MessageFlags = FlagsEnum<MessageFlag>;
struct Message : boost::noncopyable { struct Message {
Message(); 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, // Making this a mutable means that we can update a messages flags,
// while still keeping Message constant. This means that a message's flag // 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. // can be updated without the renderer being made aware, which might be bad.

View file

@ -6,7 +6,6 @@
#include "messages/MessageColor.hpp" #include "messages/MessageColor.hpp"
#include "singletons/Fonts.hpp" #include "singletons/Fonts.hpp"
#include <boost/noncopyable.hpp>
#include <pajlada/signals/signalholder.hpp> #include <pajlada/signals/signalholder.hpp>
#include <QRect> #include <QRect>
#include <QString> #include <QString>
@ -158,7 +157,7 @@ enum class MessageElementFlag : int64_t {
}; };
using MessageElementFlags = FlagsEnum<MessageElementFlag>; using MessageElementFlags = FlagsEnum<MessageElementFlag>;
class MessageElement : boost::noncopyable class MessageElement
{ {
public: public:
enum UpdateFlags : char { enum UpdateFlags : char {
@ -173,6 +172,12 @@ public:
virtual ~MessageElement(); virtual ~MessageElement();
MessageElement(const MessageElement &) = delete;
MessageElement &operator=(const MessageElement &) = delete;
MessageElement(MessageElement &&) = delete;
MessageElement &operator=(MessageElement &&) = delete;
MessageElement *setLink(const Link &link); MessageElement *setLink(const Link &link);
MessageElement *setText(const QString &text); MessageElement *setText(const QString &text);
MessageElement *setTooltip(const QString &tooltip); MessageElement *setTooltip(const QString &tooltip);

View file

@ -4,7 +4,6 @@
#include "common/FlagsEnum.hpp" #include "common/FlagsEnum.hpp"
#include "messages/layouts/MessageLayoutContainer.hpp" #include "messages/layouts/MessageLayoutContainer.hpp"
#include <boost/noncopyable.hpp>
#include <QPixmap> #include <QPixmap>
#include <cinttypes> #include <cinttypes>
@ -33,12 +32,18 @@ enum class MessageLayoutFlag : uint8_t {
}; };
using MessageLayoutFlags = FlagsEnum<MessageLayoutFlag>; using MessageLayoutFlags = FlagsEnum<MessageLayoutFlag>;
class MessageLayout : boost::noncopyable class MessageLayout
{ {
public: public:
MessageLayout(MessagePtr message_); MessageLayout(MessagePtr message_);
~MessageLayout(); ~MessageLayout();
MessageLayout(const MessageLayout &) = delete;
MessageLayout &operator=(const MessageLayout &) = delete;
MessageLayout(MessageLayout &&) = delete;
MessageLayout &operator=(MessageLayout &&) = delete;
const Message *getMessage(); const Message *getMessage();
const MessagePtr &getMessagePtr() const; const MessagePtr &getMessagePtr() const;

View file

@ -3,7 +3,6 @@
#include "common/FlagsEnum.hpp" #include "common/FlagsEnum.hpp"
#include "messages/Link.hpp" #include "messages/Link.hpp"
#include <boost/noncopyable.hpp>
#include <pajlada/signals/signalholder.hpp> #include <pajlada/signals/signalholder.hpp>
#include <QPen> #include <QPen>
#include <QPoint> #include <QPoint>
@ -23,12 +22,18 @@ enum class FontStyle : uint8_t;
enum class MessageElementFlag : int64_t; enum class MessageElementFlag : int64_t;
struct MessageColors; struct MessageColors;
class MessageLayoutElement : boost::noncopyable class MessageLayoutElement
{ {
public: public:
MessageLayoutElement(MessageElement &creator_, const QSize &size); MessageLayoutElement(MessageElement &creator_, const QSize &size);
virtual ~MessageLayoutElement(); virtual ~MessageLayoutElement();
MessageLayoutElement(const MessageLayoutElement &) = delete;
MessageLayoutElement &operator=(const MessageLayoutElement &) = delete;
MessageLayoutElement(MessageLayoutElement &&) = delete;
MessageLayoutElement &operator=(MessageLayoutElement &&) = delete;
bool reversedNeutral = false; bool reversedNeutral = false;
const QRect &getRect() const; const QRect &getRect() const;

View file

@ -3,7 +3,6 @@
#include "common/NetworkRequest.hpp" #include "common/NetworkRequest.hpp"
#include "providers/twitch/TwitchEmotes.hpp" #include "providers/twitch/TwitchEmotes.hpp"
#include <boost/noncopyable.hpp>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonObject> #include <QJsonObject>
@ -74,7 +73,7 @@ struct IvrEmote {
} }
}; };
class IvrApi final : boost::noncopyable class IvrApi final
{ {
public: public:
// https://api.ivr.fi/v2/docs/static/index.html#/Twitch/get_twitch_subage__user___channel_ // https://api.ivr.fi/v2/docs/static/index.html#/Twitch/get_twitch_subage__user___channel_
@ -89,6 +88,14 @@ public:
static void initialize(); static void initialize();
IvrApi() = default;
IvrApi(const IvrApi &) = delete;
IvrApi &operator=(const IvrApi &) = delete;
IvrApi(IvrApi &&) = delete;
IvrApi &operator=(IvrApi &&) = delete;
private: private:
NetworkRequest makeRequest(QString url, QUrlQuery urlQuery); NetworkRequest makeRequest(QString url, QUrlQuery urlQuery);
}; };

View file

@ -3,7 +3,6 @@
#include "common/ChatterinoSetting.hpp" #include "common/ChatterinoSetting.hpp"
#include "common/Singleton.hpp" #include "common/Singleton.hpp"
#include <boost/noncopyable.hpp>
#include <pajlada/signals/signal.hpp> #include <pajlada/signals/signal.hpp>
#include <QFont> #include <QFont>
#include <QFontDatabase> #include <QFontDatabase>

View file

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <boost/noncopyable.hpp>
#include <QDateTime> #include <QDateTime>
#include <QFile> #include <QFile>
#include <QString> #include <QString>
@ -13,13 +12,20 @@ class Logging;
struct Message; struct Message;
using MessagePtr = std::shared_ptr<const Message>; using MessagePtr = std::shared_ptr<const Message>;
class LoggingChannel : boost::noncopyable class LoggingChannel
{ {
explicit LoggingChannel(const QString &_channelName, explicit LoggingChannel(const QString &_channelName,
const QString &platform); const QString &platform);
public: public:
~LoggingChannel(); ~LoggingChannel();
LoggingChannel(const LoggingChannel &) = delete;
LoggingChannel &operator=(const LoggingChannel &) = delete;
LoggingChannel(LoggingChannel &&) = delete;
LoggingChannel &operator=(LoggingChannel &&) = delete;
void addMessage(MessagePtr message); void addMessage(MessagePtr message);
private: private:

View file

@ -9,7 +9,6 @@
"boost-circular-buffer", "boost-circular-buffer",
"boost-foreach", "boost-foreach",
"boost-interprocess", "boost-interprocess",
"boost-random",
"boost-signals2", "boost-signals2",
"boost-variant", "boost-variant",
"gtest", "gtest",