SystemTS CATToken

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


public class CATToken

Class to analyse 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 analysed using the delimiter characters / % \t and the blank.


Constructor and Destructor Index


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

Method Index


o GetNextToken(CATBoolean*)
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&,CATBoolean*)
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 iStringToAnalyse,
iAcceptEmptyStrings= FALSE)
Constructs a CATToken instance from a CATUnicodeSTring instance.
Parameters:
iStringToAnalyse
The string to analyse.
iAcceptEmptyStrings
Specifies whether empty strings between separators must be returned by the GetNextToken method or not.
o ~CATToken
public virtual ~CATToken()

Methods


o GetNextToken
public GetNextToken( oMoreAvailable= NULL)
Gets the next token, that is the character substring enclosed by sequences of the following delimiter characters: blanks, tabulations (\t) and carriage returns (\n).
Parameters:
oMoreAvailable
Optional parameter set to TRUE if there are more available tokens or to FALSE if the end of the analysed string has been reached. This parameter must be used if the CATToken has been created with the parameter iAcceptEmptyStrings set to TRUE in order to check the end of the parse.
Returns:
The substring found.
o GetNextToken
public GetNextToken( const iDelimiterCharacters,
oMoreAvailable= NULL)
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.
oMoreAvailable
Optional parameter set to TRUE if there are more available tokens or to FALSE if the end of the analysed string has been reached. This parameter must be used if the CATToken has been created with the parameter iAcceptEmptyStrings set to TRUE in order to check the end of the parse.
Returns:
The substring found.
o Reset
public 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: CATSysTS

Copyright © 1999-2014, Dassault Systèmes. All rights reserved.