Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

XFuTokenizer Class Reference

String tokenizer utility class. More...

#include <XFuTokenizer.h>

List of all members.

Public Member Functions

 XFuTokenizer ()
 Constructor.

 ~XFuTokenizer ()
 Destructor.

void tokenize (const CHAR *aBuffer, const CHAR *aSeparators)
 Tokenizes the input string.

void tokenize (const CHAR *aBuffer)
 Tokenizes the input string.

INT tokenEquals (INT32 aIdx, const CHAR *aCompareString)
 Case sensitive matching of a token and given string.

INT tokenEqualsNocase (INT32 aIdx, const CHAR *aCompareString)
 Case insensitive matching of a token and given string.

INT32 getTokenCount ()
 Get the token count.

const CHAR * getToken (INT32 aIdx)
 Get a pointer to a token (as zero-terminated string).

CHAR * duplicateToken (INT32 aIdx)
 Get a duplicate of a token (as zero-terminated string).


Private Member Functions

CHAR upcase (CHAR i)
 Upcase function.


Private Attributes

CHAR ** mData
 Token strings.

INT32 mCount
 Number of token strings.


Detailed Description

String tokenizer utility class.

Tokenizes strings by delimiters.

Example of use:
  const CHAR blah[] = "some; string with ; different tokens";
  XFuTokenizer myTokens;
  myTokens.tokenize(blah, XFCSTR(";"));
  INT i;
  for (i = 0; i < myTokens.getTokenCount(); ++i)
      if (myTokens.tokenEqualsNocase(i, XFCSTR("String wIth")))
          printf("token number %d is our token", i);
  

Definition at line 31 of file XFuTokenizer.h.


Constructor & Destructor Documentation

XFuTokenizer::XFuTokenizer  
 

Constructor.

Definition at line 18 of file XFuTokenizer.cpp.

References mCount, and mData.

XFuTokenizer::~XFuTokenizer  
 

Destructor.

Definition at line 26 of file XFuTokenizer.cpp.

References mCount, and mData.


Member Function Documentation

CHAR * XFuTokenizer::duplicateToken INT32    aIdx
 

Get a duplicate of a token (as zero-terminated string).

Definition at line 191 of file XFuTokenizer.cpp.

References mData.

const CHAR * XFuTokenizer::getToken INT32    aIdx
 

Get a pointer to a token (as zero-terminated string).

Definition at line 184 of file XFuTokenizer.cpp.

References mData.

Referenced by XFuConfigurationData::addMusic(), XFuConfigurationData::addSound(), XFuConfigurationData::loadImage(), XFuConfigurationData::loadPrinter(), XFuConfigurationData::parseRectangleString(), XFuConfigurationData::put(), tokenEquals(), and tokenEqualsNocase().

INT32 XFuTokenizer::getTokenCount  
 

Get the token count.

Definition at line 177 of file XFuTokenizer.cpp.

References mCount.

Referenced by XFuConfigurationData::addMusic(), XFuConfigurationData::addSound(), XFuConfigurationData::loadImage(), XFuConfigurationData::loadPrinter(), XFuConfigurationData::parseRectangleString(), and XFuConfigurationData::put().

INT XFuTokenizer::tokenEquals INT32    aIdx,
const CHAR *    aCompareString
 

Case sensitive matching of a token and given string.

Definition at line 149 of file XFuTokenizer.cpp.

References getToken().

INT XFuTokenizer::tokenEqualsNocase INT32    aIdx,
const CHAR *    aCompareString
 

Case insensitive matching of a token and given string.

Definition at line 163 of file XFuTokenizer.cpp.

References getToken(), and upcase().

void XFuTokenizer::tokenize const CHAR *    aBuffer
 

Tokenizes the input string.

Uses the ',' and '=' characters as delimiters for tokens.

Definition at line 142 of file XFuTokenizer.cpp.

References tokenize().

void XFuTokenizer::tokenize const CHAR *    aBuffer,
const CHAR *    aSeparators
 

Tokenizes the input string.

Uses the characters in aSeparators as delimiters for tokens.

Definition at line 36 of file XFuTokenizer.cpp.

References mCount, and mData.

Referenced by XFuConfigurationData::addMusic(), XFuConfigurationData::addSound(), XFuConfigurationData::loadImage(), XFuConfigurationData::loadPrinter(), XFuConfigurationData::parseRectangleString(), XFuConfigurationData::put(), and tokenize().

CHAR XFuTokenizer::upcase CHAR    i [private]
 

Upcase function.

Definition at line 204 of file XFuTokenizer.cpp.

Referenced by tokenEqualsNocase().


Member Data Documentation

INT32 XFuTokenizer::mCount [private]
 

Number of token strings.

Definition at line 69 of file XFuTokenizer.h.

Referenced by getTokenCount(), tokenize(), XFuTokenizer(), and ~XFuTokenizer().

CHAR** XFuTokenizer::mData [private]
 

Token strings.

Definition at line 67 of file XFuTokenizer.h.

Referenced by duplicateToken(), getToken(), tokenize(), XFuTokenizer(), and ~XFuTokenizer().


The documentation for this class was generated from the following files:
   
X-Forge Documentation
Confidential
Copyright © 2002-2003 Fathammer
   
Documentation generated
with doxygen
by Dimitri van Heesch