The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download | Blog | Stats
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

irc::stringjoiner Class Reference

irc::stringjoiner joins string lists into a string, using the given seperator string. More...

#include <hashcomp.h>

Collaboration diagram for irc::stringjoiner:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 stringjoiner (const std::string &seperator, const std::vector< std::string > &sequence, int begin, int end)
 Join elements of a vector, between (and including) begin and end.
 stringjoiner (const std::string &seperator, const std::deque< std::string > &sequence, int begin, int end)
 Join elements of a deque, between (and including) begin and end.
 stringjoiner (const std::string &seperator, const char **sequence, int begin, int end)
 Join elements of an array of char arrays, between (and including) begin and end.
std::stringGetJoined ()
 Get the joined sequence.

Private Attributes

std::string joined
 Output string.

Detailed Description

irc::stringjoiner joins string lists into a string, using the given seperator string.

This class can join a vector of std::string, a deque of std::string, or a const char** array, using overloaded constructors.

Definition at line 144 of file hashcomp.h.


Constructor & Destructor Documentation

irc::stringjoiner::stringjoiner const std::string seperator,
const std::vector< std::string > &  sequence,
int  begin,
int  end
 

Join elements of a vector, between (and including) begin and end.

Parameters:
seperator The string to seperate values with
sequence One or more items to seperate
begin The starting element in the sequence to be joined
end The ending element in the sequence to be joined

Definition at line 385 of file hashcomp.cpp.

References joined.

00386 {
00387         for (int v = begin; v < end; v++)
00388                 joined.append(sequence[v]).append(seperator);
00389         joined.append(sequence[end]);
00390 }

irc::stringjoiner::stringjoiner const std::string seperator,
const std::deque< std::string > &  sequence,
int  begin,
int  end
 

Join elements of a deque, between (and including) begin and end.

Parameters:
seperator The string to seperate values with
sequence One or more items to seperate
begin The starting element in the sequence to be joined
end The ending element in the sequence to be joined

Definition at line 392 of file hashcomp.cpp.

References joined.

00393 {
00394         for (int v = begin; v < end; v++)
00395                 joined.append(sequence[v]).append(seperator);
00396         joined.append(sequence[end]);
00397 }

irc::stringjoiner::stringjoiner const std::string seperator,
const char **  sequence,
int  begin,
int  end
 

Join elements of an array of char arrays, between (and including) begin and end.

Parameters:
seperator The string to seperate values with
sequence One or more items to seperate
begin The starting element in the sequence to be joined
end The ending element in the sequence to be joined

Definition at line 399 of file hashcomp.cpp.

References joined.

00400 {
00401         for (int v = begin; v < end; v++)
00402                 joined.append(sequence[v]).append(seperator);
00403         joined.append(sequence[end]);
00404 }


Member Function Documentation

std::string & irc::stringjoiner::GetJoined  ) 
 

Get the joined sequence.

Returns:
A reference to the joined string

Definition at line 406 of file hashcomp.cpp.

References joined.

Referenced by ListModeBase::DoSyncChannel(), cmd_saquit::Handle(), RemoveBase::Handle(), and ModuleChanProtect::OnSyncChannel().

00407 {
00408         return joined;
00409 }


Member Data Documentation

std::string irc::stringjoiner::joined [private]
 

Output string.

Definition at line 149 of file hashcomp.h.

Referenced by GetJoined(), and stringjoiner().


The documentation for this class was generated from the following files: