VTK
Classes | Public Types | Public Member Functions | Static Public Attributes
vtkUnicodeString Class Reference

String class that stores Unicode text. More...

#include <vtkUnicodeString.h>

List of all members.

Classes

class  const_iterator

Public Types

typedef vtkUnicodeStringValueType value_type
typedef vtkstd::string::size_type size_type

Public Member Functions

vtkUnicodeStringoperator= (const vtkUnicodeString &)
void push_back (value_type)
void clear ()
vtkUnicodeString fold_case () const
int compare (const vtkUnicodeString &) const
vtkUnicodeString substr (size_type offset=0, size_type count=npos) const
void swap (vtkUnicodeString &)
 vtkUnicodeString ()
 vtkUnicodeString (const vtkUnicodeString &)
 vtkUnicodeString (size_type count, value_type character)
 vtkUnicodeString (const_iterator begin, const_iterator end)
const_iterator begin () const
const_iterator end () const
value_type at (size_type offset) const
value_type operator[] (size_type offset) const
const char * utf8_str () const
void utf8_str (vtkstd::string &result) const
vtkstd::vector< vtkTypeUInt16 > utf16_str () const
void utf16_str (vtkstd::vector< vtkTypeUInt16 > &result) const
size_type byte_count () const
size_type character_count () const
bool empty () const
vtkUnicodeStringoperator+= (value_type)
vtkUnicodeStringoperator+= (const vtkUnicodeString &rhs)
void append (const vtkUnicodeString &value)
void append (size_type count, value_type character)
void append (const_iterator begin, const_iterator end)
void assign (const vtkUnicodeString &value)
void assign (size_type count, value_type character)
void assign (const_iterator begin, const_iterator end)

Static Public Member Functions

static bool is_utf8 (const char *)
static bool is_utf8 (const vtkstd::string &)
static vtkUnicodeString from_utf8 (const char *)
static vtkUnicodeString from_utf8 (const char *begin, const char *end)
static vtkUnicodeString from_utf8 (const vtkstd::string &)
static vtkUnicodeString from_utf16 (const vtkTypeUInt16 *)

Static Public Attributes

static const size_type npos

Detailed Description

String class that stores Unicode text.

vtkUnicodeString provides storage for Unicode text. Conceptually, it acts as a container for a sequence of Unicode characters, providing a public interface similar to basic_string<>. For character-oriented operations, this means reading / writing 32-bit UTF-32 / UCS-4 characters. Internally, characters may be stored using variable-length encodings for efficiency. Explicit conversions to-and-from other encodings are provided, and implicit conversions are deliberately avoided, to avoid confusion.

Note that, because vtkUnicodeString uses variable-length encodings for storage, character-oriented operations will generally provide O(N) access instead of O(1).

The current implementation stores the sequence with UTF-8 encoding, but this choice is subject to change and might become a compile-time or run-time option.

Thanks:
Developed by Timothy M. Shead (tshead@sandia.gov) at Sandia National Laboratories.
Tests:
vtkUnicodeString (Tests)

Definition at line 70 of file vtkUnicodeString.h.


Member Typedef Documentation

Definition at line 73 of file vtkUnicodeString.h.

typedef vtkstd::string::size_type vtkUnicodeString::size_type

Definition at line 74 of file vtkUnicodeString.h.


Constructor & Destructor Documentation

Constructs an empty string.

Constructs an empty string.

Constructs an empty string.

Constructs an empty string.


Member Function Documentation

static bool vtkUnicodeString::is_utf8 ( const char *  ) [static]

Tests a sequence of bytes, returning true iff they are a valid UTF-8 sequence.

static bool vtkUnicodeString::is_utf8 ( const vtkstd::string &  ) [static]

Tests a sequence of bytes, returning true iff they are a valid UTF-8 sequence.

static vtkUnicodeString vtkUnicodeString::from_utf8 ( const char *  ) [static]

