osncore::UString Class Reference
Class encapsulates utf-8 encoded string. UString has a character based API thus e.g length will return number of charaters. Unicode operations for utf8 encoded string can be done using glib unicode manipulation functions and/or using non-member functions for UString type.
osncore.lib
- Since
- S60 5.0 Draft UString
Nested Classes and Structures
Constructor & Destructor Documentation
UString(const Utf8 *)
OSN_IMPORT | UString | ( | const Utf8 * | aStr | ) | [explicit] |
Construct a UString as a copy of given null terminated string.
Parameters
const Utf8 * aStr | Utf-8 encoded string |
UString(const Utf8 *, int)
OSN_IMPORT | UString | ( | const Utf8 * | aStr, |
| int | aByteCount |
| ) | [explicit] |
Construct a UString as a copy of given string with byte length of the source buffer. Because a length is provided, source doesn't need to be null terminated.
Parameters
const Utf8 * aStr | Utf-8 encoded string |
int aByteCount | Byte count of Utf-8 encoded string |
UString(Unicode)
OSN_IMPORT | UString | ( | Unicode | aCodePoint | ) | [explicit] |
Construct a
UString from unicode code point. If Unicode is invalid,
- Since
- S60 5.0
- Exceptions
-
Parameters
Unicode aCodePoint | Unicode code point |
UString(const UString &)
OSN_IMPORT | UString | ( | const UString & | aUString | ) | |
UString copy constructor
- Since
- S60 5.0
- Exceptions
-
Parameters
const UString & aUString | Copy source |
~UString()
OSN_IMPORT | ~UString | ( | ) | [virtual] |
Member Functions Documentation
append(const UString &)
OSN_IMPORT void | append | ( | const UString & | aUString | ) | |
Adds a string onto the end of string, expanding it if necessary.
Parameters
const UString & aUString | String object to append |
append(const Utf8 *)
OSN_IMPORT void | append | ( | const Utf8 * | aStr | ) | |
Adds a string onto the end of string, expanding it if necessary.
Parameters
const Utf8 * aStr | String to append |
compare(const UString &)
OSN_IMPORT int | compare | ( | const UString & | aUString | ) | const |
Compares two strings using strcmp(). Note that this is not linguistic comparison nor case insensitive.
Parameters
const UString & aUString | UString object to compare |
compare(const Utf8 *)
OSN_IMPORT int | compare | ( | const Utf8 * | aStr | ) | const |
Compares two strings using strcmp(). Note that this is not linguistic comparison nor case insensitive.
Parameters
const Utf8 * aStr | String to compare |
compareC(const UString &)
OSN_IMPORT int | compareC | ( | const UString & | aUString | ) | const |
Compares two strings for ordering using the linguistically correct rules for the current locale. When sorting a large number of strings, it will be significantly faster to obtain collation keys with g_utf8_collate_key()from libglib and compare the keys with strcmp() when sorting instead of sorting the original strings.
Parameters
const UString & aUString | UString object to compare |
compareC(const Utf8 *)
OSN_IMPORT int | compareC | ( | const Utf8 * | aStr | ) | const |
Compares two strings for ordering using the linguistically correct rules for the current locale. When sorting a large number of strings, it will be significantly faster to obtain collation keys with g_utf8_collate_key() from libglib and compare the keys with strcmp() when sorting instead of sorting the original strings. If aStr is invalid utf8, UString::InvalidUtf8 exception is thrown.
Parameters
const Utf8 * aStr | String to compare |
erase(long, long)
OSN_IMPORT void | erase | ( | long | aPos, |
| long | aCharCount |
| ) | |
Erase a substring
- Since
- S60 5.0
- Exceptions
-
std:out_of_range |
is thrown if given position is invalid
|
Parameters
long aPos | The character position to start erasing from |
long aCharCount | number of characters to erase. |
getByteLength()
OSN_IMPORT long | getByteLength | ( | ) | const |
Returns the length of the string in bytes
getCharLength()
OSN_IMPORT long | getCharLength | ( | ) | const |
Returns the length of the string in characters.
getUtf8()
OSN_IMPORT const Utf8 * | getUtf8 | ( | ) | const |
insert(long, const Utf8 *)
OSN_IMPORT void | insert | ( | long | aPos, |
| const Utf8 * | aStr |
| ) | |
Inserts aStr into string, expanding it if necessary. If aPos is -1, bytes are inserted at the end of the string.
- Since
- S60 5.0
- Exceptions
-
std::bad_alloc |
|
std:out_of_range |
is thrown if given position is invalid
|
Parameters
long aPos | The character position to insert the copy of the string |
const Utf8 * aStr | The string to insert |
insert(long, const Utf8 *, long)
OSN_IMPORT void | insert | ( | long | aPos, |
| const Utf8 * | aStr, |
| long | aCharCount |
| ) | |
Inserts aStr into string, expanding it if necessary. Because length is provided, aStr may contain embedded nulls and need not be null terminated. If aPos is -1, bytes are inserted at the end of the string.
- Since
- S60 5.0
- Exceptions
-
std::bad_alloc |
|
std:out_of_range |
is thrown if given position is invalid
|
Parameters
long aPos | The character position to insert the copy of the string |
const Utf8 * aStr | The string to insert |
long aCharCount | Character count. |
isEmpty()
OSN_IMPORT bool | isEmpty | ( | ) | const |
Checks whether string is empty.
isNull()
OSN_IMPORT bool | isNull | ( | ) | const |
Checks whether string is null.
operator=(const UString &)
Parameters
const UString & aRhs | Assignment source |
operator=(const Utf8 *)
Parameters
const Utf8 * aRhs | Assignment source |
operator==(const UString &)
OSN_IMPORT bool | operator== | ( | const UString & | aRhs | ) | const |
Parameters
const UString & aRhs | UString object to compare |
operator==(const Utf8 *)
OSN_IMPORT bool | operator== | ( | const Utf8 * | aRhs | ) | const |
Parameters
const Utf8 * aRhs | String to compare |
operator[](long)
OSN_IMPORT Unicode | operator[] | ( | long | aPos | ) | |
Returns unicode at given position in string
- Since
- S60 5.0
- Exceptions
-
std:out_of_range |
is thrown if given position is invalid
|
Parameters
long aPos | The requested position |
replace(long, const Utf8 *)
OSN_IMPORT void | replace | ( | long | aPos, |
| const Utf8 * | aStr |
| ) | |
Replace a substring with a given string, expanding it if necessary
- Since
- S60 5.0
- Exceptions
-
std::bad_alloc |
|
std:out_of_range |
is thrown if given position is invalid
|
Parameters
long aPos | The charater position to replace the string |
const Utf8 * aStr | The string to insert |
replace(long, const Utf8 *, long)
OSN_IMPORT void | replace | ( | long | aPos, |
| const Utf8 * | aStr, |
| long | aCharCount |
| ) | |
Replace a substring with a given string, expanding it if necessary. Because length is provided, aStr may contain embedded nulls and need not be null terminated. If aLength is < 0, length is assumed to be aStr's length.
- Since
- S60 5.0
- Exceptions
-
std::bad_alloc |
|
std:out_of_range |
is thrown if given position is invalid
|
Parameters
long aPos | The character position to replace the string |
const Utf8 * aStr | The string to insert |
long aCharCount | Character count. |
Member Data Documentation
auto_ptr< UStringImpl > mImpl
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.