osncore::UStringImpl Class Reference
class osncore::UStringImpl
|
Glib string wrapper. ustring.h for description of ustring osncore.lib
-
Since
-
S60 5.0
Constructor & Destructor Documentation
UStringImpl(const Utf8 *)
UStringImpl
|
(
|
const
Utf8
*
|
aStr
|
)
|
[explicit]
|
Construct a string as a copy of given null terminated string.
-
Since
-
S60 5.0
-
Exceptions
-
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
Parameters
const
Utf8
* aStr
|
Utf-8 encoded string
|
UStringImpl(const Utf8 *, int)
UStringImpl
|
(
|
const
Utf8
*
|
aStr,
|
|
int
|
aLen
|
|
)
|
[explicit]
|
Construct a string 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.
-
Since
-
S60 5.0
-
Exceptions
-
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
Parameters
const
Utf8
* aStr
|
Utf-8 encoded string
|
int aLen
|
|
UStringImpl(Unicode)
UStringImpl
|
(
|
Unicode
|
aCodePoint
|
)
|
[explicit]
|
Construct a string from unicode code point. If Unicode is invalid,
-
Exceptions
-
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
-
Since
-
S60 5.0
Parameters
Unicode
aCodePoint
|
Unicode code point
|
UStringImpl(const UStringImpl &)
UStringImpl
copy constructor
-
Exceptions
-
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
-
Since
-
S60 5.0
Member Functions Documentation
append(const UStringImpl &)
Adds a string onto the end of string, expanding it if necessary.
Parameters
const
UStringImpl
& aUStringImpl
|
String object to append
|
append(const Utf8 *)
void
|
append
|
(
|
const
Utf8
*
|
aStr
|
)
|
|
Adds a string onto the end of string, expanding it if necessary.
Parameters
const
Utf8
* aStr
|
String to append
|
appendImpl(const char *, unsigned int)
void
|
appendImpl
|
(
|
const char *
|
aStr,
|
|
unsigned int
|
aLength
|
|
)
|
[private]
|
Implements the append functionality
-
Since
-
S60 5.0
Parameters
const char * aStr
|
The string to append
|
unsigned int aLength
|
The amount of characters to append
|
bytes()
Returns the length of the string in bytes
checkBuffer(unsigned int)
void
|
checkBuffer
|
(
|
unsigned int
|
aLength
|
)
|
[private]
|
Allocates memory from heap if needed for internal string, throws if allocation fail
-
Since
-
S60 5.0
-
Exceptions
-
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
Parameters
unsigned int aLength
|
length of bytes to allocate
|
compare(const UStringImpl &)
Compares two strings using
strcmp()
. Note that this is not linguistic comparison nor case insensitive.
Parameters
const
UStringImpl
& aUStringImpl
|
UStringImpl object to compare
|
compare(const Utf8 *)
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 UStringImpl &)
int
|
compareC
|
(
|
const
UStringImpl
&
|
aUStringImpl
|
)
|
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
UStringImpl
& aUStringImpl
|
UStringImpl object to compare
|
compareC(const Utf8 *)
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
|
empty()
Checks whether string is empty.
erase(long, long)
void
|
erase
|
(
|
long
|
aPosOffset,
|
|
long
|
aLength
|
|
)
|
|
Erase a substring
-
Since
-
S60 5.0
-
Exceptions
-
std:out_of_range
|
is thrown if given position is invalid
|
Parameters
long aPosOffset
|
|
long aLength
|
|
eraseImpl(unsigned int, unsigned int)
void
|
eraseImpl
|
(
|
unsigned int
|
aIndex,
|
|
unsigned int
|
aLength
|
|
)
|
[private]
|
Implements the erase functionality
-
Since
-
S60 5.0
-
Exceptions
-
std:out_of_range
|
is thrown if given index is invalid
|
Parameters
unsigned int aIndex
|
The character position to start erasing from
|
unsigned int aLength
|
The amount of characters to erase
|
initialize(const Utf8 *)
void
|
initialize
|
(
|
const
Utf8
*
|
aStr
|
)
|
[private]
|
Initialises internal string
-
Since
-
S60 5.0
-
Exceptions
-
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
Parameters
const
Utf8
* aStr
|
The string used for initialising
|
insert(long, const Utf8 *)
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:out_of_range
|
is thrown if given position is invalid
|
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
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)
void
|
insert
|
(
|
long
|
aPos,
|
|
const
Utf8
*
|
aStr,
|
|
long
|
aLength
|
|
)
|
|
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:out_of_range
|
is thrown if given position is invalid
|
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
Parameters
long aPos
|
The character position to insert the copy of the string
|
const
Utf8
* aStr
|
The string to insert
|
long aLength
|
|
insertImpl(unsigned int, const char *, unsigned int)
void
|
insertImpl
|
(
|
unsigned int
|
aIndex,
|
|
const char *
|
aInsertChars,
|
|
unsigned int
|
aInsertLength
|
|
)
|
[private]
|
Implements the insertion functionality
-
Since
-
S60 5.0
-
Exceptions
-
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
Parameters
unsigned int aIndex
|
The character position to insert the copy of the string
|
const char * aInsertChars
|
The string to insert
|
unsigned int aInsertLength
|
The amount of characters to insert
|
length()
Returns the length of the string in characters.
null()
Checks whether string is null.
operator[](long)
Unicode
|
operator[]
|
(
|
long
|
aIndex
|
)
|
|
Returns unicode at given position in string
-
Since
-
S60 5.0
-
Exceptions
-
std:out_of_range
|
is thrown if requested index is invalid
|
replace(long, const Utf8 *)
void
|
replace
|
(
|
long
|
aPos,
|
|
const
Utf8
*
|
aStr
|
|
)
|
|
Replace a substring with a given string, expanding it if necessary
-
Since
-
S60 5.0
-
Exceptions
-
std:out_of_range
|
is thrown if given position is invalid
|
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
Parameters
long aPos
|
The charater position to replace the string
|
const
Utf8
* aStr
|
The string to insert
|
replace(long, const Utf8 *, long)
void
|
replace
|
(
|
long
|
aPos,
|
|
const
Utf8
*
|
aStr,
|
|
long
|
aLength
|
|
)
|
|
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:out_of_range
|
is thrown if given position is invalid
|
std:bad_alloc
|
is thrown if string cannot be allocated from heap
|
Parameters
long aPos
|
The character position to replace the string
|
const
Utf8
* aStr
|
The string to insert
|
long aLength
|
|
utf8()
const
Utf8
*
|
utf8
|
(
|
)
|
const
|
Member Data Documentation
gsize
allocated_len
gsize
|
allocated_len
|
[private]
|
length of allocated bytes
gchar
internalStr
gchar
|
internalStr
|
[private]
|
Internal buffer, allocated from stack. Short strings are allocated from stack for performance reason,
bool isInHeap
Identifies if string is allocated from heap or not
gchar * str
Internal buffer, allocated from heap. Long strings are allocated from heap
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.