Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::StringTokenizer Class Reference

Class for breaking a string into a series of one or more tokens. More...

#include <vcf/FoundationKit/StringTokenizer.h>

Inheritance diagram for VCF::StringTokenizer:

VCF::Object VCF::Enumerator< String > List of all members.

Public Member Functions

 StringTokenizer (const String &data)
 StringTokenizer (const String &data, const String &delimiter)
 StringTokenizer (const VCFChar *strPtr, size_t length, const String &delimiter="")
void getElements (std::vector< String > &elements)
virtual bool hasMoreElements (const bool &backward=false) const
 indicates whether there are any more children to enumerate through
virtual String nextElement ()
 returns the next element in the enumeration.
virtual String prevElement ()
 returns the previous element in the enumeration.
virtual void reset (const bool &backward=false) const
 Resets the Enumerator's internal iterator back to the beginning (or end, if backward is true).
StringTokenizeroperator= (const String &data)
void assign (const String &data, const String &delimiter="")

Protected Member Functions

 StringTokenizer (const StringTokenizer &)
StringTokenizeroperator= (const StringTokenizer &rhs)

Protected Attributes

bool backward_
size_t dataSize_
const VCFCharstart_
const VCFCharptr_
const VCFCharbackPtr_
String data_
String delimiter_

Detailed Description

Class for breaking a string into a series of one or more tokens.

Usage:

StringTokenizer stk("Diddly piddly, dock, a big fat piece of apple nut cake!", " \n\r\f\t" );

while ( stk.hasMoreElements(true) ) {
    String s1 = stk.nextElement();
    String s2 = stk.prevElement();
    printf( "s1 = %s, s2 = %s\n", s1.c_str(), s2.c_str() );
}


Constructor & Destructor Documentation

VCF::StringTokenizer::StringTokenizer const String data  )  [inline]
 

VCF::StringTokenizer::StringTokenizer const String data,
const String delimiter
[inline]
 

VCF::StringTokenizer::StringTokenizer const VCFChar strPtr,
size_t  length,
const String delimiter = ""
[inline]
 

VCF::StringTokenizer::StringTokenizer const StringTokenizer  )  [inline, protected]
 


Member Function Documentation

void VCF::StringTokenizer::assign const String data,
const String delimiter = ""
[inline]
 

void VCF::StringTokenizer::getElements std::vector< String > &  elements  )  [inline]
 

virtual bool VCF::StringTokenizer::hasMoreElements const bool &  backward = false  )  const [inline, virtual]
 

indicates whether there are any more children to enumerate through

Parameters:
bool specifies whether the enumeration should be forwards or backwards. The default value is true for enumerating forwards.
Returns:
bool true if there are any elements left to enumerate, otherwise returns false.

Implements VCF::Enumerator< String >.

virtual String VCF::StringTokenizer::nextElement  )  [inline, virtual]
 

returns the next element in the enumeration.

Moves the internal iterator forward

Returns:
COLLECTION_TYPE returns a COLLECTION_TYPE value of whatever type was specified in the template argument to the Enumerator

Implements VCF::Enumerator< String >.

StringTokenizer& VCF::StringTokenizer::operator= const StringTokenizer rhs  )  [inline, protected]
 

StringTokenizer& VCF::StringTokenizer::operator= const String data  )  [inline]
 

virtual String VCF::StringTokenizer::prevElement  )  [inline, virtual]
 

returns the previous element in the enumeration.

Moves the internal iterator backward

Returns:
COLLECTION_TYPE returns a COLLECTION_TYPE value of whatever type was specified in the template argument to the Enumerator

Implements VCF::Enumerator< String >.

virtual void VCF::StringTokenizer::reset const bool &  backward = false  )  const [inline, virtual]
 

Resets the Enumerator's internal iterator back to the beginning (or end, if backward is true).

Parameters:
bool specifies which direction to reset to

Implements VCF::Enumerator< String >.


Member Data Documentation

const VCFChar* VCF::StringTokenizer::backPtr_ [mutable, protected]
 

bool VCF::StringTokenizer::backward_ [mutable, protected]
 

String VCF::StringTokenizer::data_ [protected]
 

size_t VCF::StringTokenizer::dataSize_ [mutable, protected]
 

String VCF::StringTokenizer::delimiter_ [protected]
 

const VCFChar* VCF::StringTokenizer::ptr_ [mutable, protected]
 

const VCFChar* VCF::StringTokenizer::start_ [mutable, protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information