![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
A variable-length sequence of "extended" (UNICODE) characters (16-bit character type). It provides editing operations with built-in memory management to make ExtendedString objects easier to use than ordinary extended character arrays. ExtendedString objects follow "value semantics", that is, they are the actual strings, not handles to strings, and are copied through assignment. You may use HExtendedString objects to get handles to strings. More...
#include <TCollection_ExtendedString.hxx>
Public Member Functions | |
| TCollection_ExtendedString () noexcept | |
| Initializes an ExtendedString to an empty ExtendedString. | |
| TCollection_ExtendedString (const char *const theString, const bool theIsMultiByte=false) | |
| Creation by converting a CString to an extended string. If theIsMultiByte is true then the string is treated as having UTF-8 coding. If it is not a UTF-8 then theIsMultiByte is ignored and each character is copied to ExtCharacter. | |
| TCollection_ExtendedString (const char16_t *const theString) | |
| Creation by converting an ExtString (char16_t*) to an extended string. | |
| TCollection_ExtendedString (const wchar_t *theStringUtf) | |
| Initialize from wide-char string considering it as Unicode string (the size of wide char is a platform-dependent - e.g. on Windows wchar_t is UTF-16). | |
| TCollection_ExtendedString (const char theChar) | |
| Initializes an ExtendedString with a single ASCII character. | |
| TCollection_ExtendedString (const char16_t theChar) | |
| Initializes an ExtendedString with a single extended character. | |
| TCollection_ExtendedString (const int theLength, const char16_t theFiller) | |
| Initializes an ExtendedString with specified length space allocated and filled with filler character. This is useful for buffers. | |
| TCollection_ExtendedString (const int theValue) | |
| Initializes an ExtendedString with an integer value. | |
| TCollection_ExtendedString (const double theValue) | |
| Initializes an ExtendedString with a real value. | |
| TCollection_ExtendedString (const TCollection_ExtendedString &theString) | |
| Initializes an ExtendedString with another ExtendedString. | |
| TCollection_ExtendedString (TCollection_ExtendedString &&theOther) noexcept | |
| Move constructor. | |
| TCollection_ExtendedString (const TCollection_AsciiString &theString, const bool theIsMultiByte=true) | |
| Creation by converting an AsciiString to an extended string. The string is treated as having UTF-8 coding. If it is not a UTF-8 or multi byte then each character is copied to ExtCharacter. | |
| TCollection_ExtendedString (const char16_t *const theString, const int theLength) | |
| Initializes an ExtendedString with a char16_t string and explicit length. | |
| template<std::size_t N> | |
| TCollection_ExtendedString (const char16_t(&theLiteral)[N]) | |
| Template constructor for char16_t string literals or arrays. For true string literals (const char16_t[N] in code), the size is computed at runtime by scanning for null terminator to handle both literals and buffers correctly. | |
| void | AssignCat (const TCollection_ExtendedString &theOther) |
| Appends the other extended string to this extended string. Note that this method is an alias of operator +=. | |
| void | operator+= (const TCollection_ExtendedString &theOther) |
| void | AssignCat (const int theOther) |
| Appends the integer value to this extended string. | |
| void | operator+= (const int theOther) |
| void | AssignCat (const char theChar) |
| Appends the ASCII character to this extended string. | |
| void | operator+= (const char theChar) |
| void | AssignCat (const double theOther) |
| Appends the real value to this extended string. | |
| void | operator+= (const double theOther) |
| void | AssignCat (const char16_t theChar) |
| Appends the utf16 char to this extended string. | |
| void | AssignCat (const char16_t *const theString, const int theLength) |
| Core implementation: Appends char16_t string (pointer and length) to this extended string. This is the primary implementation that all other AssignCat overloads redirect to. | |
| void | AssignCat (const char16_t *const theString) |
| Appends the char16_t string to this extended string. | |
| void | operator+= (const char16_t *const theString) |
| Appends the char16_t string to this extended string (alias of AssignCat()). | |
| template<std::size_t N> | |
| void | AssignCat (const char16_t(&theLiteral)[N]) |
| Template method for appending char16_t string literals or arrays. For char arrays (like buffers), scans for null terminator to get actual length. | |
| template<std::size_t N> | |
| void | operator+= (const char16_t(&theLiteral)[N]) |
| TCollection_ExtendedString | Cat (const char16_t *const theOther, const int theLength) const |
| Core implementation: Concatenates char16_t string (pointer and length) and returns a new string. | |
| TCollection_ExtendedString | Cat (const char16_t *const theOther) const |
| Concatenates char16_t string and returns a new string. | |
| TCollection_ExtendedString | operator+ (const char16_t *const theOther) const |
| TCollection_ExtendedString | Cat (const int theOther) const |
| Appends the integer value to this string and returns a new string. | |
| TCollection_ExtendedString | operator+ (const int theOther) const |
| TCollection_ExtendedString | Cat (const double theOther) const |
| Appends the real value to this string and returns a new string. | |
| TCollection_ExtendedString | operator+ (const double theOther) const |
| TCollection_ExtendedString | Cat (const char theChar) const |
| Appends a single ASCII character to this string and returns a new string. | |
| TCollection_ExtendedString | operator+ (const char theChar) const |
| TCollection_ExtendedString | Cat (const char16_t theChar) const |
| Appends a single extended (char16_t) character to this string and returns a new string. | |
| TCollection_ExtendedString | operator+ (const char16_t theChar) const |
| TCollection_ExtendedString | Cat (const TCollection_ExtendedString &theOther) const |
| Appends the other extended string to this string and returns a new string. | |
| TCollection_ExtendedString | operator+ (const TCollection_ExtendedString &theOther) const |
| void | ChangeAll (const char16_t theChar, const char16_t theNewChar) |
| Substitutes all the characters equal to theChar by theNewChar in this ExtendedString. The substitution can be case sensitive. If you don't use default case sensitive, no matter whether theChar is uppercase or not. | |
| void | Clear () |
| Removes all characters contained in this string. This produces an empty ExtendedString. | |
| void | Copy (const char16_t *const theString, const int theLength) |
| Core implementation: Copy from a char16_t pointer with explicit length. | |
| void | Copy (const char16_t *const theString) |
| Copy from a char16_t pointer. | |
| void | Copy (const TCollection_ExtendedString &theFromWhere) |
| Copy theFromWhere to this string. Used as operator =. | |
| TCollection_ExtendedString & | operator= (const TCollection_ExtendedString &theOther) |
| Copy assignment operator. | |
| TCollection_ExtendedString & | operator= (const char16_t *const theString) |
| Assignment from char16_t pointer. | |
| void | Move (TCollection_ExtendedString &&theOther) |
| Moves string without reallocations. | |
| TCollection_ExtendedString & | operator= (TCollection_ExtendedString &&theOther) noexcept |
| Move assignment operator. | |
| void | Swap (TCollection_ExtendedString &theOther) |
| Exchange the data of two strings (without reallocating memory). | |
| ~TCollection_ExtendedString () | |
| Frees memory allocated by ExtendedString. | |
| void | Insert (const int theWhere, const char16_t theWhat) |
| Insert a Character at position theWhere. | |
| void | Insert (const int theWhere, const char16_t *const theWhat, const int theLength) |
| Core implementation: Insert a char16_t string (pointer and length) at position theWhere. | |
| void | Insert (const int theWhere, const char16_t *const theWhat) |
| Insert a char16_t string at position theWhere. | |
| void | Insert (const int theWhere, const TCollection_ExtendedString &theWhat) |
| Insert an ExtendedString at position theWhere. | |
| bool | IsEmpty () const |
| Returns True if this string contains no characters. | |
| bool | IsEqual (const char16_t *const theOther, const int theLength) const |
| Core implementation: Returns true if this string equals theOther (pointer and length). | |
| bool | IsEqual (const char16_t *const theOther) const |
| Returns true if this string equals theOther null-terminated string. Note that this method is an alias of operator ==. | |
| bool | operator== (const char16_t *const theOther) const |
| bool | IsEqual (const TCollection_ExtendedString &theOther) const |
| Returns true if the characters in this extended string are identical to the characters in theOther extended string. Note that this method is an alias of operator ==. | |
| bool | operator== (const TCollection_ExtendedString &theOther) const |
| bool | IsDifferent (const char16_t *const theOther, const int theLength) const |
| Core implementation: Returns true if this string differs from theOther (pointer and length). | |
| bool | IsDifferent (const char16_t *const theOther) const |
| Returns true if this string differs from theOther null-terminated string. Note that this method is an alias of operator !=. | |
| bool | operator!= (const char16_t *const theOther) const |
| bool | IsDifferent (const TCollection_ExtendedString &theOther) const |
| Returns true if there are differences between the characters in this extended string and theOther extended string. Note that this method is an alias of operator !=. | |
| bool | operator!= (const TCollection_ExtendedString &theOther) const |
| bool | IsLess (const char16_t *const theOther, const int theLength) const |
| Core implementation: Returns TRUE if this string is lexicographically less than theOther. | |
| bool | IsLess (const char16_t *const theOther) const |
| Returns TRUE if this string is lexicographically less than theOther. | |
| bool | operator< (const char16_t *const theOther) const |
| bool | IsLess (const TCollection_ExtendedString &theOther) const |
| Returns TRUE if this string is lexicographically less than theOther. | |
| bool | operator< (const TCollection_ExtendedString &theOther) const |
| bool | IsGreater (const char16_t *const theOther, const int theLength) const |
| Core implementation: Returns TRUE if this string is lexicographically greater than theOther. | |
| bool | IsGreater (const char16_t *const theOther) const |
| Returns TRUE if this string is lexicographically greater than theOther. | |
| bool | operator> (const char16_t *const theOther) const |
| bool | IsGreater (const TCollection_ExtendedString &theOther) const |
| Returns TRUE if this string is lexicographically greater than theOther. | |
| bool | operator> (const TCollection_ExtendedString &theOther) const |
| bool | StartsWith (const char16_t *const theStartString, const int theLength) const |
| Core implementation: Determines whether this string starts with theStartString. | |
| bool | StartsWith (const char16_t *const theStartString) const |
| Determines whether this string starts with theStartString. | |
| bool | StartsWith (const TCollection_ExtendedString &theStartString) const |
| Determines whether the beginning of this string instance matches the specified string. | |
| bool | EndsWith (const char16_t *const theEndString, const int theLength) const |
| Core implementation: Determines whether this string ends with theEndString. | |
| bool | EndsWith (const char16_t *const theEndString) const |
| Determines whether this string ends with theEndString. | |
| bool | EndsWith (const TCollection_ExtendedString &theEndString) const |
| Determines whether the end of this string instance matches the specified string. | |
| bool | IsAscii () const |
| Returns True if the ExtendedString contains only "Ascii Range" characters. | |
| int | Length () const |
| Returns the number of 16-bit code units (might be greater than number of Unicode symbols if string contains surrogate pairs). | |
| void | Print (Standard_OStream &theStream) const |
| Displays this string on a stream. | |
| void | RemoveAll (const char16_t theWhat) |
| Removes every theWhat characters from this string. | |
| void | Remove (const int theWhere, const int theHowMany=1) |
| Erases theHowMany characters from position theWhere, theWhere included. | |
| int | Search (const char16_t *const theWhat, const int theLength) const |
| Core implementation: Searches for theWhat (pointer and length) from the beginning. | |
| int | Search (const char16_t *const theWhat) const |
| Searches for theWhat null-terminated string from the beginning. | |
| int | Search (const TCollection_ExtendedString &theWhat) const |
| Searches an ExtendedString in this string from the beginning and returns position of first item theWhat matching. It returns -1 if not found. | |
| int | SearchFromEnd (const char16_t *const theWhat, const int theLength) const |
| Core implementation: Searches for theWhat (pointer and length) from the end. | |
| int | SearchFromEnd (const char16_t *const theWhat) const |
| Searches for theWhat null-terminated string from the end. | |
| int | SearchFromEnd (const TCollection_ExtendedString &theWhat) const |
| Searches an ExtendedString in this string from the end and returns position of first item theWhat matching. It returns -1 if not found. | |
| void | SetValue (const int theWhere, const char16_t theWhat) |
| Replaces one character in the ExtendedString at position theWhere. If theWhere is less than zero or greater than the length of this string an exception is raised. | |
| void | SetValue (const int theWhere, const char16_t *const theWhat, const int theLength) |
| Core implementation: Replaces a part of this string by char16_t string (pointer and length). | |
| void | SetValue (const int theWhere, const char16_t *const theWhat) |
| Replaces a part of this string by a null-terminated char16_t string. | |
| void | SetValue (const int theWhere, const TCollection_ExtendedString &theWhat) |
| Replaces a part of this string by another ExtendedString. | |
| TCollection_ExtendedString | SubString (const int theFromIndex, const int theToIndex) const |
| Copies characters from this string starting from index theFromIndex to the index theToIndex (inclusive). Raises an exception if theToIndex or theFromIndex is out of bounds. | |
| TCollection_ExtendedString | Split (const int theWhere) |
| Splits this extended string into two sub-strings at position theWhere. | |
| TCollection_ExtendedString | Token (const char16_t *const theSeparators, const int theWhichOne=1) const |
| Extracts theWhichOne token from this string. By default, the theSeparators is set to space and tabulation. By default, the token extracted is the first one (theWhichOne = 1). theSeparators contains all separators you need. If no token indexed by theWhichOne is found, it returns an empty ExtendedString. | |
| const char16_t * | ToExtString () const |
| Returns pointer to ExtString (char16_t*). | |
| void | Trunc (const int theHowMany) |
| Truncates this string to theHowMany characters. | |
| char16_t | Value (const int theWhere) const |
| Returns character at position theWhere in this string. If theWhere is less than zero or greater than the length of this string, an exception is raised. | |
| size_t | HashCode () const |
| Returns a hashed value for the extended string. Note: if string is ASCII, the computed value is the same as the value computed with the HashCode function on a TCollection_AsciiString string composed with equivalent ASCII characters. | |
| int | ToUTF8CString (Standard_PCharacter &theCString) const |
| Converts the internal myString to UTF8 coding and returns length of the out CString. A memory for the theCString should be allocated before call! | |
| int | LengthOfCString () const |
| Returns expected CString length in UTF8 coding (like strlen, without null terminator). It can be used for memory calculation before converting to CString containing symbols in UTF8 coding. For external allocation, use: char* buf = new char[str.LengthOfCString() + 1];. | |
| void | LeftAdjust () |
| Removes all space characters in the beginning of the string. | |
| void | RightAdjust () |
| Removes all space characters at the end of the string. | |
| void | LeftJustify (const int theWidth, const char16_t theFiller) |
| Left justify. Length becomes equal to theWidth and the new characters are equal to theFiller. If theWidth < Length nothing happens. | |
| void | RightJustify (const int theWidth, const char16_t theFiller) |
| Right justify. Length becomes equal to theWidth and the new characters are equal to theFiller. If theWidth < Length nothing happens. | |
| void | Center (const int theWidth, const char16_t theFiller) |
| Modifies this string so that its length becomes equal to theWidth and the new characters are equal to theFiller. New characters are added both at the beginning and at the end of this string. If theWidth is less than the length of this string, nothing happens. | |
| void | Capitalize () |
| Converts the first character into its corresponding upper-case character and the other characters into lowercase. | |
| void | Prepend (const char16_t *const theOther, const int theLength) |
| Core implementation: Inserts char16_t string (pointer and length) at the beginning. | |
| void | Prepend (const char16_t *const theOther) |
| Inserts a null-terminated char16_t string at the beginning. | |
| void | Prepend (const TCollection_ExtendedString &theOther) |
| Inserts the other extended string at the beginning of this string. | |
| int | FirstLocationInSet (const TCollection_ExtendedString &theSet, const int theFromIndex, const int theToIndex) const |
| Returns the index of the first character of this string that is present in theSet. The search begins at index theFromIndex and ends at index theToIndex. Returns zero if failure. | |
| int | FirstLocationNotInSet (const TCollection_ExtendedString &theSet, const int theFromIndex, const int theToIndex) const |
| Returns the index of the first character of this string that is NOT present in theSet. The search begins at index theFromIndex and ends at index theToIndex. Returns zero if failure. | |
| int | IntegerValue () const |
| Converts this extended string containing a numeric expression to an Integer. | |
| bool | IsIntegerValue () const |
| Returns True if this extended string contains an integer value. | |
| double | RealValue () const |
| Converts this extended string containing a numeric expression to a Real. | |
| bool | IsRealValue (bool theToCheckFull=false) const |
| Returns True if this extended string starts with characters that can be interpreted as a real value. | |
| bool | IsSameString (const TCollection_ExtendedString &theOther, const bool theIsCaseSensitive) const |
| Returns True if the strings contain same characters. | |
Static Public Member Functions | |
| static const TCollection_ExtendedString & | EmptyString () noexcept |
| Returns a const reference to a single shared empty string instance. This method provides access to a static empty string to avoid creating temporary empty strings. Use this method instead of constructing empty strings when you need a const reference. | |
| static bool | IsEqual (const TCollection_ExtendedString &theString1, const TCollection_ExtendedString &theString2) |
| Returns true if the characters in this extended string are identical to the characters in the other extended string. Note that this method is an alias of operator ==. | |
A variable-length sequence of "extended" (UNICODE) characters (16-bit character type). It provides editing operations with built-in memory management to make ExtendedString objects easier to use than ordinary extended character arrays. ExtendedString objects follow "value semantics", that is, they are the actual strings, not handles to strings, and are copied through assignment. You may use HExtendedString objects to get handles to strings.
Beware that class can transparently store UTF-16 string with surrogate pairs (Unicode symbol represented by two 16-bit code units). However, surrogate pairs are not considered by the following methods:
|
noexcept |
Initializes an ExtendedString to an empty ExtendedString.
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const char *const | theString, |
| const bool | theIsMultiByte = false ) |
Creation by converting a CString to an extended string. If theIsMultiByte is true then the string is treated as having UTF-8 coding. If it is not a UTF-8 then theIsMultiByte is ignored and each character is copied to ExtCharacter.
| [in] | theString | the C string to convert |
| [in] | theIsMultiByte | flag indicating UTF-8 coding |
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const char16_t *const | theString | ) |
Creation by converting an ExtString (char16_t*) to an extended string.
| [in] | theString | the char16_t string to copy |
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const wchar_t * | theStringUtf | ) |
Initialize from wide-char string considering it as Unicode string (the size of wide char is a platform-dependent - e.g. on Windows wchar_t is UTF-16).
This constructor is unavailable if application is built with deprecated msvc option "-Zc:wchar_t-", since OCCT itself is never built with this option.
| [in] | theStringUtf | the wide character string to convert |
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const char | theChar | ) |
Initializes an ExtendedString with a single ASCII character.
| [in] | theChar | the ASCII character to initialize from |
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const char16_t | theChar | ) |
Initializes an ExtendedString with a single extended character.
| [in] | theChar | the extended character to initialize from |
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const int | theLength, |
| const char16_t | theFiller ) |
Initializes an ExtendedString with specified length space allocated and filled with filler character. This is useful for buffers.
| [in] | theLength | the length to allocate |
| [in] | theFiller | the character to fill with |
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const int | theValue | ) |
Initializes an ExtendedString with an integer value.
| [in] | theValue | the integer value to convert to string |
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const double | theValue | ) |
Initializes an ExtendedString with a real value.
| [in] | theValue | the real value to convert to string |
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const TCollection_ExtendedString & | theString | ) |
Initializes an ExtendedString with another ExtendedString.
| [in] | theString | the string to copy from |
|
noexcept |
Move constructor.
| [in] | theOther | the string to move from |
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const TCollection_AsciiString & | theString, |
| const bool | theIsMultiByte = true ) |
Creation by converting an AsciiString to an extended string. The string is treated as having UTF-8 coding. If it is not a UTF-8 or multi byte then each character is copied to ExtCharacter.
| [in] | theString | the ASCII string to convert |
| [in] | theIsMultiByte | flag indicating UTF-8 coding |
| TCollection_ExtendedString::TCollection_ExtendedString | ( | const char16_t *const | theString, |
| const int | theLength ) |
Initializes an ExtendedString with a char16_t string and explicit length.
| [in] | theString | the char16_t string to initialize from |
| [in] | theLength | the length of the string |
|
inline |
Template constructor for char16_t string literals or arrays. For true string literals (const char16_t[N] in code), the size is computed at runtime by scanning for null terminator to handle both literals and buffers correctly.
Example:
| [in] | theLiteral | the string literal or char16_t array |
| TCollection_ExtendedString::~TCollection_ExtendedString | ( | ) |
Frees memory allocated by ExtendedString.
Appends the ASCII character to this extended string.
| [in] | theChar | the character to append |
Appends the char16_t string to this extended string.
| [in] | theString | the string to append |
Core implementation: Appends char16_t string (pointer and length) to this extended string. This is the primary implementation that all other AssignCat overloads redirect to.
| [in] | theString | pointer to the string to append |
| [in] | theLength | length of the string to append |
Appends the utf16 char to this extended string.
| [in] | theChar | the character to append |
|
inline |
Template method for appending char16_t string literals or arrays. For char arrays (like buffers), scans for null terminator to get actual length.
Example:
| [in] | theLiteral | the string literal or char16_t array to append |
Appends the real value to this extended string.
| [in] | theOther | the real value to append |
Appends the integer value to this extended string.
| [in] | theOther | the integer to append |
| void TCollection_ExtendedString::AssignCat | ( | const TCollection_ExtendedString & | theOther | ) |
Appends the other extended string to this extended string. Note that this method is an alias of operator +=.
Example:
| [in] | theOther | the string to append |
| void TCollection_ExtendedString::Capitalize | ( | ) |
Converts the first character into its corresponding upper-case character and the other characters into lowercase.
| TCollection_ExtendedString TCollection_ExtendedString::Cat | ( | const char | theChar | ) | const |
Appends a single ASCII character to this string and returns a new string.
| [in] | theChar | the ASCII character to append |
|
inline |
Concatenates char16_t string and returns a new string.
| [in] | theOther | the null-terminated string to append |
| TCollection_ExtendedString TCollection_ExtendedString::Cat | ( | const char16_t *const | theOther, |
| const int | theLength ) const |
Core implementation: Concatenates char16_t string (pointer and length) and returns a new string.
| [in] | theOther | pointer to the string to append |
| [in] | theLength | length of the string to append |
| TCollection_ExtendedString TCollection_ExtendedString::Cat | ( | const char16_t | theChar | ) | const |
Appends a single extended (char16_t) character to this string and returns a new string.
| [in] | theChar | the extended character to append |
| TCollection_ExtendedString TCollection_ExtendedString::Cat | ( | const double | theOther | ) | const |
Appends the real value to this string and returns a new string.
| [in] | theOther | the real value to append |
| TCollection_ExtendedString TCollection_ExtendedString::Cat | ( | const int | theOther | ) | const |
Appends the integer value to this string and returns a new string.
| [in] | theOther | the integer to append |
|
inline |
Appends the other extended string to this string and returns a new string.
Example:
| [in] | theOther | the string to append |
Modifies this string so that its length becomes equal to theWidth and the new characters are equal to theFiller. New characters are added both at the beginning and at the end of this string. If theWidth is less than the length of this string, nothing happens.
| [in] | theWidth | the desired width of the string |
| [in] | theFiller | the character to fill with |
Substitutes all the characters equal to theChar by theNewChar in this ExtendedString. The substitution can be case sensitive. If you don't use default case sensitive, no matter whether theChar is uppercase or not.
Example:
| [in] | theChar | the character to replace |
| [in] | theNewChar | the replacement character |
| void TCollection_ExtendedString::Clear | ( | ) |
Removes all characters contained in this string. This produces an empty ExtendedString.
Copy from a char16_t pointer.
| [in] | theString | the null-terminated string to copy |
Core implementation: Copy from a char16_t pointer with explicit length.
| [in] | theString | pointer to the string to copy |
| [in] | theLength | length of the string to copy |
|
inline |
Copy theFromWhere to this string. Used as operator =.
Example:
| [in] | theFromWhere | the string to copy from |
|
staticnoexcept |
Returns a const reference to a single shared empty string instance. This method provides access to a static empty string to avoid creating temporary empty strings. Use this method instead of constructing empty strings when you need a const reference.
Example:
Determines whether this string ends with theEndString.
| [in] | theEndString | the null-terminated string to check for |
| bool TCollection_ExtendedString::EndsWith | ( | const char16_t *const | theEndString, |
| const int | theLength ) const |
Core implementation: Determines whether this string ends with theEndString.
| [in] | theEndString | pointer to the string to check for |
| [in] | theLength | length of the string to check for |
|
inline |
Determines whether the end of this string instance matches the specified string.
| [in] | theEndString | the string to check for at the end |
| int TCollection_ExtendedString::FirstLocationInSet | ( | const TCollection_ExtendedString & | theSet, |
| const int | theFromIndex, | ||
| const int | theToIndex ) const |
Returns the index of the first character of this string that is present in theSet. The search begins at index theFromIndex and ends at index theToIndex. Returns zero if failure.
| [in] | theSet | the set of characters to search for |
| [in] | theFromIndex | the starting index for search (1-based) |
| [in] | theToIndex | the ending index for search (1-based) |
| int TCollection_ExtendedString::FirstLocationNotInSet | ( | const TCollection_ExtendedString & | theSet, |
| const int | theFromIndex, | ||
| const int | theToIndex ) const |
Returns the index of the first character of this string that is NOT present in theSet. The search begins at index theFromIndex and ends at index theToIndex. Returns zero if failure.
| [in] | theSet | the set of characters to check against |
| [in] | theFromIndex | the starting index for search (1-based) |
| [in] | theToIndex | the ending index for search (1-based) |
|
inline |
Returns a hashed value for the extended string. Note: if string is ASCII, the computed value is the same as the value computed with the HashCode function on a TCollection_AsciiString string composed with equivalent ASCII characters.
|
inline |
Insert a char16_t string at position theWhere.
| [in] | theWhere | the position to insert at (1-based) |
| [in] | theWhat | the null-terminated string to insert |
| void TCollection_ExtendedString::Insert | ( | const int | theWhere, |
| const char16_t *const | theWhat, | ||
| const int | theLength ) |
Core implementation: Insert a char16_t string (pointer and length) at position theWhere.
| [in] | theWhere | the position to insert at (1-based) |
| [in] | theWhat | pointer to the string to insert |
| [in] | theLength | length of the string to insert |
Insert a Character at position theWhere.
Example:
| [in] | theWhere | the position to insert at (1-based) |
| [in] | theWhat | the character to insert |
|
inline |
Insert an ExtendedString at position theWhere.
| [in] | theWhere | the position to insert at (1-based) |
| [in] | theWhat | the string to insert |
| int TCollection_ExtendedString::IntegerValue | ( | ) | const |
Converts this extended string containing a numeric expression to an Integer.
| bool TCollection_ExtendedString::IsAscii | ( | ) | const |
Returns True if the ExtendedString contains only "Ascii Range" characters.
Returns true if this string differs from theOther null-terminated string. Note that this method is an alias of operator !=.
| [in] | theOther | the char16_t string to compare with |
| bool TCollection_ExtendedString::IsDifferent | ( | const char16_t *const | theOther, |
| const int | theLength ) const |
Core implementation: Returns true if this string differs from theOther (pointer and length).
| [in] | theOther | pointer to the string to compare with |
| [in] | theLength | length of the string to compare with |
|
inline |
Returns true if there are differences between the characters in this extended string and theOther extended string. Note that this method is an alias of operator !=.
| [in] | theOther | the extended string to compare with |
|
inline |
Returns True if this string contains no characters.
Returns true if this string equals theOther null-terminated string. Note that this method is an alias of operator ==.
| [in] | theOther | the char16_t string to compare with |
| bool TCollection_ExtendedString::IsEqual | ( | const char16_t *const | theOther, |
| const int | theLength ) const |
Core implementation: Returns true if this string equals theOther (pointer and length).
| [in] | theOther | pointer to the string to compare with |
| [in] | theLength | length of the string to compare with |
|
inline |
Returns true if the characters in this extended string are identical to the characters in theOther extended string. Note that this method is an alias of operator ==.
| [in] | theOther | the extended string to compare with |
|
inlinestatic |
Returns true if the characters in this extended string are identical to the characters in the other extended string. Note that this method is an alias of operator ==.
| [in] | theString1 | first string to compare |
| [in] | theString2 | second string to compare |
Returns TRUE if this string is lexicographically greater than theOther.
| [in] | theOther | the char16_t string to compare with |
| bool TCollection_ExtendedString::IsGreater | ( | const char16_t *const | theOther, |
| const int | theLength ) const |
Core implementation: Returns TRUE if this string is lexicographically greater than theOther.
| [in] | theOther | pointer to the string to compare with |
| [in] | theLength | length of the string to compare with |
|
inline |
Returns TRUE if this string is lexicographically greater than theOther.
| [in] | theOther | the extended string to compare with |
| bool TCollection_ExtendedString::IsIntegerValue | ( | ) | const |
Returns True if this extended string contains an integer value.
Returns TRUE if this string is lexicographically less than theOther.
| [in] | theOther | the char16_t string to compare with |
| bool TCollection_ExtendedString::IsLess | ( | const char16_t *const | theOther, |
| const int | theLength ) const |
Core implementation: Returns TRUE if this string is lexicographically less than theOther.
| [in] | theOther | pointer to the string to compare with |
| [in] | theLength | length of the string to compare with |
|
inline |
Returns TRUE if this string is lexicographically less than theOther.
| [in] | theOther | the extended string to compare with |
Returns True if this extended string starts with characters that can be interpreted as a real value.
| [in] | theToCheckFull | when TRUE, checks if entire string defines a real value; otherwise checks if string starts with a real value |
| bool TCollection_ExtendedString::IsSameString | ( | const TCollection_ExtendedString & | theOther, |
| const bool | theIsCaseSensitive ) const |
Returns True if the strings contain same characters.
| [in] | theOther | the string to compare with |
| [in] | theIsCaseSensitive | flag indicating case sensitivity |
| void TCollection_ExtendedString::LeftAdjust | ( | ) |
Removes all space characters in the beginning of the string.
Left justify. Length becomes equal to theWidth and the new characters are equal to theFiller. If theWidth < Length nothing happens.
| [in] | theWidth | the desired width of the string |
| [in] | theFiller | the character to fill with |
| int TCollection_ExtendedString::Length | ( | ) | const |
Returns the number of 16-bit code units (might be greater than number of Unicode symbols if string contains surrogate pairs).
| int TCollection_ExtendedString::LengthOfCString | ( | ) | const |
Returns expected CString length in UTF8 coding (like strlen, without null terminator). It can be used for memory calculation before converting to CString containing symbols in UTF8 coding. For external allocation, use: char* buf = new char[str.LengthOfCString() + 1];.
| void TCollection_ExtendedString::Move | ( | TCollection_ExtendedString && | theOther | ) |
Moves string without reallocations.
| [in] | theOther | the string to move from |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Appends the char16_t string to this extended string (alias of AssignCat()).
|
inline |
|
inline |
|
inline |
|
inline |
Assignment from char16_t pointer.
|
inline |
Copy assignment operator.
|
inlinenoexcept |
Move assignment operator.
|
inline |
|
inline |
Inserts a null-terminated char16_t string at the beginning.
| [in] | theOther | the null-terminated string to prepend |
Core implementation: Inserts char16_t string (pointer and length) at the beginning.
| [in] | theOther | pointer to the string to prepend |
| [in] | theLength | length of the string to prepend |
|
inline |
Inserts the other extended string at the beginning of this string.
| [in] | theOther | the string to prepend |
| void TCollection_ExtendedString::Print | ( | Standard_OStream & | theStream | ) | const |
Displays this string on a stream.
| [in] | theStream | the output stream |
| double TCollection_ExtendedString::RealValue | ( | ) | const |
Converts this extended string containing a numeric expression to a Real.
Erases theHowMany characters from position theWhere, theWhere included.
Example:
| [in] | theWhere | the position to start erasing from (1-based) |
| [in] | theHowMany | the number of characters to erase |
Removes every theWhat characters from this string.
| [in] | theWhat | the character to remove |
| void TCollection_ExtendedString::RightAdjust | ( | ) |
Removes all space characters at the end of the string.
Right justify. Length becomes equal to theWidth and the new characters are equal to theFiller. If theWidth < Length nothing happens.
| [in] | theWidth | the desired width of the string |
| [in] | theFiller | the character to fill with |
Searches for theWhat null-terminated string from the beginning.
| [in] | theWhat | the null-terminated string to search for |
Core implementation: Searches for theWhat (pointer and length) from the beginning.
| [in] | theWhat | pointer to the string to search for |
| [in] | theLength | length of the string to search for |
|
inline |
Searches an ExtendedString in this string from the beginning and returns position of first item theWhat matching. It returns -1 if not found.
| [in] | theWhat | the string to search for |
Searches for theWhat null-terminated string from the end.
| [in] | theWhat | the null-terminated string to search for |
| int TCollection_ExtendedString::SearchFromEnd | ( | const char16_t *const | theWhat, |
| const int | theLength ) const |
Core implementation: Searches for theWhat (pointer and length) from the end.
| [in] | theWhat | pointer to the string to search for |
| [in] | theLength | length of the string to search for |
|
inline |
Searches an ExtendedString in this string from the end and returns position of first item theWhat matching. It returns -1 if not found.
| [in] | theWhat | the string to search for |
|
inline |
Replaces a part of this string by a null-terminated char16_t string.
| [in] | theWhere | the position to start replacement (1-based) |
| [in] | theWhat | the null-terminated string to replace with |
| void TCollection_ExtendedString::SetValue | ( | const int | theWhere, |
| const char16_t *const | theWhat, | ||
| const int | theLength ) |
Core implementation: Replaces a part of this string by char16_t string (pointer and length).
| [in] | theWhere | the position to start replacement (1-based) |
| [in] | theWhat | pointer to the string to replace with |
| [in] | theLength | length of the string to replace with |
Replaces one character in the ExtendedString at position theWhere. If theWhere is less than zero or greater than the length of this string an exception is raised.
Example:
| [in] | theWhere | the position to replace at (1-based) |
| [in] | theWhat | the character to replace with |
|
inline |
Replaces a part of this string by another ExtendedString.
| [in] | theWhere | the position to start replacement (1-based) |
| [in] | theWhat | the string to replace with |
| TCollection_ExtendedString TCollection_ExtendedString::Split | ( | const int | theWhere | ) |
Splits this extended string into two sub-strings at position theWhere.
Example:
| [in] | theWhere | the position to split at (0-based) |
Determines whether this string starts with theStartString.
| [in] | theStartString | the null-terminated string to check for |
| bool TCollection_ExtendedString::StartsWith | ( | const char16_t *const | theStartString, |
| const int | theLength ) const |
Core implementation: Determines whether this string starts with theStartString.
| [in] | theStartString | pointer to the string to check for |
| [in] | theLength | length of the string to check for |
|
inline |
Determines whether the beginning of this string instance matches the specified string.
| [in] | theStartString | the string to check for at the beginning |
| TCollection_ExtendedString TCollection_ExtendedString::SubString | ( | const int | theFromIndex, |
| const int | theToIndex ) const |
Copies characters from this string starting from index theFromIndex to the index theToIndex (inclusive). Raises an exception if theToIndex or theFromIndex is out of bounds.
Example:
| [in] | theFromIndex | the starting index (1-based) |
| [in] | theToIndex | the ending index (1-based, inclusive) |
| void TCollection_ExtendedString::Swap | ( | TCollection_ExtendedString & | theOther | ) |
Exchange the data of two strings (without reallocating memory).
| [in,out] | theOther | the string to exchange data with |
| const char16_t * TCollection_ExtendedString::ToExtString | ( | ) | const |
Returns pointer to ExtString (char16_t*).
| TCollection_ExtendedString TCollection_ExtendedString::Token | ( | const char16_t *const | theSeparators, |
| const int | theWhichOne = 1 ) const |
Extracts theWhichOne token from this string. By default, the theSeparators is set to space and tabulation. By default, the token extracted is the first one (theWhichOne = 1). theSeparators contains all separators you need. If no token indexed by theWhichOne is found, it returns an empty ExtendedString.
Example:
| [in] | theSeparators | the separator characters |
| [in] | theWhichOne | the token number to extract (1-based) |
| int TCollection_ExtendedString::ToUTF8CString | ( | Standard_PCharacter & | theCString | ) | const |
Converts the internal myString to UTF8 coding and returns length of the out CString. A memory for the theCString should be allocated before call!
| [in,out] | theCString | pointer to the output buffer |
Truncates this string to theHowMany characters.
Example:
| [in] | theHowMany | the number of characters to keep |
Returns character at position theWhere in this string. If theWhere is less than zero or greater than the length of this string, an exception is raised.
Example:
| [in] | theWhere | the position to get character from (1-based) |