- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::Basics::CStringTokeniser Class Reference

Inheritance diagram for Exponent::Basics::CStringTokeniser:

List of all members.

## Detailed Description

String divider.

     CStringTokeniser tokeniser("hello, everybody");
     while(tokeniser.hasMoreTokens())
     {
         // Get the token
           char *token = tokeniser.getNextToken();

         // Display the token
         std::cout << "Token is = " << token << std::endl;

         // Delete the token buffer
         FREE_ARRAY_POINTER(token);
     }

Date:
  21/08/2004

Author:
  Paul Chana

Version:
  1.0.0 Initial version

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  CStringTokeniser.hpp,v 1.5 2007/02/08 21:06:44 paul Exp

Definition at line 47 of file CStringTokeniser.hpp.

## Public Member Functions

- CStringTokeniser (const CString &string, const char token)
- CStringTokeniser (const char *string, const char token)
- CStringTokeniser (const CString &string)
- CStringTokeniser (const char *string)
- bool getNextToken (CString &string)
- virtual char * getNextToken ()
- virtual long getNumberOfTokens ()
- virtual bool hasMoreTokens ()
- virtual void setStringToTokenize (const char *string)
- virtual void setTokenizationCharacter (const char token)
- virtual ~CStringTokeniser ()

## Static Public Attributes

- static const long CSTRING_TOKENISER_MAX_STRING = 2048

## Protected Attributes

- long m_lastTokenPosition
- long m_numberOfTokens
- long m_numberOfTokensReturned
- char m_string [CSTRING_TOKENISER_MAX_STRING]
- char m_token

## Constructor & Destructor Documentation

Exponent::Basics::CStringTokeniser::CStringTokeniser | ( | const char * | string | ) |

Construction

Parameters:

  | string | The string to tokenise

Exponent::Basics::CStringTokeniser::CStringTokeniser | ( | const CString & | string | ) |

Construction

Parameters:

  | string | The string to tokenise

Exponent::Basics::CStringTokeniser::CStringTokeniser | ( | const char * | string,
|  | const char | token |
| ) |  |  |

Construction

Parameters:

  | string | The string to tokenise
  | token | The token to split on

Exponent::Basics::CStringTokeniser::CStringTokeniser | ( | const CString & | string,
|  | const char | token |
| ) |  |  |

Construction

Parameters:

  | string | The string to tokenise
  | token | The token to split on

virtual Exponent::Basics::CStringTokeniser::~CStringTokeniser | ( |  | ) | `[virtual]`

Destruction

## Member Function Documentation

bool Exponent::Basics::CStringTokeniser::getNextToken | ( | CString & | string | ) |

Get the next token

Parameters:

  | string | On return holds the token

Return values:

  | bool | true if got the next token, false otherwise

virtual char* Exponent::Basics::CStringTokeniser::getNextToken | ( |  | ) | `[virtual]`

Get the next token

Return values:

  | char* | The next token available. You are responsible for its deletion

virtual long Exponent::Basics::CStringTokeniser::getNumberOfTokens | ( |  | ) | `[virtual]`

Get the number of tokens in the string

Return values:

  | long | The number of tokens

virtual bool Exponent::Basics::CStringTokeniser::hasMoreTokens | ( |  | ) | `[virtual]`

Are there more tokens available to iterate over?

Return values:

  | bool | True if more tokens available, false otherwise

virtual void Exponent::Basics::CStringTokeniser::setStringToTokenize | ( | const char * | string | ) | `[virtual]`

Set the string to be tokenised

Parameters:

  | string | The string to tokenise

virtual void Exponent::Basics::CStringTokeniser::setTokenizationCharacter | ( | const char | token | ) | `[virtual]`

Set the character to split on

Parameters:

  | token | The character to split on

## Member Data Documentation

const long Exponent::Basics::CStringTokeniser::CSTRING_TOKENISER_MAX_STRING = 2048`[static]`

Max length string that you can use

Definition at line 59 of file CStringTokeniser.hpp.

long Exponent::Basics::CStringTokeniser::m_lastTokenPosition`[protected]`

index of last token

Definition at line 145 of file CStringTokeniser.hpp.

long Exponent::Basics::CStringTokeniser::m_numberOfTokens`[protected]`

the tokens

Definition at line 143 of file CStringTokeniser.hpp.

long Exponent::Basics::CStringTokeniser::m_numberOfTokensReturned`[protected]`

no returned

Definition at line 144 of file CStringTokeniser.hpp.

char Exponent::Basics::CStringTokeniser::m_string[CSTRING_TOKENISER_MAX_STRING]`[protected]`

the tokenisation string

Definition at line 146 of file CStringTokeniser.hpp.

char Exponent::Basics::CStringTokeniser::m_token`[protected]`

the token

Definition at line 147 of file CStringTokeniser.hpp.