1 | // |
---|
2 | // Lol Engine |
---|
3 | // |
---|
4 | // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> |
---|
5 | // This program is free software; you can redistribute it and/or |
---|
6 | // modify it under the terms of the Do What The Fuck You Want To |
---|
7 | // Public License, Version 2, as published by Sam Hocevar. See |
---|
8 | // http://sam.zoy.org/projects/COPYING.WTFPL for more details. |
---|
9 | // |
---|
10 | |
---|
11 | // |
---|
12 | // The Hash class |
---|
13 | // -------------- |
---|
14 | // A very simple Hash class. |
---|
15 | // |
---|
16 | |
---|
17 | #if !defined __LOL_CORE_HASH_H__ |
---|
18 | #define __LOL_CORE_HASH_H__ |
---|
19 | |
---|
20 | namespace lol |
---|
21 | { |
---|
22 | |
---|
23 | template<typename T> class Hash; |
---|
24 | |
---|
25 | template<> class Hash<int8_t> { public: uint32_t operator()(int8_t); }; |
---|
26 | template<> class Hash<uint8_t> { public: uint32_t operator()(uint8_t); }; |
---|
27 | template<> class Hash<int16_t> { public: uint32_t operator()(int16_t); }; |
---|
28 | template<> class Hash<uint16_t> { public: uint32_t operator()(uint16_t); }; |
---|
29 | template<> class Hash<int32_t> { public: uint32_t operator()(int32_t); }; |
---|
30 | template<> class Hash<uint32_t> { public: uint32_t operator()(uint32_t); }; |
---|
31 | template<> class Hash<int64_t> { public: uint32_t operator()(int64_t); }; |
---|
32 | template<> class Hash<uint64_t> { public: uint32_t operator()(uint64_t); }; |
---|
33 | |
---|
34 | template<> class Hash<half> { public: uint32_t operator()(half); }; |
---|
35 | template<> class Hash<float> { public: uint32_t operator()(float); }; |
---|
36 | template<> class Hash<double> { public: uint32_t operator()(double); }; |
---|
37 | template<> class Hash<ldouble> { public: uint32_t operator()(ldouble); }; |
---|
38 | |
---|
39 | template<> class Hash<char const *> |
---|
40 | { |
---|
41 | public: |
---|
42 | uint32_t operator()(char const *x); |
---|
43 | }; |
---|
44 | |
---|
45 | template<> class Hash<String> |
---|
46 | { |
---|
47 | public: |
---|
48 | uint32_t operator()(String const &s); |
---|
49 | }; |
---|
50 | |
---|
51 | } /* namespace lol */ |
---|
52 | |
---|
53 | #endif // __LOL_CORE_HASH_H__ |
---|
54 | |
---|