zeus::TStringTokenizer Class Reference

#include <StringTokenizer.h>

Inheritance diagram for zeus::TStringTokenizer:

zeus::TZObject zeus::IZUnknown

List of all members.

Public Member Functions

 TStringTokenizer (const IString &rData, const IString &rDelimiter, bool bRemoveEmptyTokens=false)
 TStringTokenizer (const IString &rData, const wchar_t *pwcDelimiter, bool bRemoveEmptyTokens=false)
virtual ~TStringTokenizer ()
TString getNextToken () const
TString getToken (Int iTokenIndex) const
TString getFirstToken () const
TString getLastToken () const
void getTokens (IStringList &rList) const
Int getTokenCount () const
bool hasNextToken () const
bool hasToken (const IString &rToken) const
void removeEmptyTokens ()
void resetIterator ()
void setTokens (const IStringList &rList)
TString toString () const
TString toString (TString strNewDelimiter) const
Retval removeTokens (Int iFirstIndex, Int iLastIndex)
Retval removeToken (Int uiIndex)
Retval removeFirstToken ()
Retval removeLastToken ()
Retval getTokenIndex (const IString &strToken, Int &iIndex, bool bExactNotLike=true)


Detailed Description

This class implements a tokenizer for strings

Constructor & Destructor Documentation

TStringTokenizer::TStringTokenizer ( const IString rData,
const IString rDelimiter,
bool  bRemoveEmptyTokens = false 
)

Creates a new tokenizer.

Parameters:
rData : Data to tokenize
rDelimiter : delimiter
bRemoveEmptyTokens,: Remove all empty token if this flag is set

TStringTokenizer::TStringTokenizer ( const IString rData,
const wchar_t *  pwcDelimiter,
bool  bRemoveEmptyTokens = false 
)

Creates a new tokenizer.

Parameters:
rData : Data to tokenize
pwcDelimiter : delimiter
bRemoveEmptyTokens,: Remove all empty token if this flag is set

TStringTokenizer::~TStringTokenizer (  )  [virtual]

Destroys the tokenizer


Member Function Documentation

TString zeus::TStringTokenizer::getNextToken (  )  const [inline]

returns the next token

TString zeus::TStringTokenizer::getToken ( Int  iTokenIndex  )  const [inline]

returns a token by index.

TString TStringTokenizer::getFirstToken (  )  const

Get the first token.

TString TStringTokenizer::getLastToken (  )  const

Get the last token.

void TStringTokenizer::getTokens ( IStringList rList  )  const

Returns a list of tokens. The list is a copy of the internal token list. Use set tokens to set a new token list

Parameters:
rList : Return parameter

Int zeus::TStringTokenizer::getTokenCount (  )  const [inline]

returns the number of the tokens

bool zeus::TStringTokenizer::hasNextToken (  )  const [inline]

checks if there are more tokens

bool zeus::TStringTokenizer::hasToken ( const IString rToken  )  const [inline]

checks if a token has been present

void TStringTokenizer::removeEmptyTokens (  ) 

Remove all empty token

void zeus::TStringTokenizer::resetIterator (  )  [inline]

resets the token iterator

void TStringTokenizer::setTokens ( const IStringList rList  ) 

sets tokens to the internal token list

Parameters:
rList : New tokens

TString zeus::TStringTokenizer::toString (  )  const [inline]

This method returns the string builded from the tockens

Returns:
build string out of tokens

Reimplemented from zeus::TZObject.

TString zeus::TStringTokenizer::toString ( TString  strNewDelimiter  )  const [inline]

This method returns the string builded from the tockens and a delimiter

Returns:
build string out of tokens

Retval TStringTokenizer::removeTokens ( Int  iFirstIndex,
Int  iLastIndex 
)

Remove tokens given by a range of indexes.

Parameters:
iFirstIndex [IN]: First index of this range.
iLastIndex [IN]: Last index of this range.
Return values:
: Error code.

Retval TStringTokenizer::removeToken ( Int  iIndex  ) 

Remove a token given by index.

Parameters:
iIndex [IN]: Index of the token to be removed.
Return values:
: Error code.

Retval TStringTokenizer::removeFirstToken (  ) 

Remove the first token.

Return values:
 Error code.

Retval TStringTokenizer::removeLastToken (  ) 

Remove the last token.

Return values:
 Error code.

Retval TStringTokenizer::getTokenIndex ( const IString strToken,
Int &  iIndex,
bool  bExactNotLike = true 
)

Get the index of a given token.

Parameters:
strToken [IN] : The token to be searched for.
uiIndex [OUT]: Index of the first appearance of strToken.
bExactNotLike [IN] : true: strToken has to match one of the tokens stored in this tokenizer.
false: strToken only has to be contained at the beginning of one of the tokens of this tokenizer.

Return values:
: Error code.


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


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Wed Oct 28 21:42:36 2009