All Frameworks Class Hierarchy This Framework Previous Next Indexes
System Class CATString
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:
- C0 ASCII control codes (see the unicode standard
documentation): 0 to 31 in decimal
- ASCII (contains digit characters, latin capital
letters, latin small letters, punctuation characters ...)
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 CATUnicodeString . Comparing this class to
CATUnicodeString , 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
CATUnicodeString, 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(CATChar,size_t)
- Construct a CATString from a CATChar, duplicating the
character into the result string a specified amount
of times.
- o
CATString(CATString&)
-
- 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(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(char*)
- Construct a CATString from a C string .
- o
~CATString()
- Destructor.
Method Index
- o
Append(CATString&)
- Concatenates CATString instances.
- o
CastToCharPtr()
- Converts a CATString into a const char*.
- o
Compare(CATString&)
- Compares two strings lexicographically.
- o
Compare(char*)
- Compares two strings lexicographically.
- o
CompareByCase(CATString&)
- Compare two CATStrings.
- o
ComputeHashKey()
- Returns a hashcode for this string.
- 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(CATString&,CATString&)
- Replace the first occurence of the given substring by the
other given substring.
- 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
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 !=(CATString&)
- Inequality comparison operator between two CATString.
- o
operator !=(char*)
- Inequality operator.
- o
operator >(CATString&)
- Greater-than comparison operator between two CATString.
- o
operator >(char*)
- Superior comparison operator between a CATString and a char* .
- o
operator >=(CATString&)
- Greater-than or equal comparison operator between two CATString.
- o
operator >=(char*)
- "Superior or equal" comparison operator between a CATString
and a char* .
- o
operator <(CATString&)
- Inequality comparison operator between two CATString.
- o
operator <(char*)
- Inferior comparison operator between a CATString and a char* .
- o
operator <=(CATString&)
- Less-than or equal comparison operator between two CATString.
- o
operator <=(char*)
- "Inferior or equal" comparison operator between a CATString
and a char* .
- o
operator +(CATString&)
- String concatenation operator.
- o
operator +(char*)
- C string concatenation operator.
- o
operator +=(CATChar&)
- CATChar concatenation assignment operator.
- o
operator +=(CATLONG64)
- "+=" operator to append a 64-bit signed long integer to a
CATString, i.
- o
operator +=(CATString&)
- String concatenation assignment operator.
- o
operator +=(CATULONG64)
- "+=" operator to append a 64-bit unsigned long integer to a
CATString, i.
- o
operator +=(char*)
- C string concatenation assignment 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 +=(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&)
- Assignment operator of a CATString to a CATString.
- o
operator =(char*)
- Assignment operator.
- o
operator ==(CATString&)
- Equality comparison operator between two CATString.
- o
operator ==(char*)
- Equality operator.
- 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
-
Constructs a string object so that it represents an empty
character sequence.
o CATString
public CATString( | const CATChar | iChar, |
| size_t | 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
-
o CATString
public CATString( | const CATString& | iString, |
| size_t | 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( | const char* 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( | char* | iString) |
-
Construct a CATString from a C string .
- Parameters:
-
- iString
- The C string used for initialization
o ~CATString
-
Destructor.
Methods
o Append
-
Concatenates CATString instances.
The string passed as a parameter is appended to the current string.
- Parameters:
-
- iStringToAppend
- the string to append to the current string
- Returns:
- The CATString resulting from the concatenation
o CastToCharPtr
public char* const CastToCharPtr( | )const |
-
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 int Compare( | const CATString& | iString)const |
-
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 int Compare( | const char* | iString)const |
-
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 int CompareByCase( | const CATString& | iComparisonString) const |
-
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 unsigned ComputeHashKey( | )const |
-
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 FindPosition
public int FindPosition( | const CATString& | iLookedForSubString, |
| int | iSearchBeginning | = 0) const |
-
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 int GetLengthInByte( | )const |
-
Get the length of the CATString, as byte count.
- Returns:
- Byte count.
o GetLengthInChar
public int GetLengthInChar( | )const |
-
Get the length of the CATString, as char count.
- Returns:
- Char count.
o Insert
public void Insert( | int | iInsertionStartingPosition, |
| const CATString& | 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
-
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 void Remove( | int | iModificationStartingPosition, |
| int | 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 int ReplaceSubString( | const CATString& | iLookedForString, |
| const CATString& | 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 ReplaceSubString
public void ReplaceSubString( | int | iModificationStartingPosition, |
| int | iModificationCharCount, |
| const CATString& | 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 void ReplaceSubString( | int | iModificationStartingPosition, |
| int | iModificationCharCount, |
| const CATString& | iReplacementString, |
| int | 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 Resize
public inline void Resize( | int | 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 inline void Resize( | int | iNewSize, |
| CATChar | 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 void Resize( | int | iNewSize, |
| CATChar | iFillingChar, |
| int | 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
-
Strips the current CATString through the space character,
using the CATStripModeLeading mode (see above).
o Strip
-
Strips the current CATString through the space character.
Role: Removes the space character occurences from a
given string.
- Parameters:
-
- iMode
- See above
o Strip
-
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 CATString SubString( | size_t | iSubStringFirstIndex, |
| size_t | iSubStringCharCount)const |
-
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
-
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 !=
public int operator !=( | const CATString& | iString)const |
-
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 int operator !=( | const char* | iString)const |
-
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 int operator >( | const CATString& | iString)const |
-
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 int operator >( | const char* | iString)const |
-
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 int operator >=( | const CATString& | iStringToCompare)const |
-
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 int operator >=( | const char* | iString)const |
-
"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 int operator <( | const CATString& | iString)const |
-
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 int operator <( | const char* | iString)const |
-
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 int operator <=( | const CATString& | iString)const |
-
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 int operator <=( | const char* | iString)const |
-
"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 +
-
String concatenation operator.
- Parameters:
-
- iString
- The String to append to the current one
- Returns:
- The CATString resulting from the concatenation
o operator +
public CATString operator +( | const char* | iString) const |
-
C string concatenation operator.
- Parameters:
-
- iString
- The String to append to the current one
- Returns:
- The CATString resulting from the concatenation
o operator +=
-
CATChar concatenation assignment operator.
- Parameters:
-
- iChar
- The character to append to the CATString
- Returns:
- The CATString resulting from the concatenation
o operator +=
-
"+=" 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 +=
-
String concatenation assignment operator.
- Parameters:
-
- iString
- The string to append to the current one
- Returns:
- The class resulting from the concatenation
o operator +=
-
"+=" 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 +=
-
C string concatenation assignment operator.
- Parameters:
-
- iString
- The String to append to the current one
- Returns:
- The class resulting from the concatenation
o operator +=
-
"+=" 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 +=
-
"+=" 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 +=
-
"+=" 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 CATString & operator +=( | unsigned long | 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 =
-
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 =
-
Assignment operator.
- Parameters:
-
- iString
- The string to assign to the current one
- Returns:
- The class resulting from the assignment
o operator ==
public int operator ==( | const CATString& | iString)const |
-
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 int operator ==( | const char* | iString)const |
-
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 CATString operator()( | int | begin, |
| int | end) const |
-
"()" 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[]
-
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: JS0GROUP