diff options
Diffstat (limited to '')
| -rw-r--r-- | src/unstable/uuid.h | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/unstable/uuid.h b/src/unstable/uuid.h index bb3d608..ecc142d 100644 --- a/src/unstable/uuid.h +++ b/src/unstable/uuid.h | |||
| @@ -13,59 +13,59 @@ | |||
| 13 | 13 | ||
| 14 | namespace Bu | 14 | namespace Bu |
| 15 | { | 15 | { |
| 16 | class Uuid | 16 | class Uuid |
| 17 | { | 17 | { |
| 18 | friend Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, Uuid &u ); | 18 | friend Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, Uuid &u ); |
| 19 | friend Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const Uuid &u ); | 19 | friend Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const Uuid &u ); |
| 20 | public: | 20 | public: |
| 21 | Uuid(); | 21 | Uuid(); |
| 22 | Uuid( const Uuid &src ); | 22 | Uuid( const Uuid &src ); |
| 23 | Uuid( const Bu::String &sSrc ); | 23 | Uuid( const Bu::String &sSrc ); |
| 24 | virtual ~Uuid(); | 24 | virtual ~Uuid(); |
| 25 | 25 | ||
| 26 | Bu::String toRawString() const; | 26 | Bu::String toRawString() const; |
| 27 | Bu::String toString() const; | 27 | Bu::String toString() const; |
| 28 | Bu::String toUrn() const; | 28 | Bu::String toUrn() const; |
| 29 | 29 | ||
| 30 | enum Type | 30 | enum Type |
| 31 | { | 31 | { |
| 32 | System, | 32 | System, |
| 33 | Version1, | 33 | Version1, |
| 34 | Version2, | 34 | Version2, |
| 35 | Version3, | 35 | Version3, |
| 36 | Version4, | 36 | Version4, |
| 37 | Version5, | 37 | Version5, |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | int getVersion(); | 40 | int getVersion(); |
| 41 | 41 | ||
| 42 | static Uuid generate( Type eType = System ); | 42 | static Uuid generate( Type eType = System ); |
| 43 | DEPRECATED static Uuid gen() { return generate(); } | 43 | DEPRECATED static Uuid gen() { return generate(); } |
| 44 | 44 | ||
| 45 | void clear(); | 45 | void clear(); |
| 46 | void set( const Bu::String &sSrc ); | 46 | void set( const Bu::String &sSrc ); |
| 47 | 47 | ||
| 48 | bool operator==( const Uuid &rhs ) const; | 48 | bool operator==( const Uuid &rhs ) const; |
| 49 | bool operator!=( const Uuid &rhs ) const; | 49 | bool operator!=( const Uuid &rhs ) const; |
| 50 | Uuid &operator=( const Bu::String &rhs ) { set( rhs ); return *this; } | 50 | Uuid &operator=( const Bu::String &rhs ) { set( rhs ); return *this; } |
| 51 | Uuid &operator=( const Uuid &rhs ); | 51 | Uuid &operator=( const Uuid &rhs ); |
| 52 | 52 | ||
| 53 | private: | 53 | private: |
| 54 | unsigned char data[16]; | 54 | unsigned char data[16]; |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | template<typename T> | 57 | template<typename T> |
| 58 | uint32_t __calcHashCode( const T &k ); | 58 | uint32_t __calcHashCode( const T &k ); |
| 59 | 59 | ||
| 60 | template<typename T> | 60 | template<typename T> |
| 61 | bool __cmpHashKeys( const T &a, const T &b ); | 61 | bool __cmpHashKeys( const T &a, const T &b ); |
| 62 | 62 | ||
| 63 | template<> uint32_t __calcHashCode<Uuid>( const Uuid &k ); | 63 | template<> uint32_t __calcHashCode<Uuid>( const Uuid &k ); |
| 64 | template<> bool __cmpHashKeys<Uuid>( | 64 | template<> bool __cmpHashKeys<Uuid>( |
| 65 | const Uuid &a, const Uuid &b ); | 65 | const Uuid &a, const Uuid &b ); |
| 66 | 66 | ||
| 67 | Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, Uuid &u ); | 67 | Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, Uuid &u ); |
| 68 | Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const Uuid &u ); | 68 | Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const Uuid &u ); |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | #endif | 71 | #endif |
