mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-23 08:11:24 -04:00
First shot of file sharing permissions. Compiles, but needs some testing/debugging.
- added type-safe flags in retroshare/rsflags.h. This should be used to make new flags types in order to prevent mixing flags up in function prototypes. - group handling is left to rsPeers. We'll move it to rsCircles later. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-FileSharingPermissions@5754 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
03d4936b12
commit
dc82cee700
27 changed files with 567 additions and 336 deletions
29
libretroshare/src/retroshare/rsflags.h
Normal file
29
libretroshare/src/retroshare/rsflags.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include <stdint.h>
|
||||
|
||||
template<int n> class t_RsFlags32
|
||||
{
|
||||
public:
|
||||
t_RsFlags32() {}
|
||||
|
||||
t_RsFlags32(uint32_t N) : _bits(N) {}
|
||||
operator uint32_t() const { return _bits ; }
|
||||
|
||||
t_RsFlags32<n> operator| (const t_RsFlags32<n>& f) const { return t_RsFlags32<n>(_bits | f._bits) ; }
|
||||
t_RsFlags32<n> operator^ (const t_RsFlags32<n>& f) const { return t_RsFlags32<n>(_bits ^ f._bits) ; }
|
||||
t_RsFlags32<n> operator& (const t_RsFlags32<n>& f) const { return t_RsFlags32<n>(_bits & f._bits) ; }
|
||||
|
||||
t_RsFlags32<n> operator|=(const t_RsFlags32<n>& f) { _bits |= f._bits ; return *this ;}
|
||||
t_RsFlags32<n> operator^=(const t_RsFlags32<n>& f) { _bits ^= f._bits ; return *this ;}
|
||||
t_RsFlags32<n> operator&=(const t_RsFlags32<n>& f) { _bits &= f._bits ; return *this ;}
|
||||
|
||||
t_RsFlags32<n> operator~() const { return t_RsFlags32<n>(~_bits) ; }
|
||||
private:
|
||||
uint32_t _bits ;
|
||||
};
|
||||
|
||||
#define TRANSFER_INFO_FLAGS_TAG 0x8133ea
|
||||
#define FILE_STORAGE_FLAGS_TAG 0x184738
|
||||
|
||||
typedef t_RsFlags32<TRANSFER_INFO_FLAGS_TAG> TransferInfoFlags ;
|
||||
typedef t_RsFlags32<FILE_STORAGE_FLAGS_TAG > FileStorageFlags ; // this makes it a uint32_t class incompatible with other flag class
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue