#include <xml/utils/xmlengxestrings.h>
Link against: xmlengineutils.lib
class TXmlEngConstString |
Protected Attributes | |
---|---|
char * | iString |
Public Member Functions | |
---|---|
TXmlEngConstString() | |
TXmlEngConstString(const char *) | |
IMPORT_C HBufC * | AllocL() |
IMPORT_C HBufC * | AllocLC() |
IMPORT_C TInt | Compare(TXmlEngConstString) |
IMPORT_C char * | CopyL() |
const char * | Cstring() |
const char * | CstringDef(const char *) |
TBool | Equals(TXmlEngConstString) |
TBool | IsNull() |
IMPORT_C TUint | Length() |
TBool | NotNull() |
TPtrC8 | PtrC8() |
IMPORT_C TUint | Size() |
Protected Member Functions | |
---|---|
void | Set(char *) |
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.
TXmlEngConstString | ( | const char * | aString | ) | [inline] |
Constructor
Parameters | |
---|---|
aString | The string for initialization. Ownership is not transferred and the string must stay in scope for the lifetime of this object. |
IMPORT_C HBufC * | AllocL | ( | ) | const |
Allocates a HBufC from the string contents. Ownership is transferred to the caller.
... HBufC* attrValue = attr.Value().AllocL(); ...
See also: AllocLC()
Allocates UTF-16 heap descriptor from the TDOMString contents
... HBufC* attrValue = attr.Value().AllocL(); ...
AllocLC() does the same, but returned HBufC* is already on the cleanup stack after a call to this method.
Leave Codes | |
---|---|
KErrNoMemory | Memory allocation failure |
KUriUtilsCannotConvert | String cannot be converted |
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.
... HBufC* attrValue = attr.Value().AllocLC(); ...
See also: AllocL()
Allocates UTF-16 heap descriptor from the TXmlEngConstString contents and pushes the descriptor to cleanup stack.
... HBufC* attrValue = attr.Value().AllocLC(); ...
Leave Codes | |
---|---|
KErrNoMemory | Memory allocation failure |
KUriUtilsCannotConvert | String cannot be converted |
IMPORT_C TInt | Compare | ( | TXmlEngConstString | aString | ) | const |
Compares with another string. NULL and "" are considered equal.
Parameters | |
---|---|
aString | The string to compare |
IMPORT_C char * | CopyL | ( | ) | const |
Creates a new copy of the string contents. Ownership for the new string is transferred to the caller.
Leave Codes | |
---|---|
KErrNoMemory | Memory allocation failure |
const char * | Cstring | ( | ) | const [inline] |
Gets a c string
const char * | CstringDef | ( | const char * | aDefaultValue | ) | const [inline] |
Gets a c string or if NULL, return a default value.
Parameters | |
---|---|
aDefaultValue | default value |
TBool | Equals | ( | TXmlEngConstString | aString | ) | const [inline] |
Compares with another string. NULL and "" are considered equal.
Parameters | |
---|---|
aString | The string to compare |
TBool | IsNull | ( | ) | const [inline] |
Check if the string is NULL
TBool | NotNull | ( | ) | const [inline] |
Check if the string is not NULL