From 0e21e5b642562b199fb53b4f8302596ee592caa0 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 17 Sep 2006 14:08:03 +0000 Subject: 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 --- include/hashcomp.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'include/hashcomp.h') diff --git a/include/hashcomp.h b/include/hashcomp.h index 0a39deb1f..69fa677b8 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -161,22 +161,39 @@ namespace irc * the next token, until none remain, at which point the method returns * an empty string. */ - class commasepstream + class sepstream : public classbase { private: std::string tokens; std::string::iterator last_starting_position; std::string::iterator n; + char sep; public: /** Create a commasepstream and fill it with the provided data */ - commasepstream(const std::string &source); - ~commasepstream(); + sepstream(const std::string &source, char seperator); + virtual ~sepstream(); /** Fetch the next token from the stream * @returns The next token is returned, or an empty string if none remain */ - const std::string GetToken(); + virtual const std::string GetToken(); + }; + + class commasepstream : public sepstream + { + public: + commasepstream(const std::string &source) : sepstream(source, ',') + { + } + }; + + class spacesepstream : public sepstream + { + public: + spacesepstream(const std::string &source) : sepstream(source, ' ') + { + } }; -- cgit v1.2.3