OSXMLStringClass Class Reference

XML string. More...

#include <rtxCppXmlString.h>

Inheritance diagram for OSXMLStringClass:
OSRTBaseType

List of all members.

Public Member Functions

 OSXMLStringClass ()
 The default constructor creates an empty string.
 OSXMLStringClass (const OSUTF8CHAR *strval, OSBOOL cdata_=FALSE)
 This constructor initializes the string to contain the value.
 OSXMLStringClass (const OSUTF8CHAR *strval, size_t nbytes, OSBOOL cdata_=FALSE)
 This constructor initializes the string to contain the value.
 OSXMLStringClass (const char *strval, OSBOOL cdata_=FALSE)
 This constructor initializes the string to contain the value.
 OSXMLStringClass (const OSXMLSTRING &str)
 Copy constructor.
 OSXMLStringClass (const OSXMLStringClass &str)
 Copy constructor.
virtual ~OSXMLStringClass ()
 The destructor frees string memory if the memory ownership flag is set.
void appendValue (const OSUTF8CHAR *utf8str, size_t nbytes=0)
 This method copies the given string value to the end of internal string storage variable.
OSRTBaseTypeclone () const
 Clone method.
int compare (const OSUTF8CHAR *value2) const
 This method does a standard string comparison operation (strcmp) with the UTF-8 null terminated string.
void copyValue (const OSUTF8CHAR *utf8str, size_t nbytes=0)
 This method copies the given string value to the internal string storage variable.
void copyValue (const char *cstring, size_t nbytes=0)
 This method copies the given string value to the internal string storage variable.
const char * c_str () const
 This method returns the pointer to C null terminated string.
virtual int decodeXML (OSCTXT *pctxt)
 This method decodes XML content at the current stream/buffer position into this string object.
virtual int encodeXML (OSRTMessageBufferIF &msgbuf, const OSUTF8CHAR *elemName, OSXMLNamespace *pNS)
 This method encodes the data in this string object into XML content in the encode data stream.
OSBOOL equals (const OSUTF8CHAR *value2) const
 This method compares this string with the UTF-8 null terminated string for equality.
const OSUTF8CHAR * getValue () const
 This method returns a pointer to the UTF-8 null terminated string.
OSBOOL isCDATA () const
 This method returns the value of the cdata member variable.
void setCDATA (OSBOOL bvalue)
 This method sets the value of the cdata member variable.
void print (const char *name)
 This method prints the string value to standard output.
void setValue (const OSUTF8CHAR *utf8str, size_t nbytes=0)
 This method sets the string value to the given string.
void setValue (const char *cstring, size_t nbytes=0)
 This method sets the string value to the given string.
void setValue (OSRTMemBuf &membuf)
 This method sets the string value to the value of the data in the given memory buffer object.
OSXMLStringClassoperator= (const OSXMLStringClass &original)
 Assignment operator.
OSXMLStringClassoperator= (const char *original)
 Assignment operator for C strings.
OSXMLStringClassoperator= (const OSUTF8CHAR *original)
 Assignment operator for C UTF-8 strings.
 operator const char * () const
 String to C const char* type conversion operator.
 operator const OSUTF8CHAR * () const
 String to C const OSUTF8CHAR* type conversion operator.
size_t length () const
 This method returns the number of characters.
size_t size ()
 This method returns the number of bytes.

Detailed Description

XML string.

This is the base class for generated C++ data type classes for XSD string types (string, token, NMTOKEN, etc.).

Definition at line 46 of file rtxCppXmlString.h.


Constructor & Destructor Documentation

OSXMLStringClass::OSXMLStringClass ( const OSUTF8CHAR *  strval,
OSBOOL  cdata_ = FALSE 
)

This constructor initializes the string to contain the value.

A deep-copy of the given value is done.

Parameters:
strval - String value
cdata_ - Should string be encoded as a CDATA section?
OSXMLStringClass::OSXMLStringClass ( const OSUTF8CHAR *  strval,
size_t  nbytes,
OSBOOL  cdata_ = FALSE 
)

This constructor initializes the string to contain the value.

It copies up to the given number of bytes from the source string. A deep-copy of the given value is done.

Parameters:
strval - String value
nbytes - Number of bytes to copy from source string
cdata_ - Should string be encoded as a CDATA section?
OSXMLStringClass::OSXMLStringClass ( const char *  strval,
OSBOOL  cdata_ = FALSE 
)

This constructor initializes the string to contain the value.

A deep-copy of the given value is done.

Parameters:
strval - String value
cdata_ - Should string be encoded as a CDATA section?
OSXMLStringClass::OSXMLStringClass ( const OSXMLSTRING &  str  ) 

