* This avoids a copy to use hash<const char*>
*/
register size_t t = 0;
- for (std::string::const_iterator x = s.begin(); x != s.end(); x++) /* ++x not x++, so we don't hash the \0 */
+ for (std::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */
t = 5 * t + lowermap[(unsigned char)*x];
- return size_t(t);
+ return t;
}
bool irc::StrHashComp::operator()(const std::string& s1, const std::string& s2) const
while (n != tokens.end())
{
+ /** Skip multi space, converting " " into " "
+ */
+ while ((n+1 != tokens.end()) && (*n == ' ') && (*(n+1) == ' '))
+ n++;
+
if ((last_pushed) && (*n == ':'))
{
/* If we find a token thats not the first and starts with :,
return n;
}
+
+irc::stringjoiner::stringjoiner(const std::string &seperator, const std::vector<std::string> &sequence, int begin, int end)
+{
+ for (int v = begin; v < end; v++)
+ joined.append(sequence[v]).append(seperator);
+ joined.append(sequence[end]);
+}
+
+irc::stringjoiner::stringjoiner(const std::string &seperator, const std::deque<std::string> &sequence, int begin, int end)
+{
+ for (int v = begin; v < end; v++)
+ joined.append(sequence[v]).append(seperator);
+ joined.append(sequence[end]);
+}
+
+irc::stringjoiner::stringjoiner(const std::string &seperator, const char** sequence, int begin, int end)
+{
+ for (int v = begin; v < end; v++)
+ joined.append(sequence[v]).append(seperator);
+ joined.append(sequence[end]);
+}
+
+std::string& irc::stringjoiner::GetJoined()
+{
+ return joined;
+}
+