Merge pull request #1748 from LocalSpook/using

This commit is contained in:
txtsd 2023-10-25 16:08:42 +00:00 committed by GitHub
commit 38d77b58cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 63 additions and 48 deletions

4
.clang-tidy Normal file
View File

@ -0,0 +1,4 @@
Checks:
- modernize-use-using
SystemHeaders: false

View File

@ -64,7 +64,7 @@ class LaunchTask;
class BaseInstance; class BaseInstance;
// pointer for lazy people // pointer for lazy people
typedef std::shared_ptr<BaseInstance> InstancePtr; using InstancePtr = std::shared_ptr<BaseInstance>;
/*! /*!
* \brief Base class for instances. * \brief Base class for instances.

View File

@ -51,7 +51,7 @@ class BaseVersionList : public QAbstractListModel {
ArchitectureRole, ArchitectureRole,
SortRole SortRole
}; };
typedef QList<int> RoleList; using RoleList = QList<int>;
explicit BaseVersionList(QObject* parent = 0); explicit BaseVersionList(QObject* parent = 0);

View File

@ -123,26 +123,35 @@ namespace fs = ghc::filesystem;
#if defined(__MINGW32__) #if defined(__MINGW32__)
typedef struct _DUPLICATE_EXTENTS_DATA { struct _DUPLICATE_EXTENTS_DATA {
HANDLE FileHandle; HANDLE FileHandle;
LARGE_INTEGER SourceFileOffset; LARGE_INTEGER SourceFileOffset;
LARGE_INTEGER TargetFileOffset; LARGE_INTEGER TargetFileOffset;
LARGE_INTEGER ByteCount; LARGE_INTEGER ByteCount;
} DUPLICATE_EXTENTS_DATA, *PDUPLICATE_EXTENTS_DATA; };
typedef struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER { using DUPLICATE_EXTENTS_DATA = _DUPLICATE_EXTENTS_DATA;
using PDUPLICATE_EXTENTS_DATA = _DUPLICATE_EXTENTS_DATA*;
struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER {
WORD ChecksumAlgorithm; // Checksum algorithm. e.g. CHECKSUM_TYPE_UNCHANGED, CHECKSUM_TYPE_NONE, CHECKSUM_TYPE_CRC32 WORD ChecksumAlgorithm; // Checksum algorithm. e.g. CHECKSUM_TYPE_UNCHANGED, CHECKSUM_TYPE_NONE, CHECKSUM_TYPE_CRC32
WORD Reserved; // Must be 0 WORD Reserved; // Must be 0
DWORD Flags; // FSCTL_INTEGRITY_FLAG_xxx DWORD Flags; // FSCTL_INTEGRITY_FLAG_xxx
DWORD ChecksumChunkSizeInBytes; DWORD ChecksumChunkSizeInBytes;
DWORD ClusterSizeInBytes; DWORD ClusterSizeInBytes;
} FSCTL_GET_INTEGRITY_INFORMATION_BUFFER, *PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER; };
typedef struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER { using FSCTL_GET_INTEGRITY_INFORMATION_BUFFER = _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER;
using PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER = _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER*;
struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER {
WORD ChecksumAlgorithm; // Checksum algorithm. e.g. CHECKSUM_TYPE_UNCHANGED, CHECKSUM_TYPE_NONE, CHECKSUM_TYPE_CRC32 WORD ChecksumAlgorithm; // Checksum algorithm. e.g. CHECKSUM_TYPE_UNCHANGED, CHECKSUM_TYPE_NONE, CHECKSUM_TYPE_CRC32
WORD Reserved; // Must be 0 WORD Reserved; // Must be 0
DWORD Flags; // FSCTL_INTEGRITY_FLAG_xxx DWORD Flags; // FSCTL_INTEGRITY_FLAG_xxx
} FSCTL_SET_INTEGRITY_INFORMATION_BUFFER, *PFSCTL_SET_INTEGRITY_INFORMATION_BUFFER; };
using FSCTL_SET_INTEGRITY_INFORMATION_BUFFER = _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER;
using PFSCTL_SET_INTEGRITY_INFORMATION_BUFFER = _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER*;
#endif #endif

View File

@ -172,7 +172,7 @@ class ExportToZipTask : public Task {
void setExcludeFiles(QStringList excludeFiles) { m_exclude_files = excludeFiles; } void setExcludeFiles(QStringList excludeFiles) { m_exclude_files = excludeFiles; }
void addExtraFile(QString fileName, QByteArray data) { m_extra_files.insert(fileName, data); } void addExtraFile(QString fileName, QByteArray data) { m_extra_files.insert(fileName, data); }
typedef std::optional<QString> ZipResult; using ZipResult = std::optional<QString>;
protected: protected:
virtual void executeTask() override; virtual void executeTask() override;

View File

@ -10,7 +10,7 @@ class VersionProxyModel : public QAbstractProxyModel {
Q_OBJECT Q_OBJECT
public: public:
enum Column { Name, ParentVersion, Branch, Type, Architecture, Path, Time }; enum Column { Name, ParentVersion, Branch, Type, Architecture, Path, Time };
typedef QHash<BaseVersionList::ModelRoles, std::shared_ptr<Filter>> FilterMap; using FilterMap = QHash<BaseVersionList::ModelRoles, std::shared_ptr<Filter>>;
public: public:
VersionProxyModel(QObject* parent = 0); VersionProxyModel(QObject* parent = 0);

View File

@ -22,8 +22,8 @@ struct JavaCheckResult {
enum class Validity { Errored, ReturnedInvalidData, Valid } validity = Validity::Errored; enum class Validity { Errored, ReturnedInvalidData, Valid } validity = Validity::Errored;
}; };
typedef shared_qobject_ptr<QProcess> QProcessPtr; using QProcessPtr = shared_qobject_ptr<QProcess>;
typedef shared_qobject_ptr<JavaChecker> JavaCheckerPtr; using JavaCheckerPtr = shared_qobject_ptr<JavaChecker>;
class JavaChecker : public QObject { class JavaChecker : public QObject {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -20,7 +20,7 @@
#include "tasks/Task.h" #include "tasks/Task.h"
class JavaCheckerJob; class JavaCheckerJob;
typedef shared_qobject_ptr<JavaCheckerJob> JavaCheckerJobPtr; using JavaCheckerJobPtr = shared_qobject_ptr<JavaCheckerJob>;
// FIXME: this just seems horribly redundant // FIXME: this just seems horribly redundant
class JavaCheckerJob : public Task { class JavaCheckerJob : public Task {

View File

@ -42,4 +42,4 @@ struct JavaInstall : public BaseVersion {
bool recommended = false; bool recommended = false;
}; };
typedef std::shared_ptr<JavaInstall> JavaInstallPtr; using JavaInstallPtr = std::shared_ptr<JavaInstall>;

View File

@ -6,7 +6,7 @@
class Agent; class Agent;
typedef std::shared_ptr<Agent> AgentPtr; using AgentPtr = std::shared_ptr<Agent>;
class Agent { class Agent {
public: public:

View File

@ -105,4 +105,4 @@ class Component : public QObject, public ProblemProvider {
bool m_loaded = false; bool m_loaded = false;
}; };
typedef shared_qobject_ptr<Component> ComponentPtr; using ComponentPtr = shared_qobject_ptr<Component>;

View File

@ -52,7 +52,7 @@
class Library; class Library;
class MinecraftInstance; class MinecraftInstance;
typedef std::shared_ptr<Library> LibraryPtr; using LibraryPtr = std::shared_ptr<Library>;
class Library { class Library {
friend class OneSixVersionFormat; friend class OneSixVersionFormat;

View File

@ -174,4 +174,4 @@ class MinecraftInstance : public BaseInstance {
mutable std::shared_ptr<GameOptions> m_game_options; mutable std::shared_ptr<GameOptions> m_game_options;
}; };
typedef std::shared_ptr<MinecraftInstance> MinecraftInstancePtr; using MinecraftInstancePtr = std::shared_ptr<MinecraftInstance>;

View File

@ -5,7 +5,7 @@
struct MojangDownloadInfo { struct MojangDownloadInfo {
// types // types
typedef std::shared_ptr<MojangDownloadInfo> Ptr; using Ptr = std::shared_ptr<MojangDownloadInfo>;
// data // data
/// Local filesystem path. WARNING: not used, only here so we can pass through mojang files unmolested! /// Local filesystem path. WARNING: not used, only here so we can pass through mojang files unmolested!
@ -23,7 +23,7 @@ struct MojangLibraryDownloadInfo {
MojangLibraryDownloadInfo() {} MojangLibraryDownloadInfo() {}
// types // types
typedef std::shared_ptr<MojangLibraryDownloadInfo> Ptr; using Ptr = std::shared_ptr<MojangLibraryDownloadInfo>;
// methods // methods
MojangDownloadInfo* getDownloadInfo(QString classifier) MojangDownloadInfo* getDownloadInfo(QString classifier)
@ -42,7 +42,7 @@ struct MojangLibraryDownloadInfo {
struct MojangAssetIndexInfo : public MojangDownloadInfo { struct MojangAssetIndexInfo : public MojangDownloadInfo {
// types // types
typedef std::shared_ptr<MojangAssetIndexInfo> Ptr; using Ptr = std::shared_ptr<MojangAssetIndexInfo>;
// methods // methods
MojangAssetIndexInfo() {} MojangAssetIndexInfo() {}

View File

@ -38,7 +38,7 @@
#include "VersionFile.h" #include "VersionFile.h"
namespace ProfileUtils { namespace ProfileUtils {
typedef QStringList PatchOrder; using PatchOrder = QStringList;
/// Read and parse a OneSix format order file /// Read and parse a OneSix format order file
bool readOverrideOrders(QString path, PatchOrder& order); bool readOverrideOrders(QString path, PatchOrder& order);

View File

@ -43,4 +43,4 @@ struct AuthSession {
bool demo = false; bool demo = false;
}; };
typedef std::shared_ptr<AuthSession> AuthSessionPtr; using AuthSessionPtr = std::shared_ptr<AuthSession>;

View File

@ -54,7 +54,7 @@ class Task;
class AccountTask; class AccountTask;
class MinecraftAccount; class MinecraftAccount;
typedef shared_qobject_ptr<MinecraftAccount> MinecraftAccountPtr; using MinecraftAccountPtr = shared_qobject_ptr<MinecraftAccount>;
Q_DECLARE_METATYPE(MinecraftAccountPtr) Q_DECLARE_METATYPE(MinecraftAccountPtr)
/** /**

View File

@ -26,4 +26,4 @@ struct MinecraftServerTarget {
static MinecraftServerTarget parse(const QString& fullAddress); static MinecraftServerTarget parse(const QString& fullAddress);
}; };
typedef std::shared_ptr<MinecraftServerTarget> MinecraftServerTargetPtr; using MinecraftServerTargetPtr = std::shared_ptr<MinecraftServerTarget>;

View File

@ -4,7 +4,7 @@
#include <QtNetwork/QtNetwork> #include <QtNetwork/QtNetwork>
#include "tasks/Task.h" #include "tasks/Task.h"
typedef shared_qobject_ptr<class SkinDelete> SkinDeletePtr; using SkinDeletePtr = shared_qobject_ptr<class SkinDelete>;
class SkinDelete : public Task { class SkinDelete : public Task {
Q_OBJECT Q_OBJECT

View File

@ -5,7 +5,7 @@
#include <memory> #include <memory>
#include "tasks/Task.h" #include "tasks/Task.h"
typedef shared_qobject_ptr<class SkinUpload> SkinUploadPtr; using SkinUploadPtr = shared_qobject_ptr<class SkinUpload>;
class SkinUpload : public Task { class SkinUpload : public Task {
Q_OBJECT Q_OBJECT

View File

@ -45,7 +45,7 @@ struct Modpack {
QIcon icon; QIcon icon;
}; };
typedef QList<Modpack> ModpackList; using ModpackList = QList<Modpack>;
Modpack parseDirectory(QString path); Modpack parseDirectory(QString path);

View File

@ -31,7 +31,7 @@ struct Modpack {
QString packCode; QString packCode;
}; };
typedef QList<Modpack> ModpackList; using ModpackList = QList<Modpack>;
} // namespace LegacyFTB } // namespace LegacyFTB

View File

@ -87,7 +87,7 @@ class NetRequest : public NetAction {
std::unique_ptr<Sink> m_sink; std::unique_ptr<Sink> m_sink;
Options m_options; Options m_options;
typedef const QLoggingCategory& (*logCatFunc)(); using logCatFunc = const QLoggingCategory& (*)();
logCatFunc logCat = taskUploadLogC; logCatFunc logCat = taskUploadLogC;
std::chrono::steady_clock m_clock; std::chrono::steady_clock m_clock;

View File

@ -51,4 +51,4 @@ class NewsEntry : public QObject {
QString link; QString link;
}; };
typedef std::shared_ptr<NewsEntry> NewsEntryPtr; using NewsEntryPtr = std::shared_ptr<NewsEntry>;

View File

@ -4,7 +4,7 @@
class IPathMatcher { class IPathMatcher {
public: public:
typedef std::shared_ptr<IPathMatcher> Ptr; using Ptr = std::shared_ptr<IPathMatcher>;
public: public:
virtual ~IPathMatcher() {} virtual ~IPathMatcher() {}

View File

@ -26,8 +26,8 @@
class Setting; class Setting;
class SettingsObject; class SettingsObject;
typedef std::shared_ptr<SettingsObject> SettingsObjectPtr; using SettingsObjectPtr = std::shared_ptr<SettingsObject>;
typedef std::weak_ptr<SettingsObject> SettingsObjectWeakPtr; using SettingsObjectWeakPtr = std::weak_ptr<SettingsObject>;
/*! /*!
* \brief The SettingsObject handles communicating settings between the application and a * \brief The SettingsObject handles communicating settings between the application and a

View File

@ -77,7 +77,7 @@ struct TaskStepProgress {
Q_DECLARE_METATYPE(TaskStepProgress) Q_DECLARE_METATYPE(TaskStepProgress)
typedef QList<std::shared_ptr<TaskStepProgress>> TaskStepProgressList; using TaskStepProgressList = QList<std::shared_ptr<TaskStepProgress>>;
class Task : public QObject, public QRunnable { class Task : public QObject, public QRunnable {
Q_OBJECT Q_OBJECT

View File

@ -43,7 +43,7 @@
#include "FileIgnoreProxy.h" #include "FileIgnoreProxy.h"
class BaseInstance; class BaseInstance;
typedef std::shared_ptr<BaseInstance> InstancePtr; using InstancePtr = std::shared_ptr<BaseInstance>;
namespace Ui { namespace Ui {
class ExportInstanceDialog; class ExportInstanceDialog;

View File

@ -59,7 +59,7 @@ class AccessibleInstanceView : public QAccessibleTableInterface, public QAccessi
protected: protected:
// maybe vector // maybe vector
typedef QHash<int, QAccessible::Id> ChildCache; using ChildCache = QHash<int, QAccessible::Id>;
mutable ChildCache childToId; mutable ChildCache childToId;
virtual ~AccessibleInstanceView(); virtual ~AccessibleInstanceView();

View File

@ -77,4 +77,4 @@ class BasePage {
bool isOpened = false; bool isOpened = false;
}; };
typedef std::shared_ptr<BasePage> BasePagePtr; using BasePagePtr = std::shared_ptr<BasePage>;

View File

@ -26,7 +26,7 @@ class BasePageProvider {
}; };
class GenericPageProvider : public BasePageProvider { class GenericPageProvider : public BasePageProvider {
typedef std::function<BasePage*()> PageCreator; using PageCreator = std::function<BasePage*()>;
public: public:
explicit GenericPageProvider(const QString& dialogTitle) : m_dialogTitle(dialogTitle) {} explicit GenericPageProvider(const QString& dialogTitle) : m_dialogTitle(dialogTitle) {}

View File

@ -68,8 +68,8 @@
#include <FileSystem.h> #include <FileSystem.h>
#include "RWStorage.h" #include "RWStorage.h"
typedef RWStorage<QString, QIcon> SharedIconCache; using SharedIconCache = RWStorage<QString, QIcon>;
typedef std::shared_ptr<SharedIconCache> SharedIconCachePtr; using SharedIconCachePtr = std::shared_ptr<SharedIconCache>;
class ThumbnailingResult : public QObject { class ThumbnailingResult : public QObject {
Q_OBJECT Q_OBJECT

View File

@ -24,8 +24,8 @@
namespace Atl { namespace Atl {
typedef QMap<QString, QIcon> LogoMap; using LogoMap = QMap<QString, QIcon>;
typedef std::function<void(QString)> LogoCallback; using LogoCallback = std::function<void(QString)>;
class ListModel : public QAbstractListModel { class ListModel : public QAbstractListModel {
Q_OBJECT Q_OBJECT

View File

@ -19,8 +19,8 @@
namespace Flame { namespace Flame {
typedef QMap<QString, QIcon> LogoMap; using LogoMap = QMap<QString, QIcon>;
typedef std::function<void(QString)> LogoCallback; using LogoCallback = std::function<void(QString)>;
class ListModel : public QAbstractListModel { class ListModel : public QAbstractListModel {
Q_OBJECT Q_OBJECT

View File

@ -13,8 +13,8 @@
namespace LegacyFTB { namespace LegacyFTB {
typedef QMap<QString, QIcon> FTBLogoMap; using FTBLogoMap = QMap<QString, QIcon>;
typedef std::function<void(QString)> LogoCallback; using LogoCallback = std::function<void(QString)>;
class FilterModel : public QSortFilterProxyModel { class FilterModel : public QSortFilterProxyModel {
Q_OBJECT Q_OBJECT

View File

@ -42,7 +42,7 @@
namespace Technic { namespace Technic {
typedef std::function<void(QString)> LogoCallback; using LogoCallback = std::function<void(QString)>;
class ListModel : public QAbstractListModel { class ListModel : public QAbstractListModel {
Q_OBJECT Q_OBJECT

2
libraries/.clang-tidy Normal file
View File

@ -0,0 +1,2 @@
# We don't care about linting third-party code.
Checks: -*