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,
-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,

View file

@ -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

View file

@ -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)

View file

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

View file

@ -1,24 +1,26 @@
#pragma once
#include <boost/noncopyable.hpp>
#include <mutex>
namespace chatterino {
template <typename T>
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<std::mutex> guard(this->mutex_);

View file

@ -2,7 +2,6 @@
#include "debug/AssertInGuiThread.hpp"
#include <boost/noncopyable.hpp>
#include <pajlada/signals/signal.hpp>
#include <QStandardItemModel>
#include <QTimer>
@ -19,7 +18,7 @@ struct SignalVectorItemEvent {
};
template <typename T>
class SignalVector : boost::noncopyable
class SignalVector
{
public:
pajlada::Signals::Signal<SignalVectorItemEvent<T>> 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_);

View file

@ -1,17 +1,22 @@
#pragma once
#include <boost/noncopyable.hpp>
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);

View file

@ -1,16 +1,22 @@
#pragma once
#include <boost/noncopyable.hpp>
#include <QElapsedTimer>
#include <QString>
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:

View file

@ -3,7 +3,6 @@
#include "common/Aliases.hpp"
#include "common/Common.hpp"
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
#include <boost/variant.hpp>
#include <pajlada/signals/signal.hpp>
@ -26,13 +25,19 @@ namespace detail {
Image image;
int duration;
};
class Frames : boost::noncopyable
class Frames
{
public:
Frames();
Frames(QVector<Frame<QPixmap>> &&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<Image>;
/// 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:
// 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();

View file

@ -3,7 +3,6 @@
#include "common/FlagsEnum.hpp"
#include "util/QStringHash.hpp"
#include <boost/noncopyable.hpp>
#include <QColor>
#include <QTime>
@ -54,10 +53,16 @@ enum class MessageFlag : int64_t {
};
using MessageFlags = FlagsEnum<MessageFlag>;
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.

View file

@ -6,7 +6,6 @@
#include "messages/MessageColor.hpp"
#include "singletons/Fonts.hpp"
#include <boost/noncopyable.hpp>
#include <pajlada/signals/signalholder.hpp>
#include <QRect>
#include <QString>
@ -158,7 +157,7 @@ enum class MessageElementFlag : int64_t {
};
using MessageElementFlags = FlagsEnum<MessageElementFlag>;
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);

View file

@ -4,7 +4,6 @@
#include "common/FlagsEnum.hpp"
#include "messages/layouts/MessageLayoutContainer.hpp"
#include <boost/noncopyable.hpp>
#include <QPixmap>
#include <cinttypes>
@ -33,12 +32,18 @@ enum class MessageLayoutFlag : uint8_t {
};
using MessageLayoutFlags = FlagsEnum<MessageLayoutFlag>;
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;

View file

@ -3,7 +3,6 @@
#include "common/FlagsEnum.hpp"
#include "messages/Link.hpp"
#include <boost/noncopyable.hpp>
#include <pajlada/signals/signalholder.hpp>
#include <QPen>
#include <QPoint>
@ -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;

View file

@ -3,7 +3,6 @@
#include "common/NetworkRequest.hpp"
#include "providers/twitch/TwitchEmotes.hpp"
#include <boost/noncopyable.hpp>
#include <QJsonArray>
#include <QJsonObject>
@ -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);
};

View file

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

View file

@ -1,6 +1,5 @@
#pragma once
#include <boost/noncopyable.hpp>
#include <QDateTime>
#include <QFile>
#include <QString>
@ -13,13 +12,20 @@ class Logging;
struct Message;
using MessagePtr = std::shared_ptr<const Message>;
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:

View file

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