diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/hashcomp.h | 12 | ||||
-rw-r--r-- | include/inspircd.h | 2 | ||||
-rw-r--r-- | include/typedefs.h | 23 |
3 files changed, 21 insertions, 16 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h index e93875e3e..777c4fe0e 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -688,6 +688,7 @@ BEGIN_HASHMAP_NAMESPACE size_t operator()(const std::string & s) const; }; #else + template<> struct hash<irc::string> { /** Hash an irc::string using RFC1459 case sensitivity rules @@ -697,14 +698,17 @@ BEGIN_HASHMAP_NAMESPACE size_t operator()(const irc::string &s) const; }; + /* XXX FIXME: Implement a hash function overriding std::string's that works with TR1! */ + +#ifdef HASHMAP_DEPRECATED + struct insensitive +#else template<> struct hash<std::string> +#endif { - /** Hash a std::string using RFC1459 case sensitivity rules - * @param s A string to hash - * @return The hash value - */ size_t operator()(const std::string &s) const; }; + #endif /** Convert a string to lower case respecting RFC1459 diff --git a/include/inspircd.h b/include/inspircd.h index 9d7c8e6e1..e1048f114 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -34,6 +34,8 @@ // Required system headers. #include <time.h> #include <stdarg.h> +#include <algorithm> +#include <cmath> #include "inspircd_config.h" #include "uid.h" diff --git a/include/typedefs.h b/include/typedefs.h index d80e578de..5caebf0f1 100644 --- a/include/typedefs.h +++ b/include/typedefs.h @@ -15,19 +15,18 @@ #define __TYPEDEF_H__ #ifndef WIN32 -/** User hash (POSIX systems with GCC) - */ -typedef nspace::hash_map<std::string, User*, nspace::hash<std::string>, irc::StrHashComp> user_hash; -/** Channel hash (POSIX systems with GCC) - */ -typedef nspace::hash_map<std::string, Channel*, nspace::hash<std::string>, irc::StrHashComp> chan_hash; + + #ifdef HASHMAP_DEPRECATED + typedef nspace::hash_map<std::string, User*, nspace::insensitive, irc::StrHashComp> user_hash; + typedef nspace::hash_map<std::string, Channel*, nspace::insensitive, irc::StrHashComp> chan_hash; + #else + typedef nspace::hash_map<std::string, User*, nspace::hash<std::string>, irc::StrHashComp> user_hash; + typedef nspace::hash_map<std::string, Channel*, nspace::hash<std::string>, irc::StrHashComp> chan_hash; + #endif #else -/** User hash (windows systems with visual studio) - */ -typedef nspace::hash_map<std::string, User*, nspace::hash_compare<std::string, std::less<std::string> > > user_hash; -/** Channel hash (windows systems with visual studio) - */ -typedef nspace::hash_map<std::string, Channel*, nspace::hash_compare<std::string, std::less<std::string> > > chan_hash; + + typedef nspace::hash_map<std::string, User*, nspace::hash_compare<std::string, std::less<std::string> > > user_hash; + typedef nspace::hash_map<std::string, Channel*, nspace::hash_compare<std::string, std::less<std::string> > > chan_hash; #endif /** Server name cache |