Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::G::Unichar Class Reference

A C++ gunichar wrapper class. More...

`#include <inti/glib/unicode.h>`

Inheritance diagram for Inti::G::Unichar:

List of all members.

## Public Member Functions

Constructors

- Unichar (gunichar c)
    Construct a new Unichar.
- Unichar (const Unichar &src)
    Copy constructor.
- Unichar & operator= (const Unichar &src)
    Assignment operator.

Accessors

- bool is_alnum () const
    Returns true if the character is alphanumeric.
- bool is_alpha () const
    Returns true if the character is alphabetic (i.e. a letter).
- bool is_cntrl () const
    Returns true if the character is a control character.
- bool is_digit () const
    Returns true if the character is numeric (i.e. a digit).
- bool is_graph () const
    Returns true if the character is printable; returns false for control characters, format characters, and spaces.
- bool is_lower () const
    Returns true if the character is a lowercase letter.
- bool is_print () const
    Returns true if the character is printable; returns true for spaces.
- bool is_punct () const
    Returns true if the character is punctuation or a symbol.
- bool is_space () const
    Returns true if the character is a space, tab, or line separator (newline, carriage return, etc.).
- bool is_upper () const
    Returns true if the character is uppercase.
- bool is_xdigit () const
    Returns true if the character is a hexidecimal digit.
- bool is_title () const
    Returns true if the character is titlecase.
- bool is_defined () const
    Returns true if the character is assigned in the Unicode standard.
- bool is_wide () const
    Returns true if the character is typically rendered in a double-width cell.
- GUnicodeType type () const
    Classifies a Unicode character by type.
- GUnicodeBreakType break_type () const
    Determines the break type of the unicode character.

Methods

- Unichar upper () const
    Converts the character to uppercase.
- Unichar lower () const
    Converts the character to lower case.
- Unichar title () const
    Converts the character to the titlecase.
- int digit_value () const
    Determines the numeric value of the character as a decimal digit.
- int xdigit_value () const
    Determines the numeric value of the character as a hexidecimal digit.
- bool validate () const
    Checks whether the character is a valid Unicode character.

## Detailed Description

A C++ gunichar wrapper class.

Unichar provides a convenient wrapper class for gunichar and its associated functions.

## Constructor & Destructor Documentation

Inti::G::Unichar::Unichar | ( | gunichar | c | ) |

Construct a new Unichar.

Parameters:

  c | A gunichar (a type which can hold any UCS-4 character code).

Inti::G::Unichar::Unichar | ( | const Unichar & | src | ) |

Copy constructor.

Parameters:

  src | The source Unichar.

## Member Function Documentation

GUnicodeBreakType Inti::G::Unichar::break_type | ( |  | ) | const

| Determines the break type of the unicode character. The break type is used to find word and line breaks ("text boundaries"). Pango implements the Unicode boundary resolution algorithms and normally you would use a function such as Pango::break() instead of caring about break types yourself.

int Inti::G::Unichar::digit_value | ( |  | ) | const

Determines the numeric value of the character as a decimal digit.

Returns:
  If the character is a decimal digit (according to is_digit()), its numeric value; otherwise, -1.

bool Inti::G::Unichar::is_space | ( |  | ) | const

| Returns true if the character is a space, tab, or line separator (newline, carriage return, etc.). Note: don't use this to do word breaking; you have to use Pango or equivalent to get word breaking right, the algorithm is fairly complex.

bool Inti::G::Unichar::is_title | ( |  | ) | const

| Returns true if the character is titlecase. Some characters in Unicode which are composites, such as the DZ digraph have three case variants instead of just two. The titlecase form is used at the beginning of a word where only the first letter is capitalized. The titlecase form of the DZ digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z.

Unichar Inti::G::Unichar::lower | ( |  | ) | const

Converts the character to lower case.

Returns:
  The result of converting the character to lowercase.

If the character is not an upperlower or titlecase character, or has no lower case equivalent the character is returned unchanged.

Unichar& Inti::G::Unichar::operator= | ( | const Unichar & | src | ) |

Assignment operator.

Parameters:

  src | The source Unichar.

Unichar Inti::G::Unichar::title | ( |  | ) | const

Converts the character to the titlecase.

Returns:
  The result of converting the character to titlecase.

If the character is not an uppercase or lowercase character, the character is returned unchanged.

GUnicodeType Inti::G::Unichar::type | ( |  | ) | const

Classifies a Unicode character by type.

Returns:
  the type of the character.

Unichar Inti::G::Unichar::upper | ( |  | ) | const

Converts the character to uppercase.

Returns:
  The result of converting the character to uppercase.

If the character is not a lowercase or titlecase character, or has no upper case equivalent the character is returned unchanged.

bool Inti::G::Unichar::validate | ( |  | ) | const

Checks whether the character is a valid Unicode character.

Returns:
  true if the character is a valid Unicode character.

Some possible integer values of the character will not be valid. 0 is considered a valid character, though it's normally a string terminator.

int Inti::G::Unichar::xdigit_value | ( |  | ) | const

Determines the numeric value of the character as a hexidecimal digit.

Returns:
  If the character is a hexidecimal digit (according to is_xdigit()), its numeric value; otherwise, -1.

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

- unicode.h

Main Page - Footer