diff options
Diffstat (limited to '')
-rw-r--r-- | src/uuid.cpp | 15 | ||||
-rw-r--r-- | src/uuid.h | 12 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/uuid.cpp b/src/uuid.cpp index bcaf377..088450b 100644 --- a/src/uuid.cpp +++ b/src/uuid.cpp | |||
@@ -100,3 +100,18 @@ void Bu::Uuid::set( const Bu::String &sSrc ) | |||
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | bool Bu::Uuid::operator==( const Uuid &rhs ) const | ||
104 | { | ||
105 | return memcmp( data, rhs.data, 16 ) == 0; | ||
106 | } | ||
107 | |||
108 | template<> uint32_t Bu::__calcHashCode<Bu::Uuid>( const Bu::Uuid &k ) | ||
109 | { | ||
110 | return __calcHashCode<String>( k.toRawString() ); | ||
111 | } | ||
112 | |||
113 | template<> bool Bu::__cmpHashKeys<Bu::Uuid>( const Bu::Uuid &a, const Bu::Uuid &b ) | ||
114 | { | ||
115 | return a == b; | ||
116 | } | ||
117 | |||
@@ -35,10 +35,22 @@ namespace Bu | |||
35 | 35 | ||
36 | void clear(); | 36 | void clear(); |
37 | 37 | ||
38 | bool operator==( const Uuid &rhs ) const; | ||
39 | |||
38 | private: | 40 | private: |
39 | void set( const Bu::String &sSrc ); | 41 | void set( const Bu::String &sSrc ); |
40 | unsigned char data[16]; | 42 | unsigned char data[16]; |
41 | }; | 43 | }; |
44 | |||
45 | template<typename T> | ||
46 | uint32_t __calcHashCode( const T &k ); | ||
47 | |||
48 | template<typename T> | ||
49 | bool __cmpHashKeys( const T &a, const T &b ); | ||
50 | |||
51 | template<> uint32_t __calcHashCode<Uuid>( const Uuid &k ); | ||
52 | template<> bool __cmpHashKeys<Uuid>( | ||
53 | const Uuid &a, const Uuid &b ); | ||
42 | }; | 54 | }; |
43 | 55 | ||
44 | #endif | 56 | #endif |