mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-28 22:01:59 +00:00
Make all single-argument constructors explicit
This commit is contained in:
parent
9ab4e4d70c
commit
7b01acdb81
@ -16,7 +16,7 @@ class BinarySpanReader
|
||||
{
|
||||
public:
|
||||
BinarySpanReader();
|
||||
BinarySpanReader(std::span<const u8> buf);
|
||||
explicit BinarySpanReader(std::span<const u8> buf);
|
||||
|
||||
BinarySpanReader(const BinarySpanReader&) = delete;
|
||||
BinarySpanReader& operator=(const BinarySpanReader&) = delete;
|
||||
@ -146,7 +146,7 @@ class BinarySpanWriter
|
||||
{
|
||||
public:
|
||||
BinarySpanWriter();
|
||||
BinarySpanWriter(std::span<u8> buf);
|
||||
explicit BinarySpanWriter(std::span<u8> buf);
|
||||
|
||||
BinarySpanWriter(const BinarySpanWriter&) = delete;
|
||||
BinarySpanWriter& operator=(const BinarySpanWriter&) = delete;
|
||||
@ -217,8 +217,8 @@ class BinaryFileReader
|
||||
{
|
||||
public:
|
||||
BinaryFileReader();
|
||||
BinaryFileReader(std::FILE* fp);
|
||||
|
||||
explicit BinaryFileReader(std::FILE* fp);
|
||||
|
||||
BinaryFileReader(const BinaryFileReader&) = delete;
|
||||
BinaryFileReader& operator=(const BinaryFileReader&) = delete;
|
||||
|
||||
@ -308,8 +308,8 @@ class BinaryFileWriter
|
||||
{
|
||||
public:
|
||||
BinaryFileWriter();
|
||||
BinaryFileWriter(std::FILE* fp);
|
||||
|
||||
explicit BinaryFileWriter(std::FILE* fp);
|
||||
|
||||
BinaryFileWriter(const BinaryFileWriter&) = delete;
|
||||
BinaryFileWriter& operator=(const BinaryFileWriter&) = delete;
|
||||
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
DynamicLibrary();
|
||||
|
||||
/// Automatically loads the specified library. Call IsOpen() to check validity before use.
|
||||
DynamicLibrary(const char* filename);
|
||||
explicit DynamicLibrary(const char* filename);
|
||||
|
||||
/// Move constructor, transfers ownership.
|
||||
DynamicLibrary(DynamicLibrary&& move);
|
||||
|
@ -165,8 +165,8 @@ class POSIXLock
|
||||
{
|
||||
public:
|
||||
POSIXLock();
|
||||
POSIXLock(int fd, bool block = true, Error* error = nullptr);
|
||||
POSIXLock(std::FILE* fp, bool block = true, Error* error = nullptr);
|
||||
explicit POSIXLock(int fd, bool block = true, Error* error = nullptr);
|
||||
explicit POSIXLock(std::FILE* fp, bool block = true, Error* error = nullptr);
|
||||
POSIXLock(POSIXLock&& move);
|
||||
POSIXLock(const POSIXLock&) = delete;
|
||||
~POSIXLock();
|
||||
|
@ -167,7 +167,7 @@ public:
|
||||
using this_type = DynamicHeapArray<T, alignment>;
|
||||
|
||||
DynamicHeapArray() : m_data(nullptr), m_size(0) {}
|
||||
DynamicHeapArray(size_t size) { internal_resize(size, nullptr, 0); }
|
||||
explicit DynamicHeapArray(size_t size) { internal_resize(size, nullptr, 0); }
|
||||
DynamicHeapArray(const T* begin, const T* end)
|
||||
{
|
||||
const size_t size = reinterpret_cast<const char*>(end) - reinterpret_cast<const char*>(begin);
|
||||
@ -195,7 +195,7 @@ public:
|
||||
m_size = 0;
|
||||
}
|
||||
}
|
||||
DynamicHeapArray(const std::span<const T> data)
|
||||
explicit DynamicHeapArray(const std::span<const T> data)
|
||||
{
|
||||
if (!data.empty())
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
class PerfScope
|
||||
{
|
||||
public:
|
||||
constexpr PerfScope(const char* prefix) : m_prefix(prefix) {}
|
||||
constexpr explicit PerfScope(const char* prefix) : m_prefix(prefix) {}
|
||||
bool HasPrefix() const { return (m_prefix && m_prefix[0]); }
|
||||
|
||||
void Register(const void* ptr, size_t size, const char* symbol);
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
static const Controller::ControllerInfo INFO;
|
||||
|
||||
AnalogController(u32 index);
|
||||
explicit AnalogController(u32 index);
|
||||
~AnalogController() override;
|
||||
|
||||
static std::unique_ptr<AnalogController> Create(u32 index);
|
||||
|
@ -32,7 +32,7 @@ namespace {
|
||||
class CheatFileReader
|
||||
{
|
||||
public:
|
||||
CheatFileReader(const std::string_view contents) : m_contents(contents) {}
|
||||
explicit CheatFileReader(const std::string_view contents) : m_contents(contents) {}
|
||||
|
||||
ALWAYS_INLINE size_t GetCurrentOffset() const { return m_current_offset; }
|
||||
ALWAYS_INLINE size_t GetCurrentLineOffset() const { return m_current_line_offset; }
|
||||
@ -178,7 +178,7 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
CheatCode(Metadata metadata);
|
||||
explicit CheatCode(Metadata metadata);
|
||||
virtual ~CheatCode();
|
||||
|
||||
ALWAYS_INLINE const Metadata& GetMetadata() const { return m_metadata; }
|
||||
@ -2034,7 +2034,7 @@ namespace {
|
||||
class GamesharkCheatCode final : public CheatCode
|
||||
{
|
||||
public:
|
||||
GamesharkCheatCode(Metadata metadata);
|
||||
explicit GamesharkCheatCode(Metadata metadata);
|
||||
~GamesharkCheatCode() override;
|
||||
|
||||
static std::unique_ptr<GamesharkCheatCode> Parse(Metadata metadata, const std::string_view data, Error* error);
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
static constexpr float DEFAULT_STICK_SENSITIVITY = 1.33f;
|
||||
static constexpr float DEFAULT_BUTTON_DEADZONE = 0.25f;
|
||||
|
||||
Controller(u32 index);
|
||||
explicit Controller(u32 index);
|
||||
virtual ~Controller();
|
||||
|
||||
/// Returns the type of controller.
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
|
||||
static const Controller::ControllerInfo INFO;
|
||||
|
||||
DDGoController(u32 index);
|
||||
explicit DDGoController(u32 index);
|
||||
~DDGoController() override;
|
||||
|
||||
static std::unique_ptr<DDGoController> Create(u32 index);
|
||||
|
@ -84,7 +84,7 @@ void SetStandardSelectionFooterText(bool back_instead_of_cancel);
|
||||
class BackgroundProgressCallback final : public ProgressCallback
|
||||
{
|
||||
public:
|
||||
BackgroundProgressCallback(std::string name);
|
||||
explicit BackgroundProgressCallback(std::string name);
|
||||
~BackgroundProgressCallback() override;
|
||||
|
||||
void SetStatusText(const std::string_view text) override;
|
||||
|
@ -17,7 +17,7 @@
|
||||
class GPU_SW final : public GPUBackend
|
||||
{
|
||||
public:
|
||||
GPU_SW(GPUPresenter& presenter);
|
||||
explicit GPU_SW(GPUPresenter& presenter);
|
||||
~GPU_SW() override;
|
||||
|
||||
bool Initialize(bool upload_vram, Error* error) override;
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
|
||||
static const Controller::ControllerInfo INFO;
|
||||
|
||||
GunCon(u32 index);
|
||||
explicit GunCon(u32 index);
|
||||
~GunCon() override;
|
||||
|
||||
static std::unique_ptr<GunCon> Create(u32 index);
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
|
||||
static const Controller::ControllerInfo INFO;
|
||||
|
||||
JogCon(u32 index);
|
||||
explicit JogCon(u32 index);
|
||||
~JogCon() override;
|
||||
|
||||
static std::unique_ptr<JogCon> Create(u32 index);
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
|
||||
static const Controller::ControllerInfo INFO;
|
||||
|
||||
NeGcon(u32 index);
|
||||
explicit NeGcon(u32 index);
|
||||
~NeGcon() override;
|
||||
|
||||
static std::unique_ptr<NeGcon> Create(u32 index);
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
|
||||
static const Controller::ControllerInfo INFO;
|
||||
|
||||
NeGconRumble(u32 index);
|
||||
explicit NeGconRumble(u32 index);
|
||||
~NeGconRumble() override;
|
||||
|
||||
static std::unique_ptr<NeGconRumble> Create(u32 index);
|
||||
@ -148,4 +148,4 @@ private:
|
||||
|
||||
float m_steering_deadzone = 0.00f;
|
||||
float m_steering_sensitivity = 1.00f;
|
||||
};
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
|
||||
static const Controller::ControllerInfo INFO;
|
||||
|
||||
PlayStationMouse(u32 index);
|
||||
explicit PlayStationMouse(u32 index);
|
||||
~PlayStationMouse() override;
|
||||
|
||||
static std::unique_ptr<PlayStationMouse> Create(u32 index);
|
||||
|
@ -78,7 +78,7 @@ class ControllerMacroWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ControllerMacroWidget(ControllerBindingWidget* parent);
|
||||
explicit ControllerMacroWidget(ControllerBindingWidget* parent);
|
||||
~ControllerMacroWidget();
|
||||
|
||||
void updateListItem(u32 index);
|
||||
@ -133,7 +133,7 @@ class ControllerCustomSettingsWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ControllerCustomSettingsWidget(ControllerBindingWidget* parent);
|
||||
explicit ControllerCustomSettingsWidget(ControllerBindingWidget* parent);
|
||||
~ControllerCustomSettingsWidget();
|
||||
|
||||
void createSettingWidgets(ControllerBindingWidget* parent, QWidget* parent_widget, QGridLayout* layout,
|
||||
|
@ -20,7 +20,7 @@ class DebuggerCodeModel final : public QAbstractTableModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerCodeModel(QObject* parent = nullptr);
|
||||
explicit DebuggerCodeModel(QObject* parent = nullptr);
|
||||
~DebuggerCodeModel() override;
|
||||
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
@ -61,7 +61,7 @@ class DebuggerRegistersModel final : public QAbstractListModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerRegistersModel(QObject* parent = nullptr);
|
||||
explicit DebuggerRegistersModel(QObject* parent = nullptr);
|
||||
~DebuggerRegistersModel() override;
|
||||
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
@ -82,7 +82,7 @@ class DebuggerStackModel final : public QAbstractListModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerStackModel(QObject* parent = nullptr);
|
||||
explicit DebuggerStackModel(QObject* parent = nullptr);
|
||||
~DebuggerStackModel() override;
|
||||
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
@ -98,7 +98,7 @@ class DebuggerAddBreakpointDialog final : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerAddBreakpointDialog(QWidget* parent = nullptr);
|
||||
explicit DebuggerAddBreakpointDialog(QWidget* parent = nullptr);
|
||||
~DebuggerAddBreakpointDialog() override;
|
||||
|
||||
u32 getAddress() const { return m_address; }
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QSemaphore>
|
||||
#include <QtCore/QThread>
|
||||
|
||||
#include "common/progress_callback.h"
|
||||
@ -14,7 +13,7 @@ class GameListRefreshThread;
|
||||
class AsyncRefreshProgressCallback : public ProgressCallback
|
||||
{
|
||||
public:
|
||||
AsyncRefreshProgressCallback(GameListRefreshThread* parent);
|
||||
explicit AsyncRefreshProgressCallback(GameListRefreshThread* parent);
|
||||
|
||||
float timeSinceStart() const;
|
||||
|
||||
@ -46,7 +45,7 @@ class GameListRefreshThread final : public QThread
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GameListRefreshThread(bool invalidate_cache);
|
||||
explicit GameListRefreshThread(bool invalidate_cache);
|
||||
~GameListRefreshThread();
|
||||
|
||||
float timeSinceStart() const;
|
||||
@ -58,7 +57,7 @@ Q_SIGNALS:
|
||||
void refreshComplete();
|
||||
|
||||
protected:
|
||||
void run();
|
||||
void run() final;
|
||||
|
||||
private:
|
||||
AsyncRefreshProgressCallback m_progress;
|
||||
|
@ -1037,7 +1037,7 @@ namespace {
|
||||
class GameListCenterIconStyleDelegate final : public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
GameListCenterIconStyleDelegate(QWidget* parent) : QStyledItemDelegate(parent) {}
|
||||
explicit GameListCenterIconStyleDelegate(QWidget* parent) : QStyledItemDelegate(parent) {}
|
||||
~GameListCenterIconStyleDelegate() = default;
|
||||
|
||||
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override
|
||||
|
@ -210,7 +210,7 @@ class GameListWidget final : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GameListWidget(QWidget* parent = nullptr);
|
||||
explicit GameListWidget(QWidget* parent = nullptr);
|
||||
~GameListWidget();
|
||||
|
||||
ALWAYS_INLINE GameListModel* getModel() const { return m_model; }
|
||||
|
@ -17,7 +17,7 @@ class InputBindingWidget : public QPushButton
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InputBindingWidget(QWidget* parent);
|
||||
explicit InputBindingWidget(QWidget* parent);
|
||||
InputBindingWidget(QWidget* parent, SettingsInterface* sif, InputBindingInfo::Type bind_type,
|
||||
std::string section_name, std::string key_name);
|
||||
~InputBindingWidget();
|
||||
@ -76,7 +76,7 @@ class InputVibrationBindingWidget : public QPushButton
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InputVibrationBindingWidget(QWidget* parent);
|
||||
explicit InputVibrationBindingWidget(QWidget* parent);
|
||||
InputVibrationBindingWidget(QWidget* parent, ControllerSettingsWindow* dialog, std::string section_name,
|
||||
std::string key_name);
|
||||
~InputVibrationBindingWidget();
|
||||
|
@ -12,7 +12,7 @@ class ISOBrowserWindow : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ISOBrowserWindow(QWidget* parent = nullptr);
|
||||
explicit ISOBrowserWindow(QWidget* parent = nullptr);
|
||||
~ISOBrowserWindow();
|
||||
|
||||
static ISOBrowserWindow* createAndOpenFile(QWidget* parent, const QString& path);
|
||||
|
@ -281,7 +281,7 @@ public:
|
||||
|
||||
using DeviceList = QList<Device>;
|
||||
|
||||
InputDeviceListModel(QObject* parent = nullptr);
|
||||
explicit InputDeviceListModel(QObject* parent = nullptr);
|
||||
~InputDeviceListModel() override;
|
||||
|
||||
// Safe to access on UI thread.
|
||||
@ -325,7 +325,7 @@ Q_SIGNALS:
|
||||
void completed(QtAsyncTask* self);
|
||||
|
||||
private:
|
||||
QtAsyncTask(WorkCallback callback);
|
||||
explicit QtAsyncTask(WorkCallback callback);
|
||||
|
||||
std::variant<WorkCallback, CompletionCallback> m_callback;
|
||||
};
|
||||
|
@ -16,7 +16,7 @@ class QtModalProgressCallback final : public QObject, public ProgressCallback
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtModalProgressCallback(QWidget* parent_widget, float show_delay = 0.0f);
|
||||
explicit QtModalProgressCallback(QWidget* parent_widget, float show_delay = 0.0f);
|
||||
~QtModalProgressCallback();
|
||||
|
||||
QProgressDialog& GetDialog() { return m_dialog; }
|
||||
@ -53,7 +53,7 @@ class QtAsyncProgressThread : public QThread, public ProgressCallback
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtAsyncProgressThread(QWidget* parent);
|
||||
explicit QtAsyncProgressThread(QWidget* parent);
|
||||
~QtAsyncProgressThread();
|
||||
|
||||
bool IsCancelled() const override;
|
||||
|
@ -14,7 +14,7 @@ class SelectDiscDialog final : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SelectDiscDialog(const std::string& disc_set_name, QWidget* parent = nullptr);
|
||||
explicit SelectDiscDialog(const std::string& disc_set_name, QWidget* parent = nullptr);
|
||||
~SelectDiscDialog();
|
||||
|
||||
ALWAYS_INLINE const std::string& getSelectedDiscPath() { return m_selected_path; }
|
||||
|
@ -10,7 +10,7 @@
|
||||
class Updater
|
||||
{
|
||||
public:
|
||||
Updater(ProgressCallback* progress);
|
||||
explicit Updater(ProgressCallback* progress);
|
||||
~Updater();
|
||||
|
||||
bool Initialize(std::string staging_directory, std::string destination_directory);
|
||||
|
@ -28,7 +28,7 @@ namespace {
|
||||
class TrackFileInterface
|
||||
{
|
||||
public:
|
||||
TrackFileInterface(std::string filename);
|
||||
explicit TrackFileInterface(std::string filename);
|
||||
virtual ~TrackFileInterface();
|
||||
|
||||
ALWAYS_INLINE const std::string& GetFileName() const { return m_filename; }
|
||||
|
@ -172,7 +172,7 @@ IMPLEMENT_ENUM_CLASS_BITWISE_OPERATORS(GPUDriverType);
|
||||
class GPUShader
|
||||
{
|
||||
public:
|
||||
GPUShader(GPUShaderStage stage);
|
||||
explicit GPUShader(GPUShaderStage stage);
|
||||
virtual ~GPUShader();
|
||||
|
||||
static const char* GetStageName(GPUShaderStage stage);
|
||||
|
@ -114,7 +114,7 @@ void ClearStages(SettingsInterface& si, const char* section);
|
||||
class Chain final
|
||||
{
|
||||
public:
|
||||
Chain(const char* section);
|
||||
explicit Chain(const char* section);
|
||||
~Chain();
|
||||
|
||||
ALWAYS_INLINE bool HasStages() const { return !m_stages.empty(); }
|
||||
|
@ -27,7 +27,7 @@ class Shader
|
||||
{
|
||||
public:
|
||||
Shader();
|
||||
Shader(std::string name);
|
||||
explicit Shader(std::string name);
|
||||
virtual ~Shader();
|
||||
|
||||
ALWAYS_INLINE const std::string& GetName() const { return m_name; }
|
||||
@ -64,4 +64,4 @@ protected:
|
||||
OptionList m_options;
|
||||
};
|
||||
|
||||
} // namespace PostProcessing
|
||||
} // namespace PostProcessing
|
||||
|
Loading…
x
Reference in New Issue
Block a user