diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
commit | ac517a2b7625e0aa0862679e961c6349f859ea3b (patch) | |
tree | e3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/hash.cpp | |
parent | f8d4301e9fa4f3709258505941e37fab2eadadc6 (diff) | |
parent | bd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff) | |
download | libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2 libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip |
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to '')
-rw-r--r-- | src/hash.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/src/hash.cpp b/src/hash.cpp index c52e6b1..a207c29 100644 --- a/src/hash.cpp +++ b/src/hash.cpp | |||
@@ -1,29 +1,29 @@ | |||
1 | #include "hash.h" | 1 | #include "hash.h" |
2 | 2 | ||
3 | subExceptionDef( HashException ) | 3 | namespace Bu { subExceptionDef( HashException ) } |
4 | 4 | ||
5 | template<> uint32_t __calcHashCode<int>( const int &k ) | 5 | template<> uint32_t Bu::__calcHashCode<int>( const int &k ) |
6 | { | 6 | { |
7 | return k; | 7 | return k; |
8 | } | 8 | } |
9 | 9 | ||
10 | template<> bool __cmpHashKeys<int>( const int &a, const int &b ) | 10 | template<> bool Bu::__cmpHashKeys<int>( const int &a, const int &b ) |
11 | { | 11 | { |
12 | return a == b; | 12 | return a == b; |
13 | } | 13 | } |
14 | 14 | ||
15 | template<> uint32_t __calcHashCode<unsigned int>( const unsigned int &k ) | 15 | template<> uint32_t Bu::__calcHashCode<unsigned int>( const unsigned int &k ) |
16 | { | 16 | { |
17 | return k; | 17 | return k; |
18 | } | 18 | } |
19 | 19 | ||
20 | template<> bool __cmpHashKeys<unsigned int>( const unsigned int &a, const unsigned int &b ) | 20 | template<> bool Bu::__cmpHashKeys<unsigned int>( const unsigned int &a, const unsigned int &b ) |
21 | { | 21 | { |
22 | return a == b; | 22 | return a == b; |
23 | } | 23 | } |
24 | 24 | ||
25 | template<> | 25 | template<> |
26 | uint32_t __calcHashCode<const char *>( const char * const &k ) | 26 | uint32_t Bu::__calcHashCode<const char *>( const char * const &k ) |
27 | { | 27 | { |
28 | if (k == NULL) | 28 | if (k == NULL) |
29 | { | 29 | { |
@@ -39,7 +39,7 @@ uint32_t __calcHashCode<const char *>( const char * const &k ) | |||
39 | return nPos; | 39 | return nPos; |
40 | } | 40 | } |
41 | 41 | ||
42 | template<> bool __cmpHashKeys<const char *>( const char * const &a, const char * const &b ) | 42 | template<> bool Bu::__cmpHashKeys<const char *>( const char * const &a, const char * const &b ) |
43 | { | 43 | { |
44 | if( a == b ) | 44 | if( a == b ) |
45 | return true; | 45 | return true; |
@@ -52,7 +52,7 @@ template<> bool __cmpHashKeys<const char *>( const char * const &a, const char * | |||
52 | } | 52 | } |
53 | 53 | ||
54 | template<> | 54 | template<> |
55 | uint32_t __calcHashCode<char *>( char * const &k ) | 55 | uint32_t Bu::__calcHashCode<char *>( char * const &k ) |
56 | { | 56 | { |
57 | if (k == NULL) | 57 | if (k == NULL) |
58 | { | 58 | { |
@@ -68,7 +68,7 @@ uint32_t __calcHashCode<char *>( char * const &k ) | |||
68 | return nPos; | 68 | return nPos; |
69 | } | 69 | } |
70 | 70 | ||
71 | template<> bool __cmpHashKeys<char *>( char * const &a, char * const &b ) | 71 | template<> bool Bu::__cmpHashKeys<char *>( char * const &a, char * const &b ) |
72 | { | 72 | { |
73 | if( a == b ) | 73 | if( a == b ) |
74 | return true; | 74 | return true; |
@@ -80,7 +80,7 @@ template<> bool __cmpHashKeys<char *>( char * const &a, char * const &b ) | |||
80 | return false; | 80 | return false; |
81 | } | 81 | } |
82 | 82 | ||
83 | template<> uint32_t __calcHashCode<std::string>( const std::string &k ) | 83 | template<> uint32_t Bu::__calcHashCode<std::string>( const std::string &k ) |
84 | { | 84 | { |
85 | std::string::size_type j, sz = k.size(); | 85 | std::string::size_type j, sz = k.size(); |
86 | const char *s = k.c_str(); | 86 | const char *s = k.c_str(); |
@@ -94,20 +94,8 @@ template<> uint32_t __calcHashCode<std::string>( const std::string &k ) | |||
94 | return nPos; | 94 | return nPos; |
95 | } | 95 | } |
96 | 96 | ||
97 | template<> bool __cmpHashKeys<std::string>( const std::string &a, const std::string &b ) | 97 | template<> bool Bu::__cmpHashKeys<std::string>( const std::string &a, const std::string &b ) |
98 | { | 98 | { |
99 | return a == b; | 99 | return a == b; |
100 | } | 100 | } |
101 | 101 | ||
102 | template<> uint32_t __calcHashCode<Hashable>( const Hashable &k ) | ||
103 | { | ||
104 | return 0; | ||
105 | //return k.getHashCode(); | ||
106 | } | ||
107 | |||
108 | template<> bool __cmpHashKeys<Hashable>( const Hashable &a, const Hashable &b ) | ||
109 | { | ||
110 | return false; | ||
111 | //return a.compareForHash( b ); | ||
112 | } | ||
113 | |||