CppGraph Application Framework©
Copyright © 2004-202x Geoff Goldberg
Classes | Typedefs | Functions
Strings
Collaboration diagram for Strings:

Classes

struct  cppgraph::utf16_character
 A UTF-16 character. More...
 
struct  cppgraph::utf8_character
 A UTF-8 character. More...
 
struct  cppgraph::utf_character_iterator_t< Code_Point >
 A UTF character iterator is a bidirectional iterator that returns the code units of a UTF character. More...
 
struct  cppgraph::utf_string_iterator_t< Code_Point >
 A UTF string iterator is a forward iterator that returns the code points of a UTF string. More...
 
struct  cppgraph::utf_string_t< Code_Point >
 A UTF string is a null-terminated sequence of UTF characters. More...
 

Typedefs

using cppgraph::utf16_character_iterator = utf_character_iterator_t< utf16_character >
 Class representing a UTF-16 character iterator.
 
using cppgraph::utf16_string = utf_string_t< utf16_character >
 Class representing a null-terminated sequence of UTF-16 characters.
 
using cppgraph::utf16_string_iterator = utf_string_iterator_t< utf16_character >
 Class representing a UTF-16 string iterator.
 
using cppgraph::utf8_character_iterator = utf_character_iterator_t< utf8_character >
 Class representing a UTF-8 character iterator.
 
using cppgraph::utf8_string = utf_string_t< utf8_character >
 Class representing a null-terminated sequence of UTF-8 characters.
 
using cppgraph::utf8_string_iterator = utf_string_iterator_t< utf8_character >
 Class representing a UTF-8 string iterator.
 

Functions

template<>
std::wstring cppgraph::convert (utf8_string const &string)
 Returns an std:: wstring converted from a specified UTF-8 string. More...
 
template<>
utf8_string cppgraph::convert (std::wstring const &string)
 Returns a UTF-8 string converted from a specified std::wstring. More...
 
template<>
utf32_string cppgraph::convert (utf16_string const &string)
 Returns a UTF-32 string converted from a specified UTF-16 string. More...
 
template<>
utf16_string cppgraph::convert (utf32_string const &string)
 Returns a UTF-16 string converted from a specified UTF-32 string. More...
 
template<>
char32_t cppgraph::convert (utf8_character const &character)
 Returns a UTF-32 character converted from a specified UTF-8 character. More...
 
template<>
char32_t cppgraph::convert (utf16_character const &character)
 Returns a UTF-32 character converted from a specified UTF-16 character. More...
 
utf8_string cppgraph::format_string (char const *format,...)
 Formats a UTF-8 string. More...
 
utf8_string cppgraph::format_string_v (char const *format, va_list args)
 Formats a UTF-8 string from a format string and a va_list. More...
 
template<typename T >
cppgraph::from_string (utf8_string const &string)
 Return a unique pointer to an instance of type T whose value is parsed from a string. More...
 
bool cppgraph::is_normalized_string (utf8_string const &string, normalization_form_enum normalization_form_type)
 Determines if a specified utf16_string is normalized. More...
 
bool cppgraph::operator!= (utf8_character const &left, utf8_character const &right)
 Returns true if a two UTF-8 characters have different values. More...
 
bool cppgraph::operator!= (utf16_character const &left, utf16_character const &right)
 Returns true if a two UTF-16 characters have different values. More...
 
utf_string_tcppgraph::utf_string_t< Code_Point >::operator= (typename Code_Point::code_unit_type const *string)
 Assignment from a string containing a sequence of UTF characters. More...
 
bool cppgraph::operator== (utf8_character const &left, utf8_character const &right)
 Returns true if a two UTF-8 characters have the same value. More...
 
bool cppgraph::operator== (utf16_character const &left, utf16_character const &right)
 Returns true if a two UTF-16 characters have the same value. More...
 
utf8_string cppgraph::to_normalized_string (utf8_string const &string, normalization_form_enum normalization_form_type)
 Returns a UTF-8 string that is the normalized version of a specified string. The normalization is performed using the Unicode Normalization Form C (NFC) algorithm. More...
 
template<typename T >
utf8_string cppgraph::to_string (T const &t)
 Serializes a value, as a CML object, to a string. More...
 
std::vector< utf8_stringcppgraph::to_tokens (utf8_string const &string, utf8_string const &delimiters)
 Returns a vector of strings tokenized from a specified string using specified delimiter characters. More...
 

Detailed Description

Function Documentation

◆ convert() [1/6]

template<>
std::wstring cppgraph::convert ( utf8_string const &  string)

Returns an std:: wstring converted from a specified UTF-8 string.

Parameters
stringA UTF-8 string.
Returns
An std::wstring converted from string.

◆ convert() [2/6]

template<>
utf8_string cppgraph::convert ( std::wstring const &  string)

Returns a UTF-8 string converted from a specified std::wstring.

Parameters
stringA UTF-8 string.
Returns
A UTF-8 string converted from string.

◆ convert() [3/6]

template<>
utf32_string cppgraph::convert ( utf16_string const &  string)

