Anope IRC Services  Version 2.0
Public Member Functions | Private Attributes
sepstream Class Reference

#include <anope.h>

Inheritance diagram for sepstream:
Inheritance graph
[legend]
Collaboration diagram for sepstream:
Collaboration graph
[legend]

Public Member Functions

 sepstream (const Anope::string &source, char seperator, bool allowempty=false)
 
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
 
char sep
 
size_t pos
 
bool allow_empty
 

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 551 of file anope.h.

Constructor & Destructor Documentation

sepstream::sepstream ( const Anope::string source,
char  seperator,
bool  allowempty = false 
)

Create a sepstream and fill it with the provided data

Definition at line 95 of file hashcomp.cpp.

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 156 of file hashcomp.cpp.

References pos, StreamEnd(), Anope::string::substr(), and tokens.

Referenced by CommandOSAKill::DoAdd(), GetTokenRemainder(), CommandOSSNLine::OnAdd(), CSLog::OnChanRegistered(), and IRCDProto::Parse().

bool sepstream::GetToken ( Anope::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

Definition at line 99 of file hashcomp.cpp.

References allow_empty, Anope::string::clear(), Anope::string::find(), Anope::string::find_first_not_of(), Anope::string::length(), pos, sep, StreamEnd(), Anope::string::substr(), and tokens.

Referenced by Configuration::Conf::Conf(), MChanstats::CountSmileys(), CommandOSAKill::DoAdd(), CommandNSAJoin::DoAdd(), CommandNSAJoin::DoDel(), CommandCSMode::DoLock(), CommandNSList::Execute(), CommandOSMode::Execute(), CommandCSList::Execute(), CommandNSStatus::Execute(), CommandHelp::Execute(), KickerDataImpl::ExtensibleItem::ExtensibleUnserialize(), NSCertListImpl::ExtensibleItem::ExtensibleUnserialize(), CSSet::KeepModes::ExtensibleUnserialize(), NSSet::KeepModes::ExtensibleUnserialize(), GetToken(), GetTokenRemainder(), MyManager::HandlePacket(), Language::InitLanguages(), Module::Module(), NumberList::NumberList(), NumTokens(), CommandOSSNLine::OnAdd(), CSLog::OnChanRegistered(), CSMode::OnChanRegistered(), BotServCore::OnCreateChan(), ModuleProxyScan::OnReload(), OSDefcon::OnReload(), Packet::PackName(), IRCDProto::Parse(), OSDefcon::ParseModeString(), Rewrite::Process(), MyHTTPClient::Read(), Message::Capab::Run(), Message::Join::Run(), Message::Kick::Run(), Message::Part::Run(), IRCDMessageBMask::Run(), IRCDMessageNJoin::Run(), IRCDMessageTBurst::Run(), IRCDMessageCapab::Run(), User::SendMessage(), Channel::SetModes(), User::SetModes(), Channel::SetModesInternal(), User::SetModesInternal(), ChannelInfo::Unserialize(), and NickCore::Unserialize().

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

Gets token number 'num' from the stream

Parameters
tokenThe token is placed here
numThe token number to featch
Returns
True if the token was able to be fetched

Definition at line 128 of file hashcomp.cpp.

References GetToken().

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

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

Parameters
tokenThe token is placed here
numThe token number to featch
Returns
True if the token was able to be fetched

Definition at line 143 of file hashcomp.cpp.

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

Referenced by IRCDMessageServer::Run().

template<typename T >
void sepstream::GetTokens ( T &  token)
inline
int sepstream::NumTokens ( )

Determines the number of tokens in this stream.

Returns
The number of tokens in this stream

Definition at line 135 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 161 of file hashcomp.cpp.

References Anope::string::length(), pos, and tokens.

Referenced by CommandOSAKill::DoAdd(), GetRemaining(), GetToken(), GetTokenRemainder(), and IRCDProto::Parse().

Field Documentation

bool sepstream::allow_empty
private

If set then GetToken() can return an empty string

Definition at line 565 of file anope.h.

Referenced by GetToken().

size_t sepstream::pos
private

Current string position

Definition at line 562 of file anope.h.

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

char sepstream::sep
private

Seperator value

Definition at line 559 of file anope.h.

Referenced by GetToken(), and GetTokenRemainder().

Anope::string sepstream::tokens
private

Original string.

Definition at line 556 of file anope.h.

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


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