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)
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 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

◆ Contains()

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

Returns true if the specified value exists in the stream

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

◆ GetRemaining()

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

Fetch the entire remaining stream, without tokenizing

The remaining part of the stream

◆ GetToken()

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

Fetch the next token from the stream

tokenThe next token from the stream is placed here
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

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

Member Data Documentation

◆ allow_empty

bool irc::sepstream::allow_empty

If set then GetToken() can return an empty string

◆ pos

size_t irc::sepstream::pos

Current string position

◆ sep

char irc::sepstream::sep

Separator value

◆ tokens

std::string irc::sepstream::tokens

Original string.

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