From c6611b0678346cc7803b3812d4fa8eb549215bbe Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 16 Jan 2024 16:57:43 +0800 Subject: [PATCH] Ensure [[nodiscard]] in new file provider classes Signed-off-by: Claudio Cambra --- src/gui/macOS/fileproviderdomainsyncstatus.h | 22 +++--- src/gui/macOS/fileprovideritemmetadata.h | 68 +++++++++---------- .../fileprovidermaterialiseditemsmodel.h | 8 +-- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/gui/macOS/fileproviderdomainsyncstatus.h b/src/gui/macOS/fileproviderdomainsyncstatus.h index d92c2c5536c52..b6b1256acf9ec 100644 --- a/src/gui/macOS/fileproviderdomainsyncstatus.h +++ b/src/gui/macOS/fileproviderdomainsyncstatus.h @@ -42,17 +42,17 @@ class FileProviderDomainSyncStatus : public QObject explicit FileProviderDomainSyncStatus(const QString &domainIdentifier, QObject *parent = nullptr); ~FileProviderDomainSyncStatus() override; - bool syncing() const; - bool downloading() const; - bool uploading() const; - double fractionCompleted() const; - double downloadFractionCompleted() const; - double uploadFractionCompleted() const; - int downloadFileTotalCount() const; - int downloadFileCompletedCount() const; - int uploadFileTotalCount() const; - int uploadFileCompletedCount() const; - QUrl icon() const; + [[nodiscard]] bool syncing() const; + [[nodiscard]] bool downloading() const; + [[nodiscard]] bool uploading() const; + [[nodiscard]] double fractionCompleted() const; + [[nodiscard]] double downloadFractionCompleted() const; + [[nodiscard]] double uploadFractionCompleted() const; + [[nodiscard]] int downloadFileTotalCount() const; + [[nodiscard]] int downloadFileCompletedCount() const; + [[nodiscard]] int uploadFileTotalCount() const; + [[nodiscard]] int uploadFileCompletedCount() const; + [[nodiscard]] QUrl icon() const; signals: void syncingChanged(bool syncing); diff --git a/src/gui/macOS/fileprovideritemmetadata.h b/src/gui/macOS/fileprovideritemmetadata.h index cad6170b446b4..e3e0b0a0cd232 100644 --- a/src/gui/macOS/fileprovideritemmetadata.h +++ b/src/gui/macOS/fileprovideritemmetadata.h @@ -61,45 +61,45 @@ class FileProviderItemMetadata public: static FileProviderItemMetadata fromNSFileProviderItem(const void *const nsFileProviderItem, const QString &domainIdentifier); - QString identifier() const; - QString parentItemIdentifier() const; - QString domainIdentifier() const; - QString filename() const; - QString typeIdentifier() const; - QString symlinkTargetPath() const; - QString uploadingError() const; - QString downloadingError() const; - QString mostRecentEditorName() const; - QString ownerName() const; - QDateTime contentModificationDate() const; - QDateTime creationDate() const; - QDateTime lastUsedDate() const; - QByteArray contentVersion() const; - QByteArray metadataVersion() const; - QByteArray tagData() const; - QHash extendedAttributes() const; - int capabilities() const; - int fileSystemFlags() const; - unsigned int childItemCount() const; - unsigned int typeOsCode() const; - unsigned int creatorOsCode() const; - unsigned long long documentSize() const; - bool mostRecentVersionDownloaded() const; - bool uploading() const; - bool uploaded() const; - bool downloading() const; - bool downloaded() const; - bool shared() const; - bool sharedByCurrentUser() const; - - QString userVisiblePath() const; - QString fileTypeString() const; + [[nodiscard]] QString identifier() const; + [[nodiscard]] QString parentItemIdentifier() const; + [[nodiscard]] QString domainIdentifier() const; + [[nodiscard]] QString filename() const; + [[nodiscard]] QString typeIdentifier() const; + [[nodiscard]] QString symlinkTargetPath() const; + [[nodiscard]] QString uploadingError() const; + [[nodiscard]] QString downloadingError() const; + [[nodiscard]] QString mostRecentEditorName() const; + [[nodiscard]] QString ownerName() const; + [[nodiscard]] QDateTime contentModificationDate() const; + [[nodiscard]] QDateTime creationDate() const; + [[nodiscard]] QDateTime lastUsedDate() const; + [[nodiscard]] QByteArray contentVersion() const; + [[nodiscard]] QByteArray metadataVersion() const; + [[nodiscard]] QByteArray tagData() const; + [[nodiscard]] QHash extendedAttributes() const; + [[nodiscard]] int capabilities() const; + [[nodiscard]] int fileSystemFlags() const; + [[nodiscard]] unsigned int childItemCount() const; + [[nodiscard]] unsigned int typeOsCode() const; + [[nodiscard]] unsigned int creatorOsCode() const; + [[nodiscard]] unsigned long long documentSize() const; + [[nodiscard]] bool mostRecentVersionDownloaded() const; + [[nodiscard]] bool uploading() const; + [[nodiscard]] bool uploaded() const; + [[nodiscard]] bool downloading() const; + [[nodiscard]] bool downloaded() const; + [[nodiscard]] bool shared() const; + [[nodiscard]] bool sharedByCurrentUser() const; + + [[nodiscard]] QString userVisiblePath() const; + [[nodiscard]] QString fileTypeString() const; // Check equality via identifier, contentVersion, and metadataVersion friend bool operator==(const FileProviderItemMetadata &lhs, const FileProviderItemMetadata &rhs); private: - QString getUserVisiblePath() const; + [[nodiscard]] QString getUserVisiblePath() const; QString _identifier; QString _parentItemIdentifier; diff --git a/src/gui/macOS/fileprovidermaterialiseditemsmodel.h b/src/gui/macOS/fileprovidermaterialiseditemsmodel.h index 9b7ff8035b57d..3d34dd9f2b7fe 100644 --- a/src/gui/macOS/fileprovidermaterialiseditemsmodel.h +++ b/src/gui/macOS/fileprovidermaterialiseditemsmodel.h @@ -67,11 +67,11 @@ class FileProviderMaterialisedItemsModel : public QAbstractListModel Q_ENUM(Roles) explicit FileProviderMaterialisedItemsModel(QObject *parent = nullptr); - int rowCount(const QModelIndex &parent = {}) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - QHash roleNames() const override; + [[nodiscard]] int rowCount(const QModelIndex &parent = {}) const override; + [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + [[nodiscard]] QHash roleNames() const override; - QVector items() const; + [[nodiscard]] QVector items() const; signals: void itemsChanged();