System CATUnicodeString
Usage: you must use this class as is. You should never derive it.
public class CATUnicodeString
Class to use for NLS character strings.
Role:
CATUnicodeString (to compare to the class) must be used whenever a character string is
needed, and that is either seen, entered, or manipulated by the
end user. In this way, the client application is shielded from
implementation details regarding language, locale, bytecoding
of characters, and so forth. Client applications thus become
portable since they can handle character strings expressed in
any language.
When NLS support is not required, you can use instead the
class from the System framework. It does support only ISO 646, so that to supress all the problems that arise
with NLS complexity. You should never use the raw char * type.
Note: Among the methods to manipulate instances of this class, you will find below some references to the
Unicode standard, to UTF-8, and to UTF-16. Unicode is a standard designed and promoted by the unicode consortium, it
encodes characters on two bytes. CATIA NLS strings in internalized data are encoded in Unicode 3.0 (see the code
charts at http://www.unicode.org ). UTF-8 is a transformation format used as a file code set, in particular for CATIA
persistent data. UTF-16 is used in particular by XML processors, in particular by XML parsers. The ISO 10646 standard
is built on the top of unicode, it includes several code sets: Unicode, known here as UCS-2 (for Universal
Multiple-Octet Coded Character Set 2-byte form), UTF-8, UTF-16 and so on ...
Note: You will find also below some references to the STEP Standard. It is descibed in ISO 10133 .
Note: You will find also below some references to the SBCS acronym. SBCS is for Single Byte Character
Set, and MBCS for Multi Byte Character Set. They both correspond to localized character set (specific to a given
country langage, at the opposite of Unicode, which describes several country character sets simutaneously). In
internationalization history, SBCS and MBCS are anterior to Unicode. For example, the ISO 8859-1 encoding describes
several west european languages. It is a SBCS encoding, meaning that a char* in this encoding had to be interpreted
at the byte level (each byte corresponding to one and only one character in the Code Page, which could be described
graphically as a 16 per 16 table, ordered trough the 4 first bits horizontally and its 4 last bits vertical, i.e.
hexa code). The IBM-932 Code Page is an example of MBCS encoding, i.e. a char * having to be interpreted in this
Code Page would have to be read the following way:
. read the first byte, if the dedicated columns (see the
hexa code graphic representation mentionned above),
i.e. the 8,9,E and F column for IBM-932, are set
to zero, the byte will be interpreted alone
(latin or single-width katakana)
. otherwise, i.e. if one of the 8,9,E and F column is set,
the byte, to be interpreted, will have to have the next
byte read (consequently, it makes two bytes together). This
solutions enables to give access to the several thousands
of characters that the IBM-932 describes.
. and so on ...
CAUTION: The methods manipulating char* should rarely be used. They may be used:
- combined with the use of Unix MOTIF services
- to display debug traces on the stdout
The best way to manipulate strings is to use the Unicode encoding, the char* has many limitations.
Suppose, for example, you call the CATUnicodeString constructor from a "const char*" on Windows, and, during
execution, the given char* contains one byte, B1 in hexa, followed by the NULL byte which ends the string. Then, the
constructor from a char* will behave the following way:
- if the General\"Settings for the current user" field in the "Control Panel"\"Regional Options" window is set to
English, the built CATUnicodeString will contain the "PLUS-MINUS SIGN" character
- if it set on Japanese, the built CATUnicodeString will contain the "HALFWIDTH KATAKANA LETTER A" character
- if it set on Korean, the built CATUnicodeString will have the following behavior:
- a call to
onto the CATUnicodeString will give one CATUC2Bytes containing the 003F character ("QUESTION MARK", which is the default character)
- a call to
onto the CATUnicodeString will give a char* containing one byte, the B1 byte
Actually, the B1 code belongs to the range of two-bytes code representations
CAUTION: This class uses the current locale. If you changed the locale in your applicative code, using
the setlocale sytem call for example, you must manage so that, before calling a method of this class, the current
locale be the locale which was the current locale when CATIA was run:
- a Japanese localized string is in the IBM 932 code page. The characters, in the IBM 932
code page, have a code representation on one or two bytes, depending the range of the first character
- The mblen system call enables, for example when parsing a japanese localized string, to precise if the current
string character code representation takes one or two bytes
- the CATUnicodeString constructor from a const char* calls the mblen system call
Consequently, if your applicative code calls the setlocale method, and you call a CATUnicodeString method without
having previously restore the locale to the one which was the current locale when CATIA was run, the
CATUnicodeString method will not be able to parse localized strings.
More generally, if your applicative code changes the locale, manage so that, before calling any CAA method, the
current locale be the locale which was the current locale when CATIA was run.
Constructor and Destructor Index
- o
CATUnicodeString()
- Constructs an empty Unicode string.
- o
CATUnicodeString(char* const)
- Constructs a CATUnicodeString instance from a char *.
- o
CATUnicodeString(char* const,size_t)
- Constructs a CATUnicodeString instance from a char * and a
number of characters.
- o
CATUnicodeString(CATUnicodeString&)
- Copy constructor.
- o
CATUnicodeString(CATUnicodeChar&,size_t)
- Constructs a CATUnicodeString instance by repeating a given
character.
- o
CATUnicodeString(CATUnicodeString&,size_t)
- Constructs a CATUnicodeString instance by repeating a given
character string.
- o
~CATUnicodeString()
-
Method Index
- o
Append(CATUnicodeString&)
- Concatenates CATUnicodeString instances.
- o
BuildFromBSTR(CATBSTR&)
- Recycles an existing CATUnicodeString instance from a BSTR-encoded character
string.
- o
BuildFromNum(int,char*)
- Converts, formats and stores a specified integer, under control of the format parameter, into the current string.
- o
BuildFromNum(long,char*)
- Converts, formats and stores a specified long integer, under control of the format parameter, into the current
string.
- o
BuildFromNum(double,char*)
- Converts, formats and stores a specified double, under control of the format parameter, into the current string.
- o
BuildFromNum(CATLONG64,char*)
- Converts, formats and stores a specified 64-bit signed long integer,
under control of the format parameter, into the current string.
- o
BuildFromNum(CATULONG64,char*)
- Converts, formats and stores a specified 64-bit unsigned long integer,
under control of the format parameter, into the current string.
- o
BuildFromNum(long double,char*)
- Converts, formats and stores a specified unsigned long integer, under control of the format parameter, into the
current string.
- o
BuildFromNum(unsigned int,char*)
- Converts, formats and stores a specified unsigned integer, under control of the format parameter, into the current
string.
- o
BuildFromNum(unsigned long,char*)
- Converts, formats and stores a specified unsigned long integer, under control of the format parameter, into the
current string.
- o
BuildFromSTEP(char*)
- Converts, formats and stores a specified STEP character string,
into the current string.
- o
BuildFromStream(istream&,int)
- Converts, formats and stores a specified input stream,
into the current string.
- o
BuildFromUCChar(CATUC2Bytes*,int)
- Converts an array of Unicode characters into the current
string.
- o
BuildFromUTF16(unsigned short*,size_t)
- Converts, formats and stores a specified UTF-16 encoded
character string (about UTF-16, see above), into the current
string.
- o
BuildFromUTF8(char*,size_t)
- Converts, formats and stores a specified UTF-8 encoded
character string (about UTF-8, see above), into the current
string.
- o
BuildFromWChar(wchar_t*)
- Converts an array of Unicode characters into the current
string.
- o
Compare(CATUnicodeString&)
- Compares CATUnicodeString instances.
- o
ConvertToBSTR(CATBSTR*)
- Convert the current string into a BSTR (OLE basic string).
- o
ConvertToChar()
- Converts the string to a char *.
- o
ConvertToNum(int*,char*)
- Read character data, supposed to describe an integer
in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- o
ConvertToNum(long*,char*)
- Read character data, supposed to describe a long integer
in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- o
ConvertToNum(double*,char*)
- Read character data, supposed to describe an double in an
alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- o
ConvertToNum(CATLONG64*,char*)
- Read character data, supposed to describe a 64-bit long integer
in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- o
ConvertToNum(CATULONG64*,char*)
- Read character data, supposed to describe a 64-bit unsigned long
integer in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- o
ConvertToNum(long double*,char*)
- Read character data, supposed to describe an long double in an alphanumerical form, interpret it according to
a format, and store the converted result into the output parameter.
- o
ConvertToNum(unsigned int*,char*)
- Read character data, supposed to describe an unsigned
integer in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- o
ConvertToNum(unsigned long*,char*)
- Read character data, supposed to describe an unsigned long
integer in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- o
ConvertToSTEP(char*)
- Convert the current string into a STEP character string.
- o
ConvertToUTF16(unsigned short*,size_t*)
- Convert the current string into a UTF-16 character string.
- o
ConvertToUTF8(char*,size_t*)
- Convert the current string into a UTF-8 character string.
- o
ConvertToWChar(wchar_t*)
- Converts the current string to a wchar_t character encoded
string.
- o
GetLengthInByte()
- Get the length of the CATUnicodeString, as byte count.
- o
GetLengthInChar()
- Get the length of the CATUnicodeString, as unicode char count.
- o
Insert(int,CATUnicodeString&)
- Modify the current CATUnicodeString, inserting a given
substring at the middle of it.
- o
Remove(int,int)
- Modify the current CATUnicodeString, supressing a given part
of it.
- o
ReplaceAll(CATUnicodeString&,CATUnicodeString&)
- Modify the current CATUnicodeString, replacing all the occurences of the specified substring
with another substring.
- o
ReplaceSubString(int,int,CATUnicodeString&)
- Modify the current CATUnicodeString, supressing a given part of it
and putting instead a given replacement substring.
- o
ReplaceSubString(int,int,CATUnicodeString&,int)
- Modify the current CATUnicodeString, supressing a given part of it
and putting instead a given replacement substring.
- o
ReplaceSubString(CATUnicodeString&,CATUnicodeString&)
- Replace the first occurence of the given substring by the
other given substring.
- o
Resize(int)
- Extends or truncates the current string.
- o
Resize(int,CATUnicodeChar&)
- Extends or truncates the current string.
- o
Resize(int,CATUnicodeChar&,int)
- Extends or truncates the current string.
- o
SearchSubString(CATUnicodeString&,int,CATUnicodeString::CATSearchMode)
- Search the first occurence of the specified substring in the
current string.
- o
SortCompare(CATUnicodeString&)
- Compares CATUnicodeString instances in a non locale specific way.
- o
Strip()
- Returns a new stripped CATUnicodeString.
- o
Strip(CATUnicodeString::CATStripMode)
- Returns a new stripped CATUnicodeString.
- o
Strip(CATUnicodeString::CATStripMode,CATUnicodeChar&)
- Returns a new stripped CATUnicodeString.
- o
SubString(int,int)
- Returns a new string that is a substring of this string.
- o
ToLower()
- Converts all of the upper characters in this String to lower
case.
- o
ToUpper()
- Converts all of the lower characters in this String to upper
case.
- o
operator !=(CATUnicodeString&)
- Inequality operator.
- o
operator >(CATUnicodeString&)
- Greater-than operator.
- o
operator >=(CATUnicodeString&)
- Greater-than or equal operator.
- o
operator <(CATUnicodeString&)
- Less-than operator.
- o
operator <=(CATUnicodeString&)
- Less-than or equal operator.
- o
operator +(char*)
- String concatenation operator.
- o
operator +=(CATUnicodeChar&)
- Character concatenation assignment operator.
- o
operator =(char*)
- Assignment operator from a char *.
- o
operator =(CATUnicodeString&)
- Assignment operator from a CATUnicodeString instance.
- o
operator ==(CATUnicodeString&)
- Equality operator.
- o
operator const CATUC2Bytes *()
- Converts the current string to a CATUC2Bytes character encoded
string.
- o
operator[](size_t)
- Returns the character at the specified index.
Enumerated Type Index
- o
CATSearchMode
- Search mode.
- o
CATStripMode
- Strip mode.
Constructor and Destructor
o CATUnicodeString
public CATUnicodeString( | ) |
-
Constructs an empty Unicode string.
o CATUnicodeString
public CATUnicodeString( | const | iString) |
-
Constructs a CATUnicodeString instance from a char *.
CAUTION: The best way to manipulate strings is to use the Unicode encoding. The use of
is better than the use of the current constructor. In fact, CATIA uses this method for the rare conversions from the thread code page to Unicode, i.e. :
- parsing of message catalog strings
- interactive input of strings on Unix
- reading strings in databases
- Parameters:
-
- iString
- The pointer to the character string
o CATUnicodeString
public CATUnicodeString( | const | iString, |
| | iLength) |
-
Constructs a CATUnicodeString instance from a char * and a
number of characters.
CAUTION: The best way to manipulate strings is to use the Unicode encoding. The use of
is better than the use of the current constructor.
- Parameters:
-
- iString
- The pointer to the character string
- iLength
- The number of characters to be taken into account, starting at
the first character.
Legal values: Must be less than or equal to the total
number of characters contained in iString
o CATUnicodeString
public CATUnicodeString( | const | iString) |
-
Copy constructor.
- Parameters:
-
- iString
- The Unicode string to copy
o CATUnicodeString
public CATUnicodeString( | const | iChar, |
| | iRepeatCount | =1) |
-
Constructs a CATUnicodeString instance by repeating a given
character.
- Parameters:
-
- iChar
- The character to be repeated
- iRepeatCount
- The number of times iChar is to be repeated
o CATUnicodeString
public CATUnicodeString( | const | iString, |
| | iRepeatCount) |
-
Constructs a CATUnicodeString instance by repeating a given
character string.
- Parameters:
-
- iString
- The character string to be repeated
- iRepeatCount
- The number of times iString is to be repeated
o ~CATUnicodeString
public ~CATUnicodeString( | ) |
-
Methods
o Append
public Append( | const | iString) |
-
Concatenates CATUnicodeString instances.
The string passed as a parameter is appended to the current string.
For example:
CATUnicodeString Hello("Hello");
CATUnicodeString Goodbye("Goodbye");
Hello.Append(Goodbye); // Hello now contains "HelloGoodbye"
o BuildFromBSTR
public BuildFromBSTR( | const | iBSTR) |
-
Recycles an existing CATUnicodeString instance from a BSTR-encoded character
string.
A BSTR is a Basic string, or binary string, ie a pointer to a wide
character string.
- Parameters:
-
- iBSTR
- The pointer to the BSTR-wide character string
- Returns:
- boolean specifying the success or not of the action
Legal values: 0 if the conversion
succeeded, or negative value if the conversion did
not succeed.
o BuildFromNum
public BuildFromNum( | | iIntegerValue, |
| const | iCFormat | ="%d") |
-
Converts, formats and stores a specified integer, under control of the format parameter, into the current string.
- Parameters:
-
- iIntegerValue
- The integer value
- iCFormat
- The format of the integer value, defaulted to "%d", according to the sprintf
library function base conversions
- Returns:
- Output string length
Legal values: 0 if the conversion didn't
succeed, or Other if the conversion did succeed,
in which case the value will be the byte count of the
char * equivalent to the result string.
o BuildFromNum
public BuildFromNum( | | iLongIntegerValue, |
| const | iCFormat | ="%d") |
-
Converts, formats and stores a specified long integer, under control of the format parameter, into the current
string.
- Parameters:
-
- iLongIntegerValue
- The long integer value
- iCFormat
- The format of the long integer value, defaulted to "%d", according to the
sprintf library function base conversions
- Returns:
- Output string length
Legal values: 0 if the conversion didn't
succeed, or Other if the conversion did succeed,
in which case the value will be the byte count of the
char * equivalent to the result string.
o BuildFromNum
public BuildFromNum( | | iDoubleValue, |
| const | iCFormat | ="%g") |
-
Converts, formats and stores a specified double, under control of the format parameter, into the current string.
CAUTION: Regarding the decimal symbol, i.e. the character separing the integer whole number portion from
its decimal portion, this service consider that it is the one corresponding to the locale. For example, on Windows,
if the value for the Numbers\"Decimal symbol" field of the "Control Panel"\"Regional Options" window is equal to
the following string:
{
then, a 1.1 number given to this service will create the following
:
1{1
- Parameters:
-
- iDoubleValue
- The double value
- iCFormat
- The format of the double value, defaulted to "%g", according
to the sprintf library function base conversions
- Returns:
- Output string length
Legal values: 0 if the conversion didn't
succeed, or Other if the conversion did succeed,
in which case the value will be the byte count of the
char * equivalent to the result string.
o BuildFromNum
public BuildFromNum( | | iIntegerValue, |
| const | iCFormat | =FMTLONGI64"d") |
-
Converts, formats and stores a specified 64-bit signed long integer,
under control of the format parameter, into the current string.
Defined on 64-bits platforms only.
- Parameters:
-
- iLong64Value
- The 64-bit long integer value
- iCFormat
- The format of the 64-bit long integer value, defaulted
to "%I64d" on 64-bit Windows,
according to the sprintf library function base conversions
- Returns:
- Output string length
Legal values: 0 if the conversion didn't
succeed, or Other if the conversion did succeed,
in which case the value will be the byte count of the
char * equivalent to the result string.
o BuildFromNum
public BuildFromNum( | | iUnsIntegerValue, |
| const | iCFormat | =FMTLONGI64"u") |
-
Converts, formats and stores a specified 64-bit unsigned long integer,
under control of the format parameter, into the current string.
Defined on 64-bits platforms only.
- Parameters:
-
- iLong64UnsignedValue
- The 64-bit unsigned long integer value
- iCFormat
- The format of the 64-bit unsigned long integer value, defaulted
to "%I64u" on 64-bit Windows,
according to the sprintf library function base conversions
- Returns:
- Output string length
Legal values: 0 if the conversion didn't
succeed, or Other if the conversion did succeed,
in which case the value will be the byte count of the
char * equivalent to the result string.
o BuildFromNum
public BuildFromNum( | | iLongDoubleValue, |
| const | iCFormat | ="%Lg") |
-
Converts, formats and stores a specified unsigned long integer, under control of the format parameter, into the
current string.
CAUTION: Regarding the decimal symbol, i.e. the character separing the integer whole number portion from
its decimal portion, this service consider that it is the one corresponding to the locale, See
, overloading version with a double.
- Parameters:
-
- iLongDoubleValue
- The long double value
- iCFormat
- The format of the long double value, defaulted to "%Lg",
according to the sprintf library function base conversions
- Returns:
- Output string length
Legal values: 0 if the conversion didn't
succeed, or Other if the conversion did succeed,
in which case the value will be the byte count of the
char * equivalent to the result string.
o BuildFromNum
public BuildFromNum( | | iIntegerValue, |
| const | iCFormat | ="%d") |
-
Converts, formats and stores a specified unsigned integer, under control of the format parameter, into the current
string.
- Parameters:
-
- iUnsignedIntegerValue
- The unsigned integer value
- iCFormat
- The format of the unsigned integer value, defaulted to "%d", according
to the sprintf library function base conversions
- Returns:
- Output string length
Legal values: 0 if the conversion didn't
succeed, or Other if the conversion did succeed,
in which case the value will be the byte count of the
char * equivalent to the result string.
o BuildFromNum
public BuildFromNum( | | iUnsLongIntegerValue, |
| const | iCFormat | ="%u") |
-
Converts, formats and stores a specified unsigned long integer, under control of the format parameter, into the
current string.
- Parameters:
-
- iUnsLongIntegerValue
- The unsigned long integer value
- iCFormat
- The format of the unsigned long integer value, defaulted to
"%u", according to the sprintf library function base
conversions
- Returns:
- Output string length
Legal values: 0 if the conversion didn't
succeed, or Other if the conversion did succeed,
in which case the value will be the byte count of the
char * equivalent to the result string.
o BuildFromSTEP
public BuildFromSTEP( | const | iStepString) |
-
Converts, formats and stores a specified STEP character string,
into the current string.
Refer to part 21 of STEP for details about string encoding.
- Parameters:
-
- iStepString
- The pointer to the Step-encoded character string
- Returns:
- boolean specifying the success or not of the action
Legal values: 0 if the conversion
succeeded, or -1 if the conversion did not succeed.
o BuildFromStream
public BuildFromStream( | | iInputStream, |
| | iSkipWhite | = 1) |
-
Converts, formats and stores a specified input stream,
into the current string.
- Parameters:
-
- iInputStream
- The input stream
- iSkipWhite
- The flag to indicate whether white lines must be skipped (!=0) or not (=0)
- Returns:
- The input stream.
o BuildFromUCChar
public BuildFromUCChar( | const | iUnicodeString, |
| | iStringLength) |
-
Converts an array of Unicode characters into the current
string.
About the Unicode standard, see above.
- Parameters:
-
- iUnicodeString
- The table of Unicode characters
- iStringLength
- The string length in unicode characters count
- Returns:
- Boolean specifying the success or not of the action
Legal values: 1 if the string has been
successfully converted, or -1 if a problem
occured during the conversion.
o BuildFromUTF16
public BuildFromUTF16( | const | iUTF16Data, |
| | iUnsignedShortCount) |
-
Converts, formats and stores a specified UTF-16 encoded
character string (about UTF-16, see above), into the current
string.
- Parameters:
-
- iUTF16Data
- The pointer to the UTF-16 encoded character string
- iUnsignedShortCount
- The length of iUTF16Data in byte pairs count
- Returns:
- boolean specifying the success or not of the action
Legal values: 1 if the conversion
succeeded, or negative value if the conversion did
not succeed.
o BuildFromUTF8
public BuildFromUTF8( | const | iUTF8Data, |
| | iByteCount) |
-
Converts, formats and stores a specified UTF-8 encoded
character string (about UTF-8, see above), into the current
string.
- Parameters:
-
- iUTF8Data
- The pointer to the UTF-8 encoded character string
- iByteCount
- The length of iUTF8Data in bytes
- Returns:
- boolean specifying the success or not of the action
Legal values: 0 if the conversion
succeeded, or negative value if the conversion did
not succeed.
o BuildFromWChar
public BuildFromWChar( | const | iUnicodeString) |
-
Converts an array of Unicode characters into the current
string.
- Parameters:
-
- iUnicodeString
- The table of Unicode characters
- iNbChar
- The number of Unicode characters in the table
- Returns:
-
- Returns:
- Integer specifying the success or not of the action
Legal values: 0 if the string has been
successfully converted and its length equals to zero,
1 if the string has been successfully converted
and its length does not equal to zero, or -1
if a problem occured during the conversion.
o Compare
public Compare( | const | iString) |
-
Compares CATUnicodeString instances.
- Returns:
- 2 if the strings are identical, 1 if only case differences are
found ("Hello" == "hello"), and 0 otherwise.
o ConvertToBSTR
public ConvertToBSTR( | | oBSTR) |
-
Convert the current string into a BSTR (OLE basic string).
- Parameters:
-
- oBSTR
- The resulting BSTR string
o ConvertToChar
-
Converts the string to a char *.
Role: Converts the current string to a char* in the thread locale code page. The use of this service
corresponds to strings for which all characters belong to the character set of the thread locale code page.
Note: The length of the returned string is given by
. If the string has been created using
,
,
,
,
or
, and a character of the string does not exist in the thread locale code page, the character will be replaced, in the returned C string, by the following
coded representation:
+-------------------------+------------+------------+------------+------------+------------+
! thread locale code page ! Windows ! AIX ! HP-UX ! IRIX ! SunOS !
+-------------------------+------------+------------+------------+------------+------------+
+-------------------------+------------+------------+------------+------------+------------+
! ISO 8859-1 ! 3F ! 1A ! 1A ! 3F ! 3F !
+-------------------------+------------+------------+------------+------------+------------+
! ISO 8859-2 ! 3F ! 1A ! 1A ! 3F ! 3F !
+-------------------------+------------+------------+------------+------------+------------+
! ISO 8859-5 ! 3F ! 1A ! 1A ! 3F ! 3F !
+-------------------------+------------+------------+------------+------------+------------+
! IBM 943 ! 3F ! 7F or FCFC ! FCFC ! 3F ! 3F !
+-------------------------+------------+------------+------------+------------+------------+
! EUC KR ! 3F ! 1A or AFFE ! FFFF ! 3F ! 3F3F !
+-------------------------+------------+------------+------------+------------+------------+
! EUC TW ! 3F ! 1A or FDFE ! FEFE ! 3F ! 3F3F !
+-------------------------+------------+------------+------------+------------+------------+
! EUC CN ! 3F ! 1A or A1A1 ! FFFF ! 3F ! 3F3F !
+-------------------------+------------+------------+------------+------------+------------+
CAUTION: The best way to manipulate strings is to use the Unicode encoding. The use of the following method:
operator const CATUC2Bytes*() const;
is better than the use of the current operator. In fact, CATIA
uses the current method for the rare conversions from Unicode to the thread code page, i.e. :
- the display of message strings in dialog windows on Unix
- the edition of strings on Unix
- output traces
- storing strings in databases
- Returns:
- The char*
o ConvertToNum
public ConvertToNum( | | oIntegerValue, |
| const | iCFormat | ="%d") |
-
Read character data, supposed to describe an integer
in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- Parameters:
-
- oIntegerValue
- The resulting integer value
- iCFormat
- The format of the integer value, defaulted to "%d", according to the sprintf
library function base conversions
- Returns:
- Boolean specifying the success or not of the action
Legal values: 0 if the conversion didn't
succeed, or 1 if the conversion did succeed.
o ConvertToNum
public ConvertToNum( | | olongIntegerValue, |
| const | iCFormat | ="%d") |
-
Read character data, supposed to describe a long integer
in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- Parameters:
-
- olongIntegerValue
- The resulting integer value
- iCFormat
- The format of the integer value, defaulted to "%d", according to the sprintf
library function base conversions
- Returns:
- Boolean specifying the success or not of the action
Legal values: 0 if the conversion didn't
succeed, or 1 if the conversion did succeed.
o ConvertToNum
public ConvertToNum( | | oDouble, |
| const | iCFormat | ="%le") |
-
Read character data, supposed to describe an double in an
alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
CAUTION: Regarding the decimal symbol, i.e. the character separing the integer whole number portion from
its decimal portion, this service consider that it is the one corresponding to the locale. For example, on Windows,
if the value for the Numbers\"Decimal symbol" field of the "Control Panel"\"Regional Options" window is equal to
the following string:
{
then, so that the current method give the correct value, a 1.1 number must be stored the following way in the
instance:
1{1
- Parameters:
-
- oDouble
- The resulting integer value
- iCFormat
- The format of the integer value, defaulted to "%le", according to the sprintf
library function base conversions
- Returns:
- Boolean specifying the success or not of the action
Legal values: 0 if the conversion didn't
succeed, or 1 if the conversion did succeed.
o ConvertToNum
public ConvertToNum( | | olongIntegerValue, |
| const | iCFormat | =FMTLONGI64"d") |
-
Read character data, supposed to describe a 64-bit long integer
in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- Parameters:
-
- olongIntegerValue
- The resulting 64-bit long integer value
- iCFormat
- The format of the integer value, defaulted to "%I64d" on 64-bit Windows,
according to the sprintf library function base conversions
- Returns:
- Boolean specifying the success or not of the action
Legal values: 0 if the conversion didn't
succeed, or 1 if the conversion did succeed.
o ConvertToNum
public ConvertToNum( | | oUnslongIntegerValue, |
| const | iCFormat | =FMTLONGI64"u") |
-
Read character data, supposed to describe a 64-bit unsigned long
integer in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- Parameters:
-
- oUnslongIntegerValue
- The resulting 64-bit unsigned long integer value
- iCFormat
- The format of the integer value, defaulted to "%I64u" on 64-bit Windows
according to the sprintf library function base conversions
- Returns:
- Boolean specifying the success or not of the action
Legal values: 0 if the conversion didn't
succeed, or 1 if the conversion did succeed.
o ConvertToNum
public ConvertToNum( | | oLongDouble, |
| const | iCFormat | ="%le") |
-
Read character data, supposed to describe an long double in an alphanumerical form, interpret it according to
a format, and store the converted result into the output parameter.
CAUTION: Regarding the decimal symbol, i.e. the character separing the integer whole number portion from
its decimal portion, this service consider that it is the one corresponding to the locale, See
, overloading version with a double.
- Parameters:
-
- oLongDouble
- The resulting integer value
- iCFormat
- The format of the integer value, defaulted to "%le", according to the sprintf
library function base conversions
- Returns:
- Boolean specifying the success or not of the action
Legal values: 0 if the conversion didn't
succeed, or 1 if the conversion did succeed.
o ConvertToNum
public ConvertToNum( | | oUnsIntegerValue, |
| const | iCFormat | ="%u") |
-
Read character data, supposed to describe an unsigned
integer in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- Parameters:
-
- oUnsIntegerValue
- The resulting integer value
- iCFormat
- The format of the integer value, defaulted to "%u", according to the sprintf
library function base conversions
- Returns:
- Boolean specifying the success or not of the action
Legal values: 0 if the conversion didn't
succeed, or 1 if the conversion did succeed.
o ConvertToNum
public ConvertToNum( | | oUnslongIntegerValue, |
| const | iCFormat | ="%u") |
-
Read character data, supposed to describe an unsigned long
integer in an alphanumerical form, interpret it according to
a format, and store the converted result into the output
parameter.
- Parameters:
-
- oUnslongIntegerValue
- The resulting integer value
- iCFormat
- The format of the integer value, defaulted to "%u", according to the sprintf
library function base conversions
- Returns:
- Boolean specifying the success or not of the action
Legal values: 0 if the conversion didn't
succeed, or 1 if the conversion did succeed.
o ConvertToSTEP
public ConvertToSTEP( | | oStepString) |
-
Convert the current string into a STEP character string.
- Parameters:
-
- oStepString
- The resulting STEP string
o ConvertToUTF16
public ConvertToUTF16( | | oUTF16String, |
| | oUnsignedShortCount) |
-
Convert the current string into a UTF-16 character string.
- Parameters:
-
- oUTF16Data
- The resulting UTF-16 string
It should be allocated as a table of
4*(this->GetLengthInChar()) bytes
- oUnsignedShortCount
- String length in unsigned short count
o ConvertToUTF8
public ConvertToUTF8( | | oUTF8String, |
| | oByteCount) |
-
Convert the current string into a UTF-8 character string.
- Parameters:
-
- oUTF8String
- The resulting UTF-8 string
It should be allocated as a table of
4*(this->GetLengthInChar()) elements
- oByteCount
- String length in byte count
o ConvertToWChar
public ConvertToWChar( | | oString) |
-
Converts the current string to a wchar_t character encoded
string.
- Returns:
- The resulting wchar_t string
o GetLengthInByte
-
Get the length of the CATUnicodeString, as byte count.
Role: Get the length as byte count.
This method returns the length of the string returned by
.
- Returns:
- Byte count.
o GetLengthInChar
-
Get the length of the CATUnicodeString, as unicode char count.
Role: Get the length as unicode char count.
This method returns the length of the string returned by
.
- Returns:
- Character count.
o Insert
public Insert( | | iInsertionStartingPosition, |
| const | iStringToInsert) |
-
Modify the current CATUnicodeString, 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 Remove
public Remove( | | iModificationStartingPosition, |
| | iModificationCharCount | =1) |
-
Modify the current CATUnicodeString, supressing a given part
of it.
- Parameters:
-
- iModificationStartingPosition
- The modification starting position
- iModificationCharCount
- The modification char count
o ReplaceAll
public ReplaceAll( | const | iToReplace, |
| const | iReplacement) |
-
Modify the current CATUnicodeString, replacing all the occurences of the specified substring
with another substring.
- Parameters:
-
- iToReplace
- The substring to replace
- iReplacement
- The replacement substring
o ReplaceSubString
public ReplaceSubString( | | iModificationStartingPosition, |
| | iModificationCharCount, |
| const | iReplacementString) |
-
Modify the current CATUnicodeString, 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 CATUnicodeString, 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 CATUnicodeString that will be used for the substitution,
i.e. the CATUnicodeString 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( | | iCharCountToReach) |
-
Extends or truncates the current string.
Same as the preceeding version, except that the filling
character is forced to be set to the space character.
- Parameters:
-
- iCharCountToReach
- The number of characters to be assigned to the current string
o Resize
public Resize( | | iCharCountToReach, |
| const | iFillingChar) |
-
Extends or truncates the current string.
Same as the preceeding version, except that truncation is
forced to be allowed.
- Parameters:
-
- iCharCountToReach
- The number of characters to be assigned to the current string
- iFillingChar
- The character that will be added at the end of the
current string so that to map the required length
o Resize
public Resize( | | iCharCountToReach, |
| const | iFillingChar, |
| | iTruncationAllowed) |
-
Extends or truncates the current string.
- Parameters:
-
- iCharCountToReach
- The number of characters to be assigned to the current string
- iFillingChar
- The character that will be added at the end of the
current string so that to map the required length
- iTruncationAllowed
- The flag allowing the truncation or refusing it.
Legal values: 0 to forbid truncation,
or Other to allow the possible truncation.
o SearchSubString
public SearchSubString( | const | iLookedForSubString, |
| | iSearchBeginning | = 0, |
| | iSearchMode | = CATSearchModeForward) |
-
Search the first occurence of the specified substring in the
current string.
Role: Search the first occurence of the specified
substring in the current string, from a specified character
index, the search following the specified direction.
- Parameters:
-
- iLookedForSubString
- The character string to search for
- iSearchBeginning
- The character index localizing the search beginning
- iSearchMode
- Direction to which you search the specified substring in the
current string.
Legal values: CATSearchModeForward if,
starting from the specified current string character index,
the search will go forward to search the specified substring,
or CATSearchModeBackward in the other direction.
Note that in CATSearchModeBackward mode, the
iSearchBeginning index corresponds to a count of characters
from the end of the string, not the beginning.
For instance:
CATUnicodeString s = "012345678901test6789";
s.SearchSubString("test", 4, CATUnicodeString::CATSearchModeBackward)) returns 12
whereas
s.SearchSubString("test", 5, CATUnicodeString::CATSearchModeBackward)) returns -1
- Returns:
- Location of the substring.
Legal values:
-1: Not found
Other: Location index, from 0 to the current CATString
length minus 1
o SortCompare
public SortCompare( | const | iStringToCompare) |
-
Compares CATUnicodeString instances in a non locale specific way.
The SortCompare method differs from the operators > (and <) in that the comparison is
not affected by locale, whereas the manner of operators > (and <) comparisons is determined
by the LC_COLLATE category of the current locale.
- Returns:
- < 0 if the current string is less than iStringToCompare.
0 if the strings are identical.
> 0 if the current string is greater than iStringToCompare.
o Strip
-
Returns a new stripped CATUnicodeString.
Role: Removes the space character occurences from a
given string using the CATStripModeLeading mode (see above).
Note that this method returns a new stripped string but does
not modify the current CATUnicodeString.
o Strip
-
Returns a new stripped CATUnicodeString.
Role: Removes the space character occurences from a
given string. Note that this method returns a new stripped string but does
not modify the current CATUnicodeString.
- Parameters:
-
- iMode
- See above
o Strip
public Strip( | | iMode, |
| const | iCharacter) |
-
Returns a new stripped CATUnicodeString.
Role: Removes the specified character occurences from a
given string. Note that this method returns a new stripped string but does
not modify the current CATUnicodeString.
- 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 specified character whose occurences are to be removed
from the current CATUnicodeString.
o SubString
public SubString( | | iSubStringFirstIndex, |
| | iSubStringCharCount) |
-
Returns a new string that is a substring of this string.
- Parameters:
-
- iSubStringFirstIndex
- The first character to be extracted
- iNbCharsToExtract
- The number of characters to be extracted
o ToLower
-
Converts all of the upper characters in this String to lower
case.
o ToUpper
-
Converts all of the lower characters in this String to upper
case.
o operator !=
public operator !=( | const | iString) |
-
Inequality operator.
- Parameters:
-
- iString
- The string to compare to the current one
- 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 operator.
- Parameters:
-
- iString
- The string to compare to the current one
- 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 or equal operator.
- Parameters:
-
- iString
- The string to compare to the current one
- 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 operator.
- Parameters:
-
- iString
- The string to compare to the current one
- 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 operator.
- Parameters:
-
- iString
- The string to compare to the current one
- 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) |
-
String concatenation operator.
CAUTION: The best way to manipulate strings is to use the Unicode encoding. The use of the
method (const CATUnicodeString overriding version) is better than the use of the current operator.
- Parameters:
-
- iString
- The string to append to the current one
- Returns:
- The class resulting from the concatenation
o operator +=
public operator +=( | const | iChar) |
-
Character concatenation assignment operator.
- Parameters:
-
- iChar
- The character to append to the current string
- Returns:
- The class resulting from the concatenation
o operator =
public operator =( | const | iString) |
-
Assignment operator from a char *.
CAUTION: The best way to manipulate strings is to use the Unicode encoding. The use of the
method is better than the use of the current operator.
- Parameters:
-
- iString
- The string to be copied
- Returns:
- The string resulting from the assignment
o operator =
public operator =( | const | iString) |
-
Assignment operator from a CATUnicodeString instance.
- Parameters:
-
- iString
- The provided string
- Returns:
- The string resulting from the assignment
o operator ==
public operator ==( | const | iString) |
-
Equality operator.
- Parameters:
-
- iString
- The string to compare to the current one
- Returns:
- boolean
Legal values: 0: False
the condition is not fullfilled, or Other: True
if the condition is fullfilled.
o operator const CATUC2Bytes *
public operator const CATUC2Bytes *( | ) |
-
Converts the current string to a CATUC2Bytes character encoded
string.
The length of the returned string is given by
.
- Returns:
- The resulting CATUC2Bytes string
o operator[]
public operator[]( | | iIndex) |
-
Returns the character at the specified index.
An index ranges from 0 to the string length - 1.
Bound checks are performed.
- Parameters:
-
- iIndex
- The index of the character to extract
Enumerated Types
o CATSearchMode
-
enum CATSearchMode {
CATSearchModeForward,
CATSearchModeBackward
}
Search mode.
Role: The search mode is the direction to which
you search the specified substring in the current string.
- Parameters:
-
- CATSearchModeForward
- Starting from the specified current string character index,
the search will go forward to search the specified substring.
- CATSearchModeBackward
- Starting from the specified current string character index,
the search will go backward to search the specified
substring.
o CATStripMode
-
enum CATStripMode {
CATStripModeLeading,
CATStripModeTrailing,
CATStripModeBoth,
CATStripModeAll
}
Strip mode.
Role: Stripping is the process consisting
of removing a given 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: CATUnicodeString.h
If needed, your Imakefile.mk should include the module: CATSysTS
Copyright © 1999-2015, Dassault Systèmes. All rights reserved.