InspIRCd  3.0
Public Member Functions | Protected Attributes | List of all members
irc::sepstream Class Reference

#include <hashcomp.h>

Inheritance diagram for irc::sepstream:
irc::commasepstream irc::spacesepstream

Public Member Functions

 sepstream (const std::string &source, char separator, bool allowempty=false)
 
bool GetToken (std::string &token)
 
template<typename Numeric >
bool GetNumericToken (Numeric &token)
 
const std::string GetRemaining ()
 
bool StreamEnd ()
 
bool Contains (const std::string &value)
 

Protected Attributes

std::string tokens
 
char sep
 
size_t pos
 
bool allow_empty
 

Detailed Description

irc::sepstream allows for splitting token separated lists. Each successive call to sepstream::GetToken() returns the next token, until none remain, at which point the method returns false.

Constructor & Destructor Documentation

◆ sepstream()

irc::sepstream::sepstream ( const std::string &  source,
char  separator,
bool  allowempty = false 
)

Create a sepstream and fill it with the provided data

Member Function Documentation

◆ Contains()

bool irc::sepstream::Contains ( const std::string &  value)

Returns true if the specified value exists in the stream

Parameters
valueThe value to search for
Returns
True if the value was found, False otherwise

◆ GetNumericToken()

template<typename Numeric >
bool irc::sepstream::GetNumericToken ( Numeric &  token)
inline

Fetch the next numeric token from the stream

Parameters
tokenThe next token from the stream is placed here
Returns
True if tokens still remain, false if there are none left

◆ GetRemaining()

const std::string irc::sepstream::GetRemaining ( )

Fetch the entire remaining stream, without tokenizing

Returns
The remaining part of the stream

◆ GetToken()

bool irc::sepstream::GetToken ( std::string &  token)

Fetch the next token from the stream

Parameters
tokenThe next token from the stream is placed here
Returns
True if tokens still remain, false if there are none left

◆ StreamEnd()

bool irc::sepstream::StreamEnd ( )

Returns true if the end of the stream has been reached

Returns
True if the end of the stream has been reached, otherwise false

Member Data Documentation

◆ allow_empty

bool irc::sepstream::allow_empty
protected

If set then GetToken() can return an empty string

◆ pos

size_t irc::sepstream::pos
protected

Current string position

◆ sep

char irc::sepstream::sep
protected

Separator value

◆ tokens

std::string irc::sepstream::tokens
protected

Original string.


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