mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 06:45:49 +03:00
Use Q_ENUM_NS to pretty print csync enums
This commit is contained in:
parent
5927beb08d
commit
1dd01477c5
2 changed files with 24 additions and 12 deletions
|
@ -59,7 +59,10 @@ class SyncJournalFileRecord;
|
||||||
#define BITFIELD(size) :size
|
#define BITFIELD(size) :size
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum CSYNC_STATUS {
|
namespace CSyncEnums {
|
||||||
|
OCSYNC_EXPORT Q_NAMESPACE
|
||||||
|
|
||||||
|
enum csync_status_codes_e {
|
||||||
CSYNC_STATUS_OK = 0,
|
CSYNC_STATUS_OK = 0,
|
||||||
|
|
||||||
CSYNC_STATUS_ERROR = 1024, /* don't use this code,
|
CSYNC_STATUS_ERROR = 1024, /* don't use this code,
|
||||||
|
@ -94,17 +97,7 @@ enum CSYNC_STATUS {
|
||||||
CSYNC_STATUS_INDIVIDUAL_IS_CONFLICT_FILE,
|
CSYNC_STATUS_INDIVIDUAL_IS_CONFLICT_FILE,
|
||||||
CSYNC_STATUS_INDIVIDUAL_CANNOT_ENCODE
|
CSYNC_STATUS_INDIVIDUAL_CANNOT_ENCODE
|
||||||
};
|
};
|
||||||
|
Q_ENUM_NS(csync_status_codes_e)
|
||||||
#ifndef likely
|
|
||||||
# define likely(x) (x)
|
|
||||||
#endif
|
|
||||||
#ifndef unlikely
|
|
||||||
# define unlikely(x) (x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CSYNC_STATUS_IS_OK(x) (likely((x) == CSYNC_STATUS_OK))
|
|
||||||
#define CSYNC_STATUS_IS_ERR(x) (unlikely((x) >= CSYNC_STATUS_ERROR))
|
|
||||||
#define CSYNC_STATUS_IS_EQUAL(x, y) ((x) == (y))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instruction enum. In the file traversal structure, it describes
|
* Instruction enum. In the file traversal structure, it describes
|
||||||
|
@ -129,6 +122,8 @@ enum csync_instructions_e {
|
||||||
but without any propagation (UPDATE|RECONCILE) */
|
but without any propagation (UPDATE|RECONCILE) */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_ENUM_NS(csync_instructions_e)
|
||||||
|
|
||||||
// This enum is used with BITFIELD(3) and BITFIELD(4) in several places.
|
// This enum is used with BITFIELD(3) and BITFIELD(4) in several places.
|
||||||
// Also, this value is stored in the database, so beware of value changes.
|
// Also, this value is stored in the database, so beware of value changes.
|
||||||
enum ItemType {
|
enum ItemType {
|
||||||
|
@ -165,7 +160,22 @@ enum ItemType {
|
||||||
*/
|
*/
|
||||||
ItemTypeVirtualFileDehydration = 6,
|
ItemTypeVirtualFileDehydration = 6,
|
||||||
};
|
};
|
||||||
|
Q_ENUM_NS(ItemType)
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace CSyncEnums;
|
||||||
|
using CSYNC_STATUS = CSyncEnums::csync_status_codes_e;
|
||||||
|
|
||||||
|
#ifndef likely
|
||||||
|
#define likely(x) (x)
|
||||||
|
#endif
|
||||||
|
#ifndef unlikely
|
||||||
|
#define unlikely(x) (x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CSYNC_STATUS_IS_OK(x) (likely((x) == CSYNC_STATUS_OK))
|
||||||
|
#define CSYNC_STATUS_IS_ERR(x) (unlikely((x) >= CSYNC_STATUS_ERROR))
|
||||||
|
#define CSYNC_STATUS_IS_EQUAL(x, y) ((x) == (y))
|
||||||
|
|
||||||
#define FILE_ID_BUF_SIZE 36
|
#define FILE_ID_BUF_SIZE 36
|
||||||
|
|
||||||
|
|
|
@ -198,3 +198,5 @@ bool csync_is_collision_safe_hash(const QByteArray &checksum_header)
|
||||||
return checksum_header.startsWith("SHA")
|
return checksum_header.startsWith("SHA")
|
||||||
|| checksum_header.startsWith("MD5:");
|
|| checksum_header.startsWith("MD5:");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "moc_csync.cpp"
|
||||||
|
|
Loading…
Reference in a new issue