System CATString

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


public class CATString

Class to use for non language meaningful character strings.
Role: Class for ISO 646 string, i.e. codes from 0 to 127 in decimal:

ISO 646 has been specified by the International Organization for Standardization (http://www.iso.ch ).
Thus, this class does not support NLS (National Langage Support), at the opposite of . Comparing this class to , the very simple character set supported here, once accepted the limitations it implies, enables to supress all the problems that arise with NLS complexity. Before using this class instead of , check carefully that you will never need the NLS support. The raw type char* you should never be used.


Constructor and Destructor Index


o CATString()
Constructs a string object so that it represents an empty character sequence.
o CATString(char*)
Construct a CATString from a C string .
o CATString(char* const)
Construct a CATString from a C string, with C++ protection from writing access from the called method to the calling service string.
o CATString(CATString&)
o CATString(CATChar,size_t)
Construct a CATString from a CATChar, duplicating the character into the result string a specified amount of times.
o CATString(CATString&,size_t)
Construct a CATString from a CATString, duplicating the string into the result string a specified amount of times.
o ~CATString()
Destructor.

Method Index


o CastToCharPtr()
o Compare(char*)
Compares two strings lexicographically.
o Compare(CATString&)
Compares two strings lexicographically.
o CompareByCase(CATString&)
Compare two CATStrings.
o ComputeHashKey()
Returns a hashcode for this string.
o ConvertToChar()
Converts a CATString into a const char*.
o FindPosition(CATString&,int)
Determines the location and existence of strings in the current CATString.
o GetLengthInByte()
Get the length of the CATString, as byte count.
o GetLengthInChar()
Get the length of the CATString, as char count.
o Insert(int,CATString&)
Modify the current CATString, inserting a given substring at the middle of it.
o IsNull()
Indicates if the current CATString length is of zero value.
o Remove(int,int)
Modify the current CATString, supressing a given part of it.
o ReplaceSubString(int,int,CATString&)
Modify the current CATString, supressing a given part of it and putting instead a given replacement substring.
o ReplaceSubString(int,int,CATString&,int)
Modify the current CATString, supressing a given part of it and putting instead a given replacement substring.
o ReplaceSubString(CATString&,CATString&)
Replace the first occurence of the given substring by the other given substring.
o Resize(int)
Put the length of a string to desired length, adding occurences of the space character as a filling character, to reach the desired length.
o Resize(int,CATChar)
Set the length of a string to desired length, adding occurences of a given filling character to reach the desired length.
o Resize(int,CATChar,int)
Set the length of a string to desired length, adding occurences of a given filling character to reach the desired length.
o Strip()
Strips the current CATString through the space character, using the CATStripModeLeading mode (see above).
o Strip(CATString::CATStripMode)
Strips the current CATString through the space character.
o Strip(CATString::CATStripMode,CATChar)
Strips the current CATString.
o SubString(size_t,size_t)
Returns a new string that is a substring of this string.
o ToLower()
Converts all of the characters in this String to lower case.
o ToUpper()
Converts all of the characters in this String to upper case.
o operator !=(char*)
Inequality operator.
o operator !=(CATString&)
Inequality comparison operator between two CATString.
o operator >(char*)
Superior comparison operator between a CATString and a char* .
o operator >(CATString&)
Greater-than comparison operator between two CATString.
o operator >=(char*)
"Superior or equal" comparison operator between a CATString and a char* .
o operator >=(CATString&)
Greater-than or equal comparison operator between two CATString.
o operator <(char*)
Inferior comparison operator between a CATString and a char* .
o operator <(CATString&)
Inequality comparison operator between two CATString.
o operator <=(char*)
"Inferior or equal" comparison operator between a CATString and a char* .
o operator <=(CATString&)
Less-than or equal comparison operator between two CATString.
o operator +(char*)
C string concatenation operator.
o operator +(CATString&)
String concatenation operator.
o operator +=(int)
"+=" operator to append an integer to a CATString, i.
o operator +=(long)
"+=" operator to append a long integer to a CATString, i.
o operator +=(char*)
C string concatenation assignment operator.
o operator +=(CATLONG64)
"+=" operator to append a 64-bit signed long integer to a CATString, i.
o operator +=(CATULONG64)
"+=" operator to append a 64-bit unsigned long integer to a CATString, i.
o operator +=(CATChar&)
CATChar concatenation assignment operator.
o operator +=(unsigned int)
"+=" operator to append an unsigned integer to a CATString, i.
o operator +=(unsigned long)
"+=" operator to append an unsigned long integer to a CATString, i.
o operator +=(CATString&)
String concatenation assignment operator.
o operator =(char*)
Assignment operator.
o operator =(CATString&)
Assignment operator of a CATString to a CATString.
o operator ==(char*)
Equality operator.
o operator ==(CATString&)
Equality comparison operator between two CATString.
o operator()(int,int)
"()" operator to compute a substring from the current CATString.
o operator[](int)
Returns the character at the specified index.

Enumerated Type Index


o CATStripMode
Strip mode.

Constructor and Destructor


o CATString
public CATString()
Constructs a string object so that it represents an empty character sequence.
o CATString
public CATString( iString)
Construct a CATString from a C string .
Parameters:
iString
The C string used for initialization
o CATString
public CATString( const iString)
Construct a CATString from a C string, with C++ protection from writing access from the called method to the calling service string.
Parameters:
iString
The C string used for initialization
o CATString
public CATString( const iString)
o CATString
public CATString( const iChar,
iRepeatCount)
Construct a CATString from a CATChar, duplicating the character into the result string a specified amount of times.
Parameters:
iChar
Character
iRepeatCount
Repeat count
o CATString
public CATString( const iString,
iRepeatCount)
Construct a CATString from a CATString, duplicating the string into the result string a specified amount of times.
Parameters:
iString
String
iRepeatCount
Repeat count
o ~CATString
public ~CATString()
Destructor.

Methods


o CastToCharPtr
public CastToCharPtr()
Deprecated:
R417 ConvertToChar Converts a CATString into a const char*. Caution: the returned char* must be declared as a const.
Returns:
iString const char* output string
o Compare
public Compare( const iString)
Compares two strings lexicographically. The character sequence represented by the current String is compared lexicographically to the character sequence represented by the argument string.
Parameters:
iString
The String to be compared
Returns:
Comparison result.
Legal values: less than 0 if the value of the current object string is lexicographically less than iString, or greater than 0 if the value of the current object string is lexicographically greater than iString, or equal to 0 if the value of the current object string is lexicographically equal than iString.
o Compare
public Compare( const iString)
Compares two strings lexicographically. The character sequence represented by the current String is compared lexicographically to the character sequence represented by the argument string.
Parameters:
iString
The String to be compared
Returns:
Comparison result.
Legal values: less than 0 if the value of the current object string is lexicographically less than iString, or greater than 0 if the value of the current object string is lexicographically greater than iString, or equal to 0 if the value of the current object string is lexicographically equal than iString.
o CompareByCase
public CompareByCase( const iComparisonString)
Compare two CATStrings.
Parameters:
iComparisonString
The string to compare to the current one
Returns:
Comparison result.
Legal values: 0: Not equal 1: Strictly equal 2: Equal not speaking of the case. The comparison does not take the case into account
o ComputeHashKey
public ComputeHashKey()
Returns a hashcode for this string. This hashcoding encoding does work only if the 8 first characters (from 0 to 7) of the related CATString objects are different the one from the other.
Returns:
The hashcoding key.
o ConvertToChar
public ConvertToChar()
Converts a CATString into a const char*.
Returns:
iString const char* output string
o FindPosition
public FindPosition( const iLookedForSubString,
iSearchBeginning= 0)
Determines the location and existence of strings in the current CATString.
Parameters:
iLookedForSubString
The string to look for
iSearchBeginning
The search beginning index
Returns:
Location of the substring.
Legal values: -1: Not found Other: Location index, from 0 to the current CATString length minus 1
o GetLengthInByte
public GetLengthInByte()
Get the length of the CATString, as byte count.
Returns:
Byte count.
o GetLengthInChar
public GetLengthInChar()
Get the length of the CATString, as char count.
Returns:
Char count.
o Insert
public Insert( iInsertionStartingPosition,
const iStringToInsert)
Modify the current CATString, inserting a given substring at the middle of it.
Parameters:
iInsertionStartingPosition
The insertion starting position
iStringToInsert
The string to insert into the current CATString
o IsNull
public IsNull()
Indicates if the current CATString length is of zero value.
Returns:
boolean
Legal values: 0: False the length is not of zero value, or Other: True if the length is of zero value.
o Remove
public Remove( iModificationStartingPosition,
iModificationCharCount=1)
Modify the current CATString, supressing a given part of it.
Parameters:
iModificationStartingPosition
The modification starting position
iModificationCharCount
The modification char count
o ReplaceSubString
public ReplaceSubString( iModificationStartingPosition,
iModificationCharCount,
const iReplacementString)
Modify the current CATString, supressing a given part of it and putting instead a given replacement substring.
Parameters:
iModificationStartingPosition
The modification starting position
iModificationCharCount
The modification char count
iReplacementString
The replacement string
o ReplaceSubString
public ReplaceSubString( iModificationStartingPosition,
iModificationCharCount,
const iReplacementString,
iReplacementStringParametering)
Modify the current CATString, supressing a given part of it and putting instead a given replacement substring.
Parameters:
iModificationStartingPosition
The modification starting position
iModificationCharCount
The modification char count
iReplacementString
The replacement string
iReplacementStringParametering
The replacement string parametering. Enables to specify not to take the replacement string as is, but transformed first by a resizing action. This tuning specification is the character count of the real CATString that will be used for the substitution, i.e. the CATString resized through the space filling character.
o ReplaceSubString
public ReplaceSubString( const iLookedForString,
const iSubstitutionString)
Replace the first occurence of the given substring by the other given substring.
Parameters:
iLookedForString
The substring whose first occurence must be replaced
iSubstitutionString
The string to substitute to the previous one
Returns:
Location of the input substring occurence.
Legal values: -1: Not found Other: Location index, from 0 to the current CATString length minus 1
o Resize
public Resize( iNewSize)
Put the length of a string to desired length, adding occurences of the space character as a filling character, to reach the desired length. If the required length is shorter that the preceeding one, the delivered filling character will not be used.
Parameters:
iNewSize
The desired length
o Resize
public Resize( iNewSize,
iFillingChar)
Set the length of a string to desired length, adding occurences of a given filling character to reach the desired length. If the required length is shorter that the preceeding one, the delivered filling character will not be used. Compared to the preceeding method, the truncation is considered to be allowed.
Parameters:
iNewSize
The desired length
iFillingChar
Filling character
o Resize
public Resize( iNewSize,
iFillingChar,
iTruncationAllowed)
Set the length of a string to desired length, adding occurences of a given filling character to reach the desired length. If the required length is shorter that the preceeding one, the delivered filling character will not be used.
Parameters:
iNewSize
The desired length
iFillingChar
Filling character
iTruncationAllowed
The truncation is allowed. If the given value for iTruncationAllowed equals zero, and the required length is shorter than the preceeding one, nothing is done.
o Strip
public Strip()
Strips the current CATString through the space character, using the CATStripModeLeading mode (see above).
o Strip
public Strip( iMode)
Strips the current CATString through the space character. Role: Removes the space character occurences from a given string.
Parameters:
iMode
See above
o Strip
public Strip( iMode,
iCharacter)
Strips the current CATString. Role: Removes a peculiar character occurences from a given string.
Parameters:
iMode
Option parameterizing the action.
Legal values: CATStripModeLeading Removes all the consecutive occurences of the given character from the beginning of the given string (of course it supposes that the first character of the string is the delivered character, if it is not the case, nothing is done). CATStripModeTrailing Removes all the consecutive occurences of the given character from the end of the string (the same way, it means that the first character of the delivered string is really the delivered character). CATStripModeBoth Removes all the consecutive occurences of the given character both from the beginning of the string and from the end (this option cumulates the two preceeding options, it does not affects the intermediate consecutive occurences). CATStripModeAll Removes all the occurences of the given character from the string.

iCharacter
The peculiar character whose occurences are to be removed from the current CATString.
o SubString
public SubString( iSubStringFirstIndex,
iSubStringCharCount)
Returns a new string that is a substring of this string.
Parameters:
iSubStringFirstIndex
The string to extract first index
iSubStringCharCount
The string to extract char count
Returns:
Extracted substring.
o ToLower
public ToLower()
Converts all of the characters in this String to lower case.
o ToUpper
public ToUpper()
Converts all of the characters in this String to upper case.
o operator !=
public operator !=( const iString)
Inequality operator.
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator !=
public operator !=( const iString)
Inequality comparison operator between two CATString.
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator >
public operator >( const iString)
Superior comparison operator between a CATString and a char* .
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator >
public operator >( const iString)
Greater-than comparison operator between two CATString.
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator >=
public operator >=( const iString)
"Superior or equal" comparison operator between a CATString and a char* .
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator >=
public operator >=( const iStringToCompare)
Greater-than or equal comparison operator between two CATString.
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator <
public operator <( const iString)
Inferior comparison operator between a CATString and a char* .
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator <
public operator <( const iString)
Inequality comparison operator between two CATString.
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator <=
public operator <=( const iString)
"Inferior or equal" comparison operator between a CATString and a char* .
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator <=
public operator <=( const iString)
Less-than or equal comparison operator between two CATString.
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator +
public operator +( const iString)
C string concatenation operator.
Parameters:
iString
The String to append to the current one
Returns:
The CATString resulting from the concatenation
o operator +
public operator +( const iString)
String concatenation operator.
Parameters:
iString
The String to append to the current one
Returns:
The CATString resulting from the concatenation
o operator +=
public operator +=( iInt)
"+=" operator to append an integer to a CATString, i.e. appends the integer to the current CATString after having been converted to a string.
Parameters:
iInt
The integer to append
Returns:
The class resulting from the concatenation
o operator +=
public operator +=( iLongInt)
"+=" operator to append a long integer to a CATString, i.e. appends the long integer to the current CATString after having been converted to a string.
Parameters:
iLongInt
The long integer to append
Returns:
The class resulting from the concatenation
o operator +=
public operator +=( const iString)
C string concatenation assignment operator.
Parameters:
iString
The String to append to the current one
Returns:
The class resulting from the concatenation
o operator +=
public operator +=( iInt)
"+=" operator to append a 64-bit signed long integer to a CATString, i.e. appends the 64-bit signed long integer to the current CATString after having been converted to a string. Defined on 64-bit platforms only.
Parameters:
i64sINT
The 64-bit signed long integer to append
Returns:
The class resulting from the concatenation
o operator +=
public operator +=( iUnsInt)
"+=" operator to append a 64-bit unsigned long integer to a CATString, i.e. appends the 64-bit unsigned long integer to the current CATString after having been converted to a string. Defined on 64-bit platforms only.
Parameters:
i64UnsInt
The 64-bit unsigned long integer to append
Returns:
The class resulting from the concatenation
o operator +=
public operator +=( const iChar)
CATChar concatenation assignment operator.
Parameters:
iChar
The character to append to the CATString
Returns:
The CATString resulting from the concatenation
o operator +=
public operator +=( iUnsInt)
"+=" operator to append an unsigned integer to a CATString, i.e. appends the unsigned integer to the current CATString after having been converted to a string.
Parameters:
iUnsInt
The unsigned long integer to append
Returns:
The class resulting from the concatenation
o operator +=
public operator +=( iUnsLongInt)
"+=" operator to append an unsigned long integer to a CATString, i.e. appends the unsigned long integer to the current CATString after having been converted to a string.
Parameters:
iUnsLongInt
The unsigned long integer to append
Returns:
The class resulting from the concatenation
o operator +=
public operator +=( const iString)
String concatenation assignment operator.
Parameters:
iString
The string to append to the current one
Returns:
The class resulting from the concatenation
o operator =
public operator =( const iString)
Assignment operator.
Parameters:
iString
The string to assign to the current one
Returns:
The class resulting from the assignment
o operator =
public operator =( const iString)
Assignment operator of a CATString to a CATString.
Parameters:
iString
The string to assign to the current one
Returns:
The class resulting from the assignment
o operator ==
public operator ==( const iString)
Equality operator.
Parameters:
iString
Operand of the comparison
Returns:
boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator ==
public operator ==( const iString)
Equality comparison operator between two CATString.
Parameters:
iString
Operand of the comparison
Returns:
Boolean
Legal values: 0: False the condition is not fullfilled, or Other: True if the condition is fullfilled.
o operator()
public operator()( begin,
end)
"()" operator to compute a substring from the current CATString.
Parameters:
begin
The first index of string to extract
end
The last index of string to extract
Returns:
Extracted substring.
o operator[]
public operator[]( iIndex)
Returns the character at the specified index. Doesn't make any bound checking.
Parameters:
iIndex
The index of the character
Returns:
The character at the specified index of this string. The first character is at index 0.

Enumerated Types


o CATStripMode
enum CATStripMode {
  CATStripModeLeading,
  CATStripModeTrailing,
  CATStripModeBoth,
  CATStripModeAll
}
Strip mode. Role: Stripping is the process consisting of removing a peculiar character occurences from a given string. Once the character specified , you can, as you want, use one of the following options:
Parameters:
CATStripModeLeading
Remove all the consecutive occurences of the character from the beginning of the string (of course it supposes that the first character of the string is the specified character, if it is not the case, nothing is done).
CATStripModeTrailing
Remove all the consecutive occurences from the end of the string (It means that the first character of the string is really the specified character).
CATStripModeBoth
Remove all the consecutive occurences both from the beginning of the string and from the end (this option cumulates the two preceeding options, it does not affects the intermediate consecutive occurences).
CATStripModeAll
Removes all the occurences of the character from the string.

Warning : CATStripMode is also defined in CATInternalString.cpp


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

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