Git init
[profile/ivi/isf.git] / ism / src / scim_stl_map.h
1 /** @file scim_stl_map.h
2  */
3
4 /*
5  * Smart Common Input Method
6  *
7  * Copyright (c) 2005 James Su <suzhe@tsinghua.org.cn>
8  *
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this program; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
23  * Boston, MA  02111-1307  USA
24  *
25  * $Id: scim_stl_map.h,v 1.1 2005/01/07 15:28:21 suzhe Exp $
26  */
27
28 #ifndef __SCIM_STL_MAP_H
29 #define __SCIM_STL_MAP_H
30
31 #if ENABLE_HASH_MAP
32  #if defined (HAVE_EXT_HASH_MAP)
33   #define SCIM_USE_STL_EXT_HASH_MAP 1
34   #include <ext/hash_map>
35  #elif defined (HAVE_HASH_MAP)
36   #define SCIM_USE_STL_HASH_MAP 1
37   #include <hash_map>
38  #endif
39 #endif
40
41 #if !defined (SCIM_USE_STL_HASH_MAP) && !defined (SCIM_USE_STL_EXT_HASH_MAP)
42 #define SCIM_USE_STL_MAP 1
43 #include <map>
44 #endif
45
46 namespace scim {
47
48 #if SCIM_USE_STL_EXT_HASH_MAP
49 class scim_hash_string {
50     __gnu_cxx::hash <const char *> _h;
51 public:
52     size_t operator ()(const String &str) const {
53         return _h (str.c_str ());
54     }
55 };
56 #elif SCIM_USE_STL_HASH_MAP
57 class scim_hash_string {
58     std::hash <const char *> _h;
59 public:
60     size_t operator ()(const String &str) const {
61         return _h (str.c_str ());
62     }
63 };
64 #endif
65
66 } // Namespace
67
68 #endif //__SCIM_STL_MAP_H
69
70 /*
71 vi:ts=4:nowrap:ai:expandtab
72 */