All Frameworks  Class Hierarchy  This Framework  Previous  Next  Indexes

System Class CATToken

CATToken
 

Usage: you must use this class as is. You should never derive it.


public class CATToken

Class to analyze the contents of a CATUnicodeString instance.
Use this class when you want to extract substrings delimited by sequences of characters chosen by delimiter characters you pass as argument of the GetNextToken method. A CATToken instance contains the CATUnicodeString instance as a data member, and a position index initialized to 0. This position index is updated according to the searches made by the GetNextToken method, and can be reset to 0 thanks to the Reset method.

For example, the character string:

 This is/// a nice %% character\tstring.  
 

can be analyzed using the delimiter characters / % \t and the blank.


Constructor and Destructor Index


o CATToken(CATUnicodeString&)
Constructs a CATToken instance from a CATUnicodeSTring instance.
o ~CATToken()

Method Index


o GetNextToken()
Gets the next token, that is the character substring enclosed by sequences of the following delimiter characters: blanks, tabulations (\t) and carriage returns (\n).
o GetNextToken(CATUnicodeString&)
Gets the next token, that is the character substring enclosed by sequences of delimiter characters.
o Reset()
Resets the position index to 0.

Constructor and Destructor


o CATToken
public CATToken( const CATUnicodeString& iStringToAnalyze)
Constructs a CATToken instance from a CATUnicodeSTring instance.
o ~CATToken
public virtual ~CATToken()

Methods


o GetNextToken
public CATUnicodeString GetNextToken()
Gets the next token, that is the character substring enclosed by sequences of the following delimiter characters: blanks, tabulations (\t) and carriage returns (\n).
Returns:
The substring found.
o GetNextToken
public CATUnicodeString GetNextToken( const CATUnicodeString& iDelimiterCharacters)
Gets the next token, that is the character substring enclosed by sequences of delimiter characters. For example, assume the CATToken instance is constructed from the following character string:
 CATUnicodeString TheString("This is/// a nice %% character\tstring.")  
 

and assume that the position index is set to 8 due to a previous call to the method. The code below extracts the next token substring from this string:

 CATUnicodeString iDelimiterCharacters("/%");
 CATUnicodeString NextToken = TheString.GetNextToken(iDelimiterCharacters);
 cout << "The next token is: -" << NextToken.ConvertToChar() << "-" << endl;
 

This code issues:

 The next token is: - a nice - 
 
and sets the position index to 19.
Parameters:
iDelimiterCharacters
Characters to take into account to find an enclosed substring.
Returns:
The substring found.
o Reset
public void Reset()
Resets the position index to 0.

This object is included in the file: CATToken.h
If needed, your Imakefile.mk should include the module: JS0GROUP

Copyright © 2003, Dassault Systèmes. All rights reserved.