resource loading bugs and new sound class
[chaz/yoink] / src / moof / hash.hh
1
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
4 *
5 * vi:ts=4 sw=4 tw=75
6 *
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
9 *
10 **************************************************************************/
11
12 #ifndef _MOOF_HASH_HH_
13 #define _MOOF_HASH_HH_
14
15 /**
16 * \file hash.hh
17 * Hash tables and functions.
18 */
19
20 #include <string>
21
22 #include <stlplus/containers/hash.hpp>
23
24
25 namespace moof {
26
27
28 using stlplus::hash;
29
30
31 struct hash_function
32 {
33 // generic hash function
34 unsigned operator () (const void* key, int len,
35 unsigned seed = -1) const;
36
37 unsigned operator () (const std::string& val) const
38 {
39 return (*this)(val.data(), val.length());
40 }
41
42 template <class T>
43 unsigned operator () (T val) const
44 {
45 return static_cast<unsigned>(val);
46 }
47 };
48
49
50 } // namespace moof
51
52 #endif // _MOOF_HASH_HH_
53
This page took 0.031111 seconds and 4 git commands to generate.