Image Component Library (ICL)
Public Types | Public Member Functions | Private Attributes | List of all members
icl::utils::StrTok Class Reference

String Tokenizer Utility class. More...

#include <StrTok.h>

Public Types

typedef std::vector< std::string >::reverse_iterator reverse_iterator
 reverse iterator type More...
 
typedef std::vector< std::string >::const_reverse_iterator const_reverse_iterator
 constant reverse iterator type More...
 
typedef std::vector< std::string >::iterator iterator
 iterator type More...
 
typedef std::vector< std::string >::const_iterator const_iterator
 constant iterator type More...
 

Public Member Functions

 StrTok (const std::string &s, const std::string &delims, bool singleCharDelims=true, char escapeChar='\0')
 Constructor. More...
 
bool hasMoreTokens () const
 Returns whether more tokens are available using nextToken() More...
 
const std::string & nextToken ()
 Returns the next token (unsafe -> check with hasMoreTokens before) More...
 
unsigned int nTokens () const
 returns the internal token count More...
 
const std::vector< std::string > & allTokens () const
 returns a vector More...
 
void reset ()
 resets internal position indicator More...
 
iterator begin ()
 returns begin-iterator More...
 
const_iterator begin () const
 returns const begin-iterator More...
 
reverse_iterator rbegin ()
 returns reverse begin-iterator More...
 
const_reverse_iterator rbegin () const
 returns const reverse begin-iterator More...
 
iterator end ()
 returns end-iterator More...
 
const_iterator end () const
 returns const end-iterator More...
 
reverse_iterator rend ()
 returns reverse end-iterator More...
 
const_reverse_iterator rend () const
 returns const reverse end-iterator More...
 

Private Attributes

std::vector< std::string > m_oTokens
 internal data storage More...
 
unsigned int m_uiPos
 current position indicator More...
 

Detailed Description

String Tokenizer Utility class.

Member Typedef Documentation

◆ const_iterator

typedef std::vector<std::string>::const_iterator icl::utils::StrTok::const_iterator

constant iterator type

◆ const_reverse_iterator

constant reverse iterator type

◆ iterator

typedef std::vector<std::string>::iterator icl::utils::StrTok::iterator

iterator type

◆ reverse_iterator

typedef std::vector<std::string>::reverse_iterator icl::utils::StrTok::reverse_iterator

reverse iterator type

Constructor & Destructor Documentation

◆ StrTok()

icl::utils::StrTok::StrTok ( const std::string &  s,
const std::string &  delims,
bool  singleCharDelims = true,
char  escapeChar = '\0' 
)

Constructor.

Parameters
sstring to be tokenized
delimsdelimiter string: meaning depends on singleCharDelims
singleCharDelimsif this is true (default), each character of delims is treated a single possible delimiter. Otherwise, the delims string is used as a delimiter sequence
escapeCharif this char is not '\0', delimiter occurences are skipped, if this char is found directly before the delimiter. (Often the '\' char is used here)

Member Function Documentation

◆ allTokens()

const std::vector<std::string>& icl::utils::StrTok::allTokens ( ) const

returns a vector

◆ begin() [1/2]

iterator icl::utils::StrTok::begin ( )
inline

returns begin-iterator

◆ begin() [2/2]

const_iterator icl::utils::StrTok::begin ( ) const
inline

returns const begin-iterator

◆ end() [1/2]

iterator icl::utils::StrTok::end ( )
inline

returns end-iterator

◆ end() [2/2]

const_iterator icl::utils::StrTok::end ( ) const
inline

returns const end-iterator

◆ hasMoreTokens()

bool icl::utils::StrTok::hasMoreTokens ( ) const

Returns whether more tokens are available using nextToken()

note: nextToken is not safe; it must be checked with hasMoreTokens

◆ nextToken()

const std::string& icl::utils::StrTok::nextToken ( )

Returns the next token (unsafe -> check with hasMoreTokens before)

◆ nTokens()

unsigned int icl::utils::StrTok::nTokens ( ) const

returns the internal token count

◆ rbegin() [1/2]

reverse_iterator icl::utils::StrTok::rbegin ( )
inline

returns reverse begin-iterator

◆ rbegin() [2/2]

const_reverse_iterator icl::utils::StrTok::rbegin ( ) const
inline

returns const reverse begin-iterator

◆ rend() [1/2]

reverse_iterator icl::utils::StrTok::rend ( )
inline

returns reverse end-iterator

◆ rend() [2/2]

const_reverse_iterator icl::utils::StrTok::rend ( ) const
inline

returns const reverse end-iterator

◆ reset()

void icl::utils::StrTok::reset ( )
inline

resets internal position indicator

Member Data Documentation

◆ m_oTokens

std::vector<std::string> icl::utils::StrTok::m_oTokens
private

internal data storage

◆ m_uiPos

unsigned int icl::utils::StrTok::m_uiPos
private

current position indicator


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