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 --- src/hashcomp.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/hashcomp.cpp') diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 2acd59f91..0908e41b5 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -354,3 +354,30 @@ int irc::modestacker::GetStackedLine(std::deque &result) return n; } + +irc::stringjoiner::stringjoiner(const std::string &seperator, const std::vector &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 &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; +} + -- cgit v1.2.3