mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Mark vfs functions as OC_REQUIRED_RESULT
This commit is contained in:
parent
aadda32633
commit
72b6118c3e
2 changed files with 18 additions and 10 deletions
|
@ -3,6 +3,13 @@
|
|||
|
||||
#include <qglobal.h>
|
||||
|
||||
#if 0 && defined(Q_CC_MSVC)
|
||||
// requires c++2017
|
||||
#define OC_REQUIRED_RESULT [[nodiscard]]
|
||||
#else
|
||||
#define OC_REQUIRED_RESULT Q_REQUIRED_RESULT
|
||||
#endif
|
||||
|
||||
#if defined(QT_FORCE_ASSERTS) || !defined(QT_NO_DEBUG)
|
||||
#define OC_ASSERT_MSG qFatal
|
||||
#else
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "assert.h"
|
||||
#include "ocsynclib.h"
|
||||
#include "result.h"
|
||||
#include "syncfilestatus.h"
|
||||
|
@ -158,24 +159,24 @@ public:
|
|||
* If the remote metadata changes, the local placeholder's metadata should possibly
|
||||
* change as well.
|
||||
*/
|
||||
virtual Result<void, QString> updateMetadata(const QString &filePath, time_t modtime, qint64 size, const QByteArray &fileId) = 0;
|
||||
virtual OC_REQUIRED_RESULT Result<void, QString> updateMetadata(const QString &filePath, time_t modtime, qint64 size, const QByteArray &fileId) = 0;
|
||||
|
||||
/// Create a new dehydrated placeholder. Called from PropagateDownload.
|
||||
virtual Result<void, QString> createPlaceholder(const SyncFileItem &item) = 0;
|
||||
virtual OC_REQUIRED_RESULT Result<void, QString> createPlaceholder(const SyncFileItem &item) = 0;
|
||||
|
||||
/** Convert a hydrated placeholder to a dehydrated one. Called from PropagateDownlaod.
|
||||
*
|
||||
* This is different from delete+create because preserving some file metadata
|
||||
* (like pin states) may be essential for some vfs plugins.
|
||||
*/
|
||||
virtual Result<void, QString> dehydratePlaceholder(const SyncFileItem &item) = 0;
|
||||
virtual OC_REQUIRED_RESULT Result<void, QString> dehydratePlaceholder(const SyncFileItem &item) = 0;
|
||||
|
||||
/** Discovery hook: even unchanged files may need UPDATE_METADATA.
|
||||
*
|
||||
* For instance cfapi vfs wants local hydrated non-placeholder files to
|
||||
* become hydrated placeholder files.
|
||||
*/
|
||||
virtual bool needsMetadataUpdate(const SyncFileItem &item) = 0;
|
||||
virtual OC_REQUIRED_RESULT bool needsMetadataUpdate(const SyncFileItem &item) = 0;
|
||||
|
||||
/** Convert a new file to a hydrated placeholder.
|
||||
*
|
||||
|
@ -190,13 +191,13 @@ public:
|
|||
* new placeholder shall supersede, for rename-replace actions with new downloads,
|
||||
* for example.
|
||||
*/
|
||||
virtual Result<void, QString> convertToPlaceholder(
|
||||
virtual OC_REQUIRED_RESULT Result<void, QString> convertToPlaceholder(
|
||||
const QString &filename,
|
||||
const SyncFileItem &item,
|
||||
const QString &replacesFile = QString()) = 0;
|
||||
|
||||
/// Determine whether the file at the given absolute path is a dehydrated placeholder.
|
||||
virtual bool isDehydratedPlaceholder(const QString &filePath) = 0;
|
||||
virtual OC_REQUIRED_RESULT bool isDehydratedPlaceholder(const QString &filePath) = 0;
|
||||
|
||||
/** Similar to isDehydratedPlaceholder() but used from sync discovery.
|
||||
*
|
||||
|
@ -205,7 +206,7 @@ public:
|
|||
*
|
||||
* Returning true means that type was fully determined.
|
||||
*/
|
||||
virtual bool statTypeVirtualFile(csync_file_stat_t *stat, void *stat_data) = 0;
|
||||
virtual OC_REQUIRED_RESULT bool statTypeVirtualFile(csync_file_stat_t *stat, void *stat_data) = 0;
|
||||
|
||||
/** Sets the pin state for the item at a path.
|
||||
*
|
||||
|
@ -216,7 +217,7 @@ public:
|
|||
*
|
||||
* folderPath is relative to the sync folder. Can be "" for root folder.
|
||||
*/
|
||||
virtual bool setPinState(const QString &folderPath, PinState state) = 0;
|
||||
virtual OC_REQUIRED_RESULT bool setPinState(const QString &folderPath, PinState state) = 0;
|
||||
|
||||
/** Returns the pin state of an item at a path.
|
||||
*
|
||||
|
@ -227,7 +228,7 @@ public:
|
|||
*
|
||||
* Returns none on retrieval error.
|
||||
*/
|
||||
virtual Optional<PinState> pinState(const QString &folderPath) = 0;
|
||||
virtual OC_REQUIRED_RESULT Optional<PinState> pinState(const QString &folderPath) = 0;
|
||||
|
||||
/** Returns availability status of an item at a path.
|
||||
*
|
||||
|
@ -236,7 +237,7 @@ public:
|
|||
*
|
||||
* folderPath is relative to the sync folder. Can be "" for root folder.
|
||||
*/
|
||||
virtual AvailabilityResult availability(const QString &folderPath) = 0;
|
||||
virtual OC_REQUIRED_RESULT AvailabilityResult availability(const QString &folderPath) = 0;
|
||||
|
||||
public slots:
|
||||
/** Update in-sync state based on SyncFileStatusTracker signal.
|
||||
|
|
Loading…
Reference in a new issue