summaryrefslogtreecommitdiff
path: root/src/hashcomp.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-17 14:08:03 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-17 14:08:03 +0000
commit0e21e5b642562b199fb53b4f8302596ee592caa0 (patch)
tree340bb1fc98d544896028d6d2931af90974b70bca /src/hashcomp.cpp
parent3a7dd5b129450b94e0a87b8ad5009da70905b8e5 (diff)
Turn irc::commasepstream into a base class, irc::sepstream, inherit two classes from it: irc::commasepstream and irc::spacesepstream, to be used for the most common token seperators "," and " "
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5266 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/hashcomp.cpp')
-rw-r--r--src/hashcomp.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index 8d19d059a..33dcea307 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -248,24 +248,24 @@ const std::string irc::tokenstream::GetToken()
return "";
}
-irc::commasepstream::commasepstream(const std::string &source) : tokens(source)
+irc::sepstream::sepstream(const std::string &source, char seperator) : tokens(source), sep(seperator)
{
last_starting_position = tokens.begin();
n = tokens.begin();
}
-const std::string irc::commasepstream::GetToken()
+const std::string irc::sepstream::GetToken()
{
std::string::iterator lsp = last_starting_position;
while (n != tokens.end())
{
- if ((*n == ',') || (n+1 == tokens.end()))
+ if ((*n == sep) || (n+1 == tokens.end()))
{
last_starting_position = n+1;
std::string strip = std::string(lsp, n+1 == tokens.end() ? n+1 : n++);
- while ((strip.length()) && (strip.find_last_of(',') == strip.length() - 1))
+ while ((strip.length()) && (strip.find_last_of(sep) == strip.length() - 1))
strip.erase(strip.end() - 1);
return strip;
@@ -277,7 +277,7 @@ const std::string irc::commasepstream::GetToken()
return "";
}
-irc::commasepstream::~commasepstream()
+irc::sepstream::~sepstream()
{
}