Copy constructor.

Parameters:
str - C XML string structure.
OSXMLStringClass::OSXMLStringClass ( const OSXMLStringClass str  ) 

Copy constructor.

Parameters:
str - C++ XML string class.

Member Function Documentation

void OSXMLStringClass::appendValue ( const OSUTF8CHAR *  utf8str,
size_t  nbytes = 0 
)

This method copies the given string value to the end of internal string storage variable.

A deep-copy of the given value is done; the class will delete this memory when the object is deleted.

Parameters:
utf8str - C null-terminated string.
nbytes - length of utf8str in bytes.
OSRTBaseType* OSXMLStringClass::clone (  )  const [inline, virtual]

Clone method.

Creates a copied instance and returns pointer to OSRTBaseType.

Reimplemented from OSRTBaseType.

Definition at line 142 of file rtxCppXmlString.h.

int OSXMLStringClass::compare ( const OSUTF8CHAR *  value2  )  const [inline]

This method does a standard string comparison operation (strcmp) with the UTF-8 null terminated string.

Returns:
Zero (0) if the compared characters sequences are equal, -1 if the internal string value is less than the argument value, and +1 if the internal string value is greater than the argument value.

Definition at line 152 of file rtxCppXmlString.h.

void OSXMLStringClass::copyValue ( const char *  cstring,
size_t  nbytes = 0 
) [inline]

This method copies the given string value to the internal string storage variable.

A deep-copy of the given value is done; the class will delete this memory when the object is deleted.

Parameters:
cstring - C null-terminated string.
nbytes - length of cstring in bytes.

Definition at line 176 of file rtxCppXmlString.h.

void OSXMLStringClass::copyValue ( const OSUTF8CHAR *  utf8str,
size_t  nbytes = 0 
)

This method copies the given string value to the internal string storage variable.

A deep-copy of the given value is done; the class will delete this memory when the object is deleted.

Parameters:
utf8str - C null-terminated string.
nbytes - length of utf8str in bytes.
virtual int OSXMLStringClass::decodeXML ( OSCTXT *  pctxt  )  [virtual]

This method decodes XML content at the current stream/buffer position into this string object.

This method is normally overridden by a decodeXML method in a generated class.

Parameters:
pctxt Pointer to context block structure.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.
virtual int OSXMLStringClass::encodeXML ( OSRTMessageBufferIF msgbuf,
const OSUTF8CHAR *  elemName,
OSXMLNamespace *  pNS 
) [virtual]

This method encodes the data in this string object into XML content in the encode data stream.

This method is normally overridden by an encodeXML method in a generated class.

Parameters:
msgbuf Message buffer or stream object reference.
elemName XML element name that should be added to encoded fragment.
pNS Pointer to namespace structure.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.
OSBOOL OSXMLStringClass::isCDATA (  )  const [inline]

This method returns the value of the cdata member variable.

This indicates if this string should be encoded as a CDATA section in an XML document.

Returns:
- True if string is to be encoded as CDATA section

Definition at line 237 of file rtxCppXmlString.h.

void OSXMLStringClass::print ( const char *  name  )  [inline]

This method prints the string value to standard output.

Parameters:
name - Name of generated string variable.

Definition at line 253 of file rtxCppXmlString.h.

void OSXMLStringClass::setCDATA ( OSBOOL  bvalue  )  [inline]

This method sets the value of the cdata member variable.

This indicates if this string should be encoded as a CDATA section in an XML document.

Parameters:
bvalue - Boolean value.

Definition at line 246 of file rtxCppXmlString.h.

void OSXMLStringClass::setValue ( OSRTMemBuf membuf  )  [inline]

This method sets the string value to the value of the data in the given memory buffer object.

A deep-copy of the value is done.

Parameters:
membuf - Reference to a memory buffer object.

Definition at line 284 of file rtxCppXmlString.h.

void OSXMLStringClass::setValue ( const char *  cstring,
size_t  nbytes = 0 
) [inline]

This method sets the string value to the given string.

A deep-copy of the given value is done.

Parameters:
cstring - C null-terminated string.
nbytes - Number of bytes to copy from the source string. If zero, bytes are copied up to the null-terminator.

Definition at line 273 of file rtxCppXmlString.h.

void OSXMLStringClass::setValue ( const OSUTF8CHAR *  utf8str,
size_t  nbytes = 0 
)

This method sets the string value to the given string.

A deep-copy of the given value is done.

Parameters:
utf8str - UTF8 null-terminated string.
nbytes - Number of bytes to copy from the source string. If zero, bytes are copied up to the null-terminator.

The documentation for this class was generated from the following file: