TXmlEngConstString Class Reference
Implements a constant string used within libxml2-based API's.
TXmlEngConstString contains a pointer to a zero-terminated UTF-8 string. The contents of the string is not supposed to be changed. From this point of view TXmlEngConstString instances are close to the concept of immutable strings.
Ownership of the string is not defined for TXmlEngConstString. Thus, in different contexts (APIs), different string-handling policies may be applied. For instance, in XML Engine SAX API all reported via callbacks strings of TXmlEngConstString type are assumed owned by the parser.
TXmlEngConstString is a base class for other specialized string classes in XML Engine APIs.
Protected Member Functions |
---|
void | Set(char *) |
Constructor & Destructor Documentation
TXmlEngConstString()
TXmlEngConstString | ( | ) | [inline] |
TXmlEngConstString(const char *)
TXmlEngConstString | ( | const char * | aString | ) | [inline] |
Parameters
const char * aString | The string for initialization. Ownership is not transferred and the string must stay in scope for the lifetime of this object. |
Member Functions Documentation
AllocL()
IMPORT_C HBufC * | AllocL | ( | ) | const |
Allocates a HBufC from the string contents. Ownership is transferred to the caller.
Typical use:
...
HBufC* attrValue = attr.Value().AllocL();
...
AllocLC() - leave
- KErrNoMemory Memory allocation failure
- leave
- KUriUtilsCannotConvert String cannot be converted
Allocates UTF-16 heap descriptor from the TDOMString contents
Typical use:
...
HBufC* attrValue = attr.Value().AllocL();
...
AllocLC() does the same, but returned HBufC* is already on the cleanup stack after a call to this method.
AllocLC()
IMPORT_C HBufC * | AllocLC | ( | ) | const |
Allocates a HBufC from the string contents and pushes the descriptor to cleanup stack. Ownership is transferred to the caller.
Typical use:
...
HBufC* attrValue = attr.Value().AllocLC();
...
AllocL() - leave
- KErrNoMemory Memory allocation failure
- leave
- KUriUtilsCannotConvert String cannot be converted
Allocates UTF-16 heap descriptor from the
TXmlEngConstString contents and pushes the descriptor to cleanup stack.
Typical use:
...
HBufC* attrValue = attr.Value().AllocLC();
...
Compare(TXmlEngConstString)
Compares with another string. NULL and "" are considered equal.
CopyL()
IMPORT_C char * | CopyL | ( | ) | const |
Creates a new copy of the string contents. Ownership for the new string is transferred to the caller.
-
leave
- KErrNoMemory Memory allocation failure
Cstring()
const char * | Cstring | ( | ) | const [inline] |
CstringDef(const char *)
const char * | CstringDef | ( | const char * | aDefaultValue | ) | const [inline] |
Gets a c string or if NULL, return a default value.
Parameters
const char * aDefaultValue | default value |
Equals(TXmlEngConstString)
Compares with another string. NULL and "" are considered equal.
IsNull()
TBool
| IsNull | ( | ) | const [inline] |
Check if the string is NULL
Length()
IMPORT_C TUint | Length | ( | ) | const |
Get the length of the string. For non-ASCII strings, Size() != Length() due to the UTF-8 encoding used for non-ASCII characters.
NotNull()
TBool
| NotNull | ( | ) | const [inline] |
Check if the string is not NULL
PtrC8()
Get a TPtrC8 that contains the string
Set(char *)
void | Set | ( | char * | aString | ) | [protected, inline] |
Set a new string value. The old string is not freed. Ownership is not transferred.
Parameters
char * aString | The new value |
Size()
IMPORT_C TUint | Size | ( | ) | const |
Returns the size of the string in bytes
Member Data Documentation
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.