Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

string_hash_map.h

00001 /*
00002   libwftk - Worldforge Toolkit - a widget library
00003   Copyright (C) 2002 Malcolm Walker <malcolm@worldforge.org>
00004   Based on code copyright  (C) 1999-2002  Karsten Laux 
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Library General Public
00008   License as published by the Free Software Foundation; either
00009   version 2 of the License, or (at your option) any later version.
00010   
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Library General Public License for more details.
00015   
00016   You should have received a copy of the GNU Library General Public
00017   License along with this library; if not, write to the
00018   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019   Boston, MA  02111-1307, SA.
00020 */
00021 
00022 
00023 #ifndef _STRING_HASH_MAP_H
00024 #define _STRING_HASH_MAP_H
00025 
00026 #if __GNUC__ > 2 
00027 #include <ext/hash_map>
00028 #else
00029 #include <hash_map>
00030 #endif
00031 #include <string>
00032 
00033 namespace wftk {
00034 
00036 template<class C>
00037 struct StringHash
00038 {
00040   size_t operator () (const std::string& s) const {return hash_(s.c_str());}
00041 
00043   typedef typename __gnu_cxx::hash_map<std::string, C, StringHash> Map;
00044 
00045  private:
00046   __gnu_cxx::hash<const char*> hash_;
00047 };
00048 
00049 } // namespace
00050 
00051 #endif

Generated Fri Mar 5 08:11:00 2004.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.