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 irc::tokenstream

Public Member Functions

 sepstream (const std::string &source, char separator, bool allowempty=false)
 
bool GetToken (std::string &token)
 
const std::string GetRemaining ()
 
bool StreamEnd ()
 

Protected Attributes

std::string tokens
 
char sep
 
size_t pos
 
bool allow_empty
 

Detailed Description

irc::sepstream allows for splitting token seperated 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

◆ 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: