UaUniString Class Reference
#include <uaunistring.h>
List of all members.
Detailed Description
OPC UA string handling class. This class encapsulates an UTF16 encoded string
Constructor & Destructor Documentation
UaUniString::UaUniString |
( |
|
) |
|
Creates a copy of a UTF-16 encoded ByteArray.
- Parameters:
-
Creates a copy of another UaUniString. This operation takes constant time, because UaUniString is implicitly shared. This makes returning a UaUniString from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes linear time.
UaUniString::UaUniString |
( |
const UaUShort * |
other |
) |
|
Creates a copy of the native OpcUa_String.
- Parameters:
-
UaUniString::UaUniString |
( |
const char * |
other |
) |
|
Creates a UaUniString from a UTF-8 encoded char* character string.
UaUniString::~UaUniString |
( |
|
) |
|
Member Function Documentation
Assigns other to this string and returns a reference to this string.
int UaUniString::length |
( |
|
) |
const |
Returns the number of characters of this string. You will need this function for displaying it. With UTF-16 strings the number of characters and the size in bytes will differ.
int UaUniString::size |
( |
|
) |
const |
Returns the size in bytes that the internal UTF-16 representation needs to hold this string. You will only need this function, if you want to allocate a native UTF-16 string that should be big enough to hold this string.
bool UaUniString::isEmpty |
( |
|
) |
const |
Returns true if the string is empty or a null string.
bool UaUniString::isNull |
( |
|
) |
const |
Returns true if the string is a null string. Returns false if the string is an empty string.
void UaUniString::clear |
( |
|
) |
|
Returns a UaUniString substring that contains the n leftmost characters of the string. If len is greater than the stringlength or less than zero the entire string is returned
UaUniString UaUniString::mid |
( |
int |
pos, |
|
|
int |
len = -1 | |
|
) |
| | const |
Returns a UaUniString string that contains n characters of the string, starting at the specified position. If pos is bigger than the length a null string is returned If len is greater than the stringlength-pos or len == -1 than all characters from the position are returned.
Returns a UaUniString substring that contains the n rightmost characters of the string. If len is greater than the stringlength or less than zero the entire string is returned
const UaUShort UaUniString::at |
( |
int |
pos |
) |
const |
Returns a read only UTF-16 character.
- See also:
- replace()
bool UaUniString::startsWith |
( |
const UaUniString & |
strToFind |
) |
const |
Check if the string starts with the search string.
Replaces every occurrence of the string before with the string after.
UaUniString UaUniString::replace |
( |
const UaUShort & |
before, |
|
|
const UaUShort & |
after | |
|
) |
| | |
Replaces every occurrence of the character before with the character after.
Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.
Appends the string str to end of this string.
Appends the character ch to end of this string.
Prepends the string str to the beginning of this string.
- Parameters:
-
| str | the string to prepend to. |
- Returns:
- a new created string.
Prepends the UaUShort ch to the beginning of this string.
- Parameters:
-
| str | the string to prepend to. |
- Returns:
- a new created string.
int UaUniString::indexOf |
( |
const UaUniString & |
strToFind, |
|
|
int |
from = 0 | |
|
) |
| | const |
Returns the index position of the first occurrence of the string strToFind in this string. Searching forward from index position from. Returns -1 if strToFind is not found. If from is -1, the search starts at the last character; if it is -2, at the next to last character and so on.
int UaUniString::indexOf |
( |
const UaUShort |
charToFind, |
|
|
int |
from = 0 | |
|
) |
| | const |
Returns the index position of the first occurrence of the character charToFind in this string. Searching forward from index position from. Returns -1 if charToFind is not found. If from is -1, the search starts at the last character; if it is -2, at the next to last character and so on.
int UaUniString::lastIndexOf |
( |
const UaUniString & |
strToFind, |
|
|
int |
from = -1 | |
|
) |
| | const |
Returns the index position of the last occurrence of the string strToFind in this string. Searching backward from index position from. Returns -1 if strToFind is not found. If from is -1, the search starts at the last character; if it is -2, at the next to last character and so on.
int UaUniString::lastIndexOf |
( |
const UaUShort |
charToFind, |
|
|
int |
from = -1 | |
|
) |
| | const |
Returns the index position of the last occurrence of the character charToFind in this string. Searching backward from index position from. If from is -1 (the default), the search starts at the last character. If form is -2, at the next to last character and so on. Returns -1 if str is not found.
void UaUniString::chop |
( |
int |
n |
) |
|
Removes n characters from the end of the string if n is greater than length(), the result is an empty string
bool UaUniString::operator== |
( |
const UaUniString & |
other |
) |
const |
Returns true if other is equal to this.
- See also:
- operator!=
bool UaUniString::operator!= |
( |
const UaUniString & |
other |
) |
const |
Returns true if other is not equal to this.
- See also:
- operator==
bool UaUniString::operator< |
( |
const UaUniString & |
other |
) |
const |
This operator is mainly used to sort strings. That is e.g. necesarry to use it as a key in a binary tree. Note that this comparison is based on the length of the strings and on the numeric Unicode values - not alphabetical.
bool UaUniString::operator> |
( |
const UaUniString & |
other |
) |
const |
This operator is mainly used to sort strings. That is e.g. necesarry to use it as a key in a binary tree. Note that this comparison is based on the length of the strings and on the numeric Unicode values - not alphabetical.
Appends a string to the internal string. This creates a copy of the string because the internal data needs to changed.
const UaUShort * UaUniString::toUtf16 |
( |
|
) |
const |
Returns the string as a '\0'-terminatde array of UTF-16 characters. The result remains valid until the string is modified.
bool UaUniString::isBiggerThan |
( |
const UaUniString & |
other, |
|
|
bool |
bCaseSensitive | |
|
) |
| | const |
This operator is mainly used to sort strings in alphabetical order.
- Parameters:
-
| bCaseSensitive | Flag indicating if the comparison is case sensitive or not. This method will return false if both string are equal. |
bool UaUniString::isSmallerThan |
( |
const UaUniString & |
other, |
|
|
bool |
bCaseSensitive | |
|
) |
| | const |
This operator is mainly used to sort strings in alphabetical order.
- Parameters:
-
| bCaseSensitive | Flag indicating if the comparison is case sensitive or not. This method will return false if both string are equal. |
The documentation for this class was generated from the following files:
- src/uabase/uabasecpp/uaunistring.h
- src/uabase/uabasecpp/uaunistring.cpp