#include <uaunistring.h>
List of all members.
Public Member Functions |
| UaUniString () |
| UaUniString (const UaByteArray &other) |
| UaUniString (const UaUniString &other) |
| UaUniString (const UaUShort *other) |
| UaUniString (const char *other) |
| ~UaUniString () |
UaUniString & | operator= (const UaUniString &other) |
int | length () const |
int | size () const |
bool | isEmpty () const |
bool | isNull () const |
void | clear () |
UaUniString | left (int len) const |
UaUniString | mid (int pos, int len=-1) const |
UaUniString | right (int len) const |
UaUniString | arg (unsigned int num, int fieldWidth=0, int base=10) |
UaUniString | arg (int num, int fieldWidth=0, int base=10) |
UaUniString | arg (double num, int fieldWidth=0, char format= 'g', int precision=-1) |
UaUniString | arg (const UaUniString &text) |
const UaUShort | at (int pos) const |
bool | startsWith (const UaUniString &strToFind) const |
UaUniString | replace (const UaUniString &before, const UaUniString &after) |
UaUniString | replace (const UaUShort &before, const UaUShort &after) |
UaUniString | replace (int position, int n, const UaUniString &after) |
UaUniString | replace (int position, const UaUShort &after) |
UaUniStringList | split (const UaUniString &separator) const |
UaUniString | append (const UaUniString &str) |
UaUniString | append (const UaUShort ch) |
UaUniString | prepend (const UaUniString &str) |
UaUniString | prepend (const UaUShort ch) |
UaUniString | trimmed () const |
int | indexOf (const UaUniString &strToFind, int from=0) const |
int | indexOf (const UaUShort charToFind, int from=0) const |
int | lastIndexOf (const UaUniString &strToFind, int from=-1) const |
int | lastIndexOf (const UaUShort charToFind, int from=-1) const |
void | chop (int n) |
bool | operator== (const UaUniString &other) const |
bool | operator!= (const UaUniString &other) const |
bool | operator< (const UaUniString &other) const |
bool | operator> (const UaUniString &other) const |
UaUniString & | operator+= (const UaUniString &other) |
const UaUShort * | toUtf16 () const |
BSTR | toBSTR () const |
wchar_t * | toCOMWChar () const |
bool | isBiggerThan (const UaUniString &other, bool bCaseSensitive) const |
bool | isSmallerThan (const UaUniString &other, bool bCaseSensitive) const |
Friends |
class | UaUniStringList |
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
Appends the string str to end of this string.
Appends the character ch to end of this string.
UaUniString UaUniString::arg |
( |
unsigned int |
num, |
|
|
int |
fieldWidth = 0 , |
|
|
int |
base = 10 |
|
) |
| |
Returns a copy of this string with the lowest numbered place marker replaced by the given number num, i.e., %1, %2, ..., %9.
- Parameters:
-
num | The number that should be converted to string before inserted. |
fieldWidth | specifies the minimum amount of space that argument a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with '0'. |
base | The base used for the number to string conversion. This must be in the range of 2-36. |
- Returns:
- The new string. This example shows how we might create a status string for reporting progress while processing a list of files: First, arg(i) replaces 1. Then arg(total) replaces 2. Finally, arg(fileName) replaces 3. One advantage of using arg() over sprintf() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest numbered unreplaced place marker, no matter where it appears. This functions always replaces the lowest number found. Place marker numbers must be in the range 1 to 9.
UaUniString UaUniString::arg |
( |
int |
num, |
|
|
int |
fieldWidth = 0 , |
|
|
int |
base = 10 |
|
) |
| |
Returns a copy of this string with the lowest numbered place marker replaced by the given number num, i.e., %1, %2, ..., %9. This function behaves like the function above, but works with signed int.
- Parameters:
-
num | The number that should be converted to string before inserted. |
fieldWidth | specifies the minimum amount of space that argument a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with '0'. |
base | The base used for the number to string conversion. This must be in the range of 2-36. |
- Returns:
- The new string. This function overloads arg().
UaUniString UaUniString::arg |
( |
double |
num, |
|
|
int |
fieldWidth = 0 , |
|
|
char |
format = 'g' , |
|
|
int |
precision = -1 |
|
) |
| |
Returns a copy of this string with the lowest numbered place marker replaced by the given floatingpoint number num, i.e., %1, %2, ..., %9. This function behaves like the function above, but works with a double.
- Parameters:
-
num | The number that should be converted to string before inserted. |
fieldWidth | specifies the minimum amount of space that argument a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with '0'. |
format | 'g', 'f', or 'e'. This parameter conforms to the snprintf format specifier. |
precision | Precisions of the floating pointer number. |
- Returns:
- The new string. This function overloads arg().
Returns a copy of this string with the lowest numbered place marker replaced by the given string text, i.e., %1, %2, ..., %9. This function overloads arg().
- Parameters:
-
text | The text that should be inserted. |
- Returns:
- The new string.
const UaUShort UaUniString::at |
( |
int |
pos ) |
const |
Returns a read only UTF-16 character.
- See also:
- replace()
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
void UaUniString::clear |
( |
) |
|
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.
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. |
other | Other string to compare with. |
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.
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. |
other | Source string. This method will return false if both string are equal. |
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.
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
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.
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.
bool UaUniString::operator!= |
( |
const UaUniString & |
other ) |
const |
Returns true if other is not equal to this.
- See also:
- operator==
Appends a string to the internal string. This creates a copy of the string because the internal data needs to changed.
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.
Assigns other to this string and returns a reference to this 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 |
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.
- Parameters:
-
other | Other string to compare with. |
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:
-
ch | the string to prepend to. |
- Returns:
- a new created string.
UaUniString UaUniString::replace |
( |
int |
position, |
|
|
const UaUShort & |
after |
|
) |
| |
Replaces the character at index position with the character after.
Replaces every occurrence of the string before with the string after.
Replaces n characters starting at index position with the string after.
UaUniString UaUniString::replace |
( |
const UaUShort & |
before, |
|
|
const UaUShort & |
after |
|
) |
| |
Replaces every occurrence of the character before with the character after.
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
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.
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.
bool UaUniString::startsWith |
( |
const UaUniString & |
strToFind ) |
const |
Check if the string starts with the search string.
BSTR UaUniString::toBSTR |
( |
) |
const |
Create a BSTR using SysAllocString. This string must be freed using SysFreeString.
wchar_t * UaUniString::toCOMWChar |
( |
) |
const |
Creates a copy of the unicode string using CoTaskMemAlloc. This is used for strings the are passed via COM borders. This string must be freed using CoTaskMemFree.
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.
Returns a copy of this string which has whitespaces removed from start and end. This also removes ASCII characters '
', '', '', '', '', and ' '.
The documentation for this class was generated from the following files:
- /home/buildbot/work/uasdkcpp/src/uabase/uabasecpp/uaunistring.h
- /home/buildbot/work/uasdkcpp/src/uabase/uabasecpp/uaunistring.cpp