Public Member Functions | Private Attributes

sepstream Class Reference

#include <anope.h>

Inherited by commasepstream, and spacesepstream.

Collaboration diagram for sepstream:
Collaboration graph
[legend]

Public Member Functions

 sepstream (const Anope::string &source, char seperator)
bool GetToken (Anope::string &token)
bool GetToken (Anope::string &token, int num)
template<typename T >
void GetTokens (T &token)
bool GetTokenRemainder (Anope::string &token, int num)
int NumTokens ()
const Anope::string GetRemaining ()
bool StreamEnd ()

Private Attributes

Anope::string tokens
Anope::string::iterator last_starting_position
Anope::string::iterator n
char sep

Detailed Description

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 an empty string.

Definition at line 544 of file anope.h.


Constructor & Destructor Documentation

sepstream::sepstream ( const Anope::string source,
char  seperator 
)

Create a sepstream and fill it with the provided data

Definition at line 77 of file hashcomp.cpp.

References Anope::string::begin(), last_starting_position, n, and tokens.


Member Function Documentation

const Anope::string sepstream::GetRemaining (  ) 

Fetch the entire remaining stream, without tokenizing

Returns:
The remaining part of the stream

Definition at line 136 of file hashcomp.cpp.

References Anope::string::end(), n, and tokens.

Referenced by CommandOSAKill::DoAdd(), GetTokenRemainder(), CommandOSSNLine::OnAdd(), Anope::Process(), MyHTTPClient::Read(), and ReadDatabase().

bool sepstream::GetToken ( Anope::string token,
int  num 
)

Gets token number 'num' from the stream

Parameters:
token The token is placed here
num The token number to featch
Returns:
True if the token was able to be detched

Definition at line 108 of file hashcomp.cpp.

References GetToken().

bool sepstream::GetToken ( Anope::string token  ) 
bool sepstream::GetTokenRemainder ( Anope::string token,
int  num 
)

Gets token number 'num' from the stream and all remaining tokens.

Parameters:
token The token is placed here
num The token number to featch
Returns:
True if the token was able to be detched

Definition at line 123 of file hashcomp.cpp.

References GetRemaining(), GetToken(), sep, and StreamEnd().

template<typename T >
void sepstream::GetTokens ( T &  token  )  [inline]

Gets every token from this stream

Parameters:
token Tokens are pushed back here

Definition at line 580 of file anope.h.

int sepstream::NumTokens (  ) 

Determines the number of tokens in this stream.

Returns:
The number of tokens in this stream

Definition at line 115 of file hashcomp.cpp.

References GetToken().

bool 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

Definition at line 141 of file hashcomp.cpp.

References Anope::string::end(), n, and tokens.

Referenced by CommandOSAKill::DoAdd(), GetTokenRemainder(), Anope::Process(), and ReadDatabase().


Field Documentation

Last position of a seperator token

Definition at line 552 of file anope.h.

Referenced by GetToken(), and sepstream().

Current string position

Definition at line 555 of file anope.h.

Referenced by GetRemaining(), GetToken(), sepstream(), and StreamEnd().

char sepstream::sep [private]

Seperator value

Definition at line 558 of file anope.h.

Referenced by GetToken(), and GetTokenRemainder().

Original string.

Definition at line 549 of file anope.h.

Referenced by GetRemaining(), GetToken(), sepstream(), and StreamEnd().


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