zorba::String Class Reference

The Zorba String class. More...

#include <zorba/zorbastring.h>

List of all members.

Public Member Functions

const Stringappend (const char *suffix)
 Append characters onto "this".
bool byteEqual (const char *aString, unsigned int aBytes) const
 Byte by byte comparison of two strings.
size_t bytes () const
 Returns the number of bytes in the string, not including any null-termination.
const char * c_str () const
 Returns a non-modifiable standard C character array version of the string.
int compare (const String &aString) const
 Compares two strings.
bool empty () const
 True if the string has no characters.
const StringencodeForUri ()
 Encodes reserved characters in an String that is intended to be used in the path segment of a URI.
bool endsWith (const char *pattern) const
 Determine if "pattern" is a suffix of "this".
bool equals (const String &aString) const
 Compares two strings.
const StringescapeHtmlUri ()
 Escape all characters except printable characters of the US-ASCII coded character set, specifically the octets ranging from 32 to 126 (decimal).
const StringformatAsXML ()
 Escape all characters except US-ASCII coded character set.
int indexOf (const char *pattern) const
 Locate in "this" the first occurrence of the "pattern" substring.
const StringiriToUri ()
 Converts an String containing an IRI into a URI.
int lastIndexOf (const char *pattern) const
 Locate in "this" the last occurrence of the "pattern" substring.
size_t length () const
 Returns the number of characters in the string, not including any null-termination.
const Stringlowercase ()
 Convert to lowercase.
const StringnormalizeSpace ()
 Returns the value of "this" with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of one or more than one whitespace character with a single space, #x20.
bool operator!= (const String &str) const
const Stringoperator= (xqpStringStore *other)
 Assingment operator that is used in the Zorba engine itself.
const Stringoperator= (const String &other)
 Assignment operator.
bool operator== (const String &str) const
 String (const std::string &aString)
 Constructor to construct a String from a std::string.
 String (const char *aString)
 Constructor to construct a String from a const char*.
 String (xqpStringStore *aString)
 Constructor that is used to construct Items in the Zorba engine itself.
 String (const String &other)
 Copy constructor.
const Stringtrim ()
 Removes leading and trailing whitespace.
const Stringtrim (const char *start, int len)
 Removes leading and trailing whitespace.
const Stringuppercase ()
 Convert to uppercase.
 ~String ()
 Destructor.

Friends

class Unmarshaller


Detailed Description

The Zorba String class.

The interface of this class is similar to that of std::string. However, it contains Unicode characters encoded as UTF-8. UTF-8 FAQ

See also:
[http://unicode.org/faq/utf_bom.html#2].
Examples:

external_functions.cpp, and sax2.cpp.

Definition at line 33 of file zorbastring.h.


Constructor & Destructor Documentation

zorba::String::String ( const String other  ) 

Copy constructor.

zorba::String::String ( xqpStringStore *  aString  ) 

Constructor that is used to construct Items in the Zorba engine itself.

This constructor is for internal use only.

zorba::String::String ( const char *  aString  ) 

Constructor to construct a String from a const char*.

Parameters:
aString the const char* to construct the String from.

zorba::String::String ( const std::string &  aString  ) 

Constructor to construct a String from a std::string.

Parameters:
aString the std::string to construct the String from.

zorba::String::~String (  ) 

Destructor.


Member Function Documentation

const String& zorba::String::append ( const char *  suffix  ) 

Append characters onto "this".

bool zorba::String::byteEqual ( const char *  aString,
unsigned int  aBytes 
) const

Byte by byte comparison of two strings.

size_t zorba::String::bytes (  )  const

Returns the number of bytes in the string, not including any null-termination.

Returns:
The number of bytes.
See also:
length(), empty().

const char* zorba::String::c_str (  )  const

Returns a non-modifiable standard C character array version of the string.

Returns:
const char* a const pointer to a UTF-8 encoded C string, identical to the current string. The returned string is null-terminated.

int zorba::String::compare ( const String aString  )  const

Compares two strings.

Returns:
-1 if this < aString, 0 if this == aString, 1 if this > aString.

bool zorba::String::empty (  )  const

True if the string has no characters.

Returns:
True if the string has no elements, false otherwise.
See also:
length(), bytes().

const String& zorba::String::encodeForUri (  ) 

Encodes reserved characters in an String that is intended to be used in the path segment of a URI.

see Section 2 [http://www.ietf.org/rfc/rfc3986.txt]

bool zorba::String::endsWith ( const char *  pattern  )  const

Determine if "pattern" is a suffix of "this".

Returns:
True if "this" ends with "pattern".

bool zorba::String::equals ( const String aString  )  const

Compares two strings.

Returns:
true if this == aString.
See also:
byteEqual().

const String& zorba::String::escapeHtmlUri (  ) 

Escape all characters except printable characters of the US-ASCII coded character set, specifically the octets ranging from 32 to 126 (decimal).

const String& zorba::String::formatAsXML (  ) 

Escape all characters except US-ASCII coded character set.

int zorba::String::indexOf ( const char *  pattern  )  const

Locate in "this" the first occurrence of the "pattern" substring.

Returns:
The offset into this of the start of "pattern", or -1 if not found.

const String& zorba::String::iriToUri (  ) 

Converts an String containing an IRI into a URI.

see Section 3.1 [http://www.ietf.org/rfc/rfc3987.txt]

int zorba::String::lastIndexOf ( const char *  pattern  )  const

Locate in "this" the last occurrence of the "pattern" substring.

Returns:
The offset into this of the start of "pattern", or -1 if not found.

size_t zorba::String::length (  )  const

Returns the number of characters in the string, not including any null-termination.

Returns:
The number of UTF-8 characters.
See also:
bytes(), empty().

const String& zorba::String::lowercase (  ) 

Convert to lowercase.

Returns:
String the String convert to lowercase.

const String& zorba::String::normalizeSpace (  ) 

Returns the value of "this" with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of one or more than one whitespace character with a single space, #x20.

Note:
whitespace = " \t\r\n" meaning (#x20) (#x9) (#xD) (#xA).
Returns:
String the whitespace normalized String.

bool zorba::String::operator!= ( const String str  )  const

const String& zorba::String::operator= ( xqpStringStore *  other  ) 

Assingment operator that is used in the Zorba engine itself.

This operator is for internal use only.

const String& zorba::String::operator= ( const String other  ) 

Assignment operator.

bool zorba::String::operator== ( const String str  )  const

const String& zorba::String::trim (  ) 

Removes leading and trailing whitespace.

Note:
Space = " " meaning (#x20).

const String& zorba::String::trim ( const char *  start,
int  len 
)

Removes leading and trailing whitespace.

Note:
If called with trim(" \t\r\n", 4) it will strip leading and trailing whitespaces. Whitespace = " \t\r\n" meaning (#x20) (#x9) (#xD) (#xA).

const String& zorba::String::uppercase (  ) 

Convert to uppercase.

Returns:
String the String convert to uppercase.


Friends And Related Function Documentation

friend class Unmarshaller [friend]

Definition at line 228 of file zorbastring.h.


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