Returns a UTF-32 string converted from a specified UTF-16 string.

Parameters
stringA UTF-16 string.
Returns
A UTF-32 string converted from string.

◆ convert() [4/6]

template<>
utf16_string cppgraph::convert ( utf32_string const &  string)

Returns a UTF-16 string converted from a specified UTF-32 string.

Parameters
stringA UTF-32 string.
Returns
A UTF-16 string converted from string.

◆ convert() [5/6]

template<>
char32_t cppgraph::convert ( utf8_character const &  character)

Returns a UTF-32 character converted from a specified UTF-8 character.

Parameters
characterA UTF-8 character.
Returns
A UTF-32 character converted from character.

◆ convert() [6/6]

template<>
char32_t cppgraph::convert ( utf16_character const &  character)

Returns a UTF-32 character converted from a specified UTF-16 character.

Parameters
characterA UTF-16 character.
Returns
A UTF-32 character converted from character.

◆ format_string()

utf8_string cppgraph::format_string ( char const *  format,
  ... 
)

Formats a UTF-8 string.

Parameters
formatA UTF-8 format string, as used by printf().
...A list of comma-separated arguments corresponding to the format specifiers in format.
Returns
a UTF-8 string, formatted as specified.

◆ format_string_v()

utf8_string cppgraph::format_string_v ( char const *  format,
va_list  args 
)

Formats a UTF-8 string from a format string and a va_list.

Parameters
formatA UTF-8 format string, as used by printf().
argsA va_list containing arguments corresponding to the format specifiers in format.
Returns
a UTF-8 string, formatted as specified.

◆ from_string()

template<typename T >
T cppgraph::from_string ( utf8_string const &  string)

Return a unique pointer to an instance of type T whose value is parsed from a string.

Useful in conjunction with to_cml_string() to convert a type's value to and from a string.

Parsing is performed using operator >> ( istream &, T & ). The compiler will complain if no such function can be found.

Template Parameters
TThe data type.
Parameters
stringString containing a string representation of a value of T.
Returns
A unique pointer to an instance of T.

◆ is_normalized_string()

bool cppgraph::is_normalized_string ( utf8_string const &  string,
normalization_form_enum  normalization_form_type 
)

Determines if a specified utf16_string is normalized.

Parameters
stringA UTF-8 string.
normalization_form_typeThe normalization form to use.
Returns
The normalized version of string.

◆ operator!=() [1/2]

bool cppgraph::operator!= ( utf8_character const &  left,
utf8_character const &  right 
)

Returns true if a two UTF-8 characters have different values.

Parameters
leftA UTF-8 character.
rightA UTF-8 character.
Returns
true if the values of left and right are different.

◆ operator!=() [2/2]

bool cppgraph::operator!= ( utf16_character const &  left,
utf16_character const &  right 
)

Returns true if a two UTF-16 characters have different values.

Parameters
leftA UTF-16 character.
rightA UTF-16 character.
Returns
true if the values of left and right are different.

◆ operator=()

template<typename Code_Point>
utf_string_t< Code_Point > & cppgraph::utf_string_t< Code_Point >::operator= ( typename Code_Point::code_unit_type const *  string)

Assignment from a string containing a sequence of UTF characters.

Parameters
stringA pointer to a null-terminated sequence of UTF characters.
Returns
A reference to this instance.

◆ operator==() [1/2]

bool cppgraph::operator== ( utf8_character const &  left,
utf8_character const &  right 
)

Returns true if a two UTF-8 characters have the same value.

Parameters
leftA UTF-8 character.
rightA UTF-8 character.
Returns
true if the values of left and right are the same.

◆ operator==() [2/2]

bool cppgraph::operator== ( utf16_character const &  left,
utf16_character const &  right 
)

Returns true if a two UTF-16 characters have the same value.

Parameters
leftA UTF-16 character.
rightA UTF-16 character.
Returns
true if the values of left and right are the same.

◆ to_normalized_string()

utf8_string cppgraph::to_normalized_string ( utf8_string const &  string,
normalization_form_enum  normalization_form_type 
)

Returns a UTF-8 string that is the normalized version of a specified string. The normalization is performed using the Unicode Normalization Form C (NFC) algorithm.

Parameters
stringA UTF-8 string.
normalization_form_typeThe normalization form to use.
Returns
A normalized copy of string.

◆ to_string()

template<typename T >
utf8_string cppgraph::to_string ( T const &  t)

Serializes a value, as a CML object, to a string.

Formatting is performed using operator << ( ostream &, T const & ). The compiler will complain if no such function can be found.

Template Parameters
TThe data type.
Parameters
tA reference to the value to format.
Returns
A string containing a representation of the value of T, as a CML object.

◆ to_tokens()

std::vector< utf8_string > cppgraph::to_tokens ( utf8_string const &  string,
utf8_string const &  delimiters 
)

Returns a vector of strings tokenized from a specified string using specified delimiter characters.

Parameters
stringA UTF-8 string.
delimitersA UTF-8 string contining characters to be treated as delimiters.
Returns
A vector of UTF-8 strings tokenized from string using delimiters characters.