Constructs a string from a null-terminated sequence of UTF-8 encoded characters.

static vtkUnicodeString vtkUnicodeString::from_utf8 ( const char *  begin,
const char *  end 
) [static]

Constructs a string from a null-terminated sequence of UTF-8 encoded characters.

static vtkUnicodeString vtkUnicodeString::from_utf8 ( const vtkstd::string &  ) [static]

Constructs a string from a null-terminated sequence of UTF-8 encoded characters.

static vtkUnicodeString vtkUnicodeString::from_utf16 ( const vtkTypeUInt16 *  ) [static]

Constructs a string from a null-terminated sequence of UTF-8 encoded characters.

vtkUnicodeString& vtkUnicodeString::operator= ( const vtkUnicodeString )

Replaces the current sequence with a deep copy of another.

Returns a forward iterator that points at the first element of the sequence (or just beyond the end of an empty sequence).

Returns a forward iterator that points at the first element of the sequence (or just beyond the end of an empty sequence).

Returns the Unicode character at the given character offset within the sequence, or throws vtkstd::out_of_range if the offset is invalid.

value_type vtkUnicodeString::operator[] ( size_type  offset) const

Returns the Unicode character at the given character offset within the sequence, or throws vtkstd::out_of_range if the offset is invalid.

const char* vtkUnicodeString::utf8_str ( ) const

Returns the sequence as a null-terminated sequence of UTF-8 encoded characters.

void vtkUnicodeString::utf8_str ( vtkstd::string &  result) const

Returns the sequence as a null-terminated sequence of UTF-8 encoded characters.

vtkstd::vector<vtkTypeUInt16> vtkUnicodeString::utf16_str ( ) const

Returns the sequence as a null-terminated sequence of UTF-8 encoded characters.

void vtkUnicodeString::utf16_str ( vtkstd::vector< vtkTypeUInt16 > &  result) const

Returns the sequence as a null-terminated sequence of UTF-8 encoded characters.

Returns the number of bytes (not characters) in the sequence.

Returns the number of bytes (not characters) in the sequence.

bool vtkUnicodeString::empty ( ) const

Returns the number of bytes (not characters) in the sequence.

vtkUnicodeString& vtkUnicodeString::operator+= ( value_type  )

Append a Unicode character to the end of the sequence.

vtkUnicodeString& vtkUnicodeString::operator+= ( const vtkUnicodeString rhs)

Append a Unicode character to the end of the sequence.

Append a Unicode character to the end of the sequence.

void vtkUnicodeString::append ( const vtkUnicodeString value)

Append Unicode to the current sequence.

void vtkUnicodeString::append ( size_type  count,
value_type  character 
)

Append Unicode to the current sequence.

Append Unicode to the current sequence.

void vtkUnicodeString::assign ( const vtkUnicodeString value)

Replace the current sequence with another.

void vtkUnicodeString::assign ( size_type  count,
value_type  character 
)

Replace the current sequence with another.

Replace the current sequence with another.

Resets the string to an empty sequence

Returns a copy of the current sequence, modified so that differences in case are eliminated. Thus, you can run fold_case() on two strings and then comparse them to obtain a case-insensitive comparison. Note that the string returned by fold_case() may be larger than the original source sequence, See http://www.unicode.org/Public/UNIDATA/CaseFolding.txt for details.

Returns a negative value if the sequence compares less-than the operand sequence, zero if the two sequences compare equal, or a positive value otherwise. Note that the definition of "less-than" is undefined, so you should use some other method if you wish to establish a specific ordering (such as alphabetical).

vtkUnicodeString vtkUnicodeString::substr ( size_type  offset = 0,
size_type  count = npos 
) const

Returns a subset of the current sequence that up-to 'count' characters in length, starting at character 'offset'.

Swap the sequences stored by two strings.


Member Data Documentation

The largest representable value of size_type, used as a special-code.

Definition at line 188 of file vtkUnicodeString.h.


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