diff options
Diffstat (limited to 'src/unstable/uuid.h')
-rw-r--r-- | src/unstable/uuid.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/unstable/uuid.h b/src/unstable/uuid.h new file mode 100644 index 0000000..261f653 --- /dev/null +++ b/src/unstable/uuid.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
8 | #ifndef BU_UUID_H | ||
9 | #define BU_UUID_H | ||
10 | |||
11 | #include "bu/string.h" | ||
12 | |||
13 | namespace Bu | ||
14 | { | ||
15 | class Uuid | ||
16 | { | ||
17 | public: | ||
18 | Uuid(); | ||
19 | Uuid( const Uuid &src ); | ||
20 | Uuid( const Bu::String &sSrc ); | ||
21 | virtual ~Uuid(); | ||
22 | |||
23 | Bu::String toRawString() const; | ||
24 | Bu::String toString() const; | ||
25 | Bu::String toUrn() const; | ||
26 | |||
27 | int getVersion(); | ||
28 | |||
29 | static Uuid gen(); | ||
30 | static Uuid genV1(); | ||
31 | static Uuid genV2(); | ||
32 | static Uuid genV3(); | ||
33 | static Uuid genV4(); | ||
34 | static Uuid genV5(); | ||
35 | |||
36 | void clear(); | ||
37 | |||
38 | bool operator==( const Uuid &rhs ) const; | ||
39 | |||
40 | private: | ||
41 | void set( const Bu::String &sSrc ); | ||
42 | unsigned char data[16]; | ||
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 ); | ||
54 | }; | ||
55 | |||
56 | #endif | ||