}
}
-#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
- size_t nspace::hash_compare<std::string, std::less<std::string> >::operator()(const std::string &s) const
+#ifdef HASHMAP_DEPRECATED
+ size_t CoreExport nspace::insensitive::operator()(const std::string &s) const
#else
- #ifdef HASHMAP_DEPRECATED
- size_t CoreExport nspace::insensitive::operator()(const std::string &s) const
- #else
- size_t nspace::hash<std::string>::operator()(const std::string &s) const
- #endif
+ size_t nspace::hash<std::string>::operator()(const std::string &s) const
#endif
+
{
/* XXX: NO DATA COPIES! :)
* The hash function here is practically
* only with *x replaced with national_case_insensitive_map[*x].
* This avoids a copy to use hash<const char*>
*/
- register size_t t = 0;
+ size_t t = 0;
for (std::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */
t = 5 * t + national_case_insensitive_map[(unsigned char)*x];
return t;
}
-#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
- size_t nspace::hash_compare<irc::string, std::less<irc::string> >::operator()(const irc::string &s) const
-#else
- size_t CoreExport irc::hash::operator()(const irc::string &s) const
-#endif
+size_t CoreExport irc::hash::operator()(const irc::string &s) const
{
- register size_t t = 0;
+ size_t t = 0;
for (irc::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */
t = 5 * t + national_case_insensitive_map[(unsigned char)*x];
return t;
n++;
}
- token = "";
+ token.clear();
return false;
}
return joined;
}
-irc::portparser::portparser(const std::string &source, bool allow_overlapped) : in_range(0), range_begin(0), range_end(0), overlapped(allow_overlapped)
-{
- sep = new irc::commasepstream(source);
-}
-
-irc::portparser::~portparser()
+irc::portparser::portparser(const std::string &source, bool allow_overlapped)
+ : sep(source), in_range(0), range_begin(0), range_end(0), overlapped(allow_overlapped)
{
- delete sep;
}
bool irc::portparser::Overlaps(long val)
{
- if (!overlapped)
+ if (overlapped)
return false;
return (!overlap_set.insert(val).second);
}
std::string x;
- sep->GetToken(x);
+ sep.GetToken(x);
if (x.empty())
return 0;
while (Overlaps(atoi(x.c_str())))
{
- if (!sep->GetToken(x))
+ if (!sep.GetToken(x))
return 0;
}