From 9716d24be9e3e567308f6d144a65eeaccd65484a Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 3 Oct 2006 13:46:28 +0000 Subject: New helper class irc::stringjoiner - it pwns you. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5403 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/hashcomp.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'include') diff --git a/include/hashcomp.h b/include/hashcomp.h index f4b690caf..a99b5e76b 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -123,6 +123,29 @@ namespace irc bool operator()(const insp_inaddr &s1, const insp_inaddr &s2) const; }; + /** irc::stringjoiner joins string lists into a string, using + * the given seperator string. + */ + class stringjoiner + { + private: + std::string joined; + public: + /** Join elements of a vector, between (and including) begin and end + */ + stringjoiner(const std::string &seperator, const std::vector &sequence, int begin, int end); + /** Join elements of a deque, between (and including) begin and end + */ + stringjoiner(const std::string &seperator, const std::deque &sequence, int begin, int end); + /** Join elements of an array of char arrays, between (and including) begin and end + */ + stringjoiner(const std::string &seperator, const char** sequence, int begin, int end); + + /** Get the joined sequence + */ + std::string& GetJoined(); + }; + /** irc::modestacker stacks mode sequences into a list. * It can then reproduce this list, clamped to a maximum of MAXMODES * values per line. -- cgit v1.2.3