123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #ifndef REALM_SYNC_PERMISSIONS_HPP
- #define REALM_SYNC_PERMISSIONS_HPP
- #include <stddef.h>
- namespace realm {
- namespace sync {
- enum class Privilege : uint_least32_t {
- None = 0,
-
-
-
-
-
-
-
-
-
- Read = 1,
-
-
-
-
-
-
-
-
- Update = 2,
-
-
-
-
-
-
-
-
- Delete = 4,
-
-
-
-
-
- SetPermissions = 8,
- Share = SetPermissions,
-
-
-
-
-
- Query = 16,
-
-
-
-
-
-
-
-
-
-
-
- Create = 32,
-
-
-
-
- ModifySchema = 64,
-
-
-
- Download = Read | Query,
- Upload = Update | Delete | Create,
- DeleteRealm = Upload,
- };
- inline constexpr uint_least32_t operator|(Privilege a, Privilege b)
- {
- return static_cast<uint_least32_t>(a) | static_cast<uint_least32_t>(b);
- }
- inline constexpr uint_least32_t operator|(uint_least32_t a, Privilege b)
- {
- return a | static_cast<uint_least32_t>(b);
- }
- inline constexpr uint_least32_t operator&(Privilege a, Privilege b)
- {
- return static_cast<uint_least32_t>(a) & static_cast<uint_least32_t>(b);
- }
- inline constexpr uint_least32_t operator&(uint_least32_t a, Privilege b)
- {
- return a & static_cast<uint_least32_t>(b);
- }
- inline uint_least32_t& operator|=(uint_least32_t& a, Privilege b)
- {
- return a |= static_cast<uint_least32_t>(b);
- }
- inline constexpr uint_least32_t operator~(Privilege p)
- {
- return ~static_cast<uint_least32_t>(p);
- }
- }
- }
- #endif
|