diff options
Diffstat (limited to 'src/hashcomp.cpp')
-rw-r--r-- | src/hashcomp.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 5e6d2c077..34f53ea28 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -219,3 +219,31 @@ const std::string irc::tokenstream::GetToken() } return ""; } + +irc::commasepstream::commasepstream(const std::string &source) : tokens(source) +{ + last_starting_position = tokens.begin(); + n = tokens.begin(); +} + +const std::string irc::commasepstream::GetToken() +{ + std::string::iterator lsp = last_starting_position; + + while (n != tokens.end()) + { + if ((*n == ',') || (n+1 == tokens.end())) + { + last_starting_position = n+1; + return std::string(lsp, n+1 == tokens.end() ? n+1 : n++); + } + + n++; + } + + return ""; +} + +irc::commasepstream::~commasepstream() +{ +} |