libcommonc++  0.7
Char Class Reference

A class representing a UTF-16 character. More...

#include <Char.h++>

Collaboration diagram for Char:

Public Member Functions

 Char ()
 Construct a new, NUL character. More...
 
 Char (char c)
 Construct a new character with the given ASCII value. More...
 
 Char (char16_t c)
 Construct a new character with the given UTF-16 value. More...
 
 Char (int c)
 Construct a new character with the given unicode value. More...
 
 ~Char ()
 Destructor. More...
 
Charoperator= (char c)
 Assignment operator. More...
 
Charoperator= (char16_t c)
 Assignment operator. More...
 
Charoperator= (int c)
 Assignment operator. More...
 
bool isNul () const
 Tests if the character is NUL. More...
 
bool isControl () const
 Tests if the character is a control character. More...
 
bool isPrintable () const
 Tests if the character is printable. More...
 
bool isGraphical () const
 Tests if the character is graphical. More...
 
bool isPunctuation () const
 Tests if the character is punctuation. More...
 
bool isLetter () const
 Tests if the character is a letter. More...
 
bool isDigit () const
 Tests if the character is a digit. More...
 
bool isHexDigit () const
 Tests if the character is a hexadecimal digit. More...
 
bool isAlphabetic () const
 Tests if the character is alphabetic. More...
 
bool isAlphaNumeric () const
 Tests if the character is alphanumeric. More...
 
bool isSign () const
 Tests if the character is a sign symbol (+ or -). More...
 
bool isWhitespace () const
 Tests if the character is whitespace. More...
 
bool isLowerCase () const
 Tests if the character is a lowercase letter. More...
 
bool isUpperCase () const
 Tests if the character is an uppercase letter. More...
 
Char toLowerCase () const
 Returns the lowercase form of the character. More...
 
Char toUpperCase () const
 Returns the uppercase form of the character. More...
 
bool isASCII () const
 Tests if the character is ASCII. More...
 
bool isLowASCII () const
 Tests if the character is low ASCII. More...
 
bool isHighASCII () const
 Tests if the character is high ASCII. More...
 
bool isLowSurrogate () const
 Tests if the character is a low surrogate. More...
 
bool isHighSurrogate () const
 Tests if the character is a high surrogate. More...
 
char16_t toChar16 () const
 Returns the char16_t for this character. More...
 
char toASCII () const
 Returns the ASCII character equivalent for this character, or 0 if this character is not ASCII. More...
 
bool operator== (const Char &other) const
 Equality operator. More...
 
bool operator== (char16_t other) const
 Equality operator. More...
 
bool operator!= (const Char &other) const
 Inequality operator. More...
 
bool operator< (const Char &other) const
 
bool operator> (const Char &other) const
 
bool operator<= (const Char &other) const
 
bool operator>= (const Char &other) const
 
bool operator! () const
 Equivalent to isNul(). More...
 
Charoperator++ ()
 Increment operator (prefix). More...
 
Char operator++ (int)
 Increment operator (postfix). More...
 
Charoperator-- ()
 Decrement operator (prefix). More...
 
Char operator-- (int)
 Decrement operator (postfix). More...
 

Static Public Member Functions

static bool isNul (char16_t c)
 Tests if a character is NUL. More...
 
static bool isControl (char16_t c)
 Tests if a character is a control character. More...
 
static bool isPrintable (char16_t c)
 Tests if a character is a printable character. More...
 
static bool isGraphical (char16_t c)
 Tests if a character is a graphical character. More...
 
static bool isPunctuation (char16_t c)
 Tests if a character is a punctuation character. More...
 
static bool isLetter (char16_t c)
 Tests if the character is a letter. More...
 
static bool isDigit (char16_t c)
 Tests if a character is a digit. More...
 
static bool isHexDigit (char16_t c)
 Tests if a character is a hexadeciaml digit. More...
 
static bool isAlphabetic (char16_t c)
 Tests if a character is alphabetic. More...
 
static bool isAlphaNumeric (char16_t c)
 Tests if a character is alphanumeric. More...
 
static bool isSign (char16_t c)
 Tests if a character is a sign symbol (+ or -). More...
 
static bool isWhitespace (char16_t c)
 Tests if a character is whitespace. More...
 
static bool isLowerCase (char16_t c)
 Tests if a character is a lowercase letter. More...
 
static bool isUpperCase (char16_t c)
 Tests if a character is an uppercase letter. More...
 
static char16_t toLowerCase (char16_t c)
 Returns the lowercase form of a character. More...
 
static char16_t toUpperCase (char16_t c)
 Returns the uppercase form of a character. More...
 
static bool isASCII (char16_t c)
 Tests if a character is high ASCII. More...
 
static bool isLowASCII (char16_t c)
 Tests if a character is low ASCII. More...
 
static bool isHighASCII (char16_t c)
 Tests if a character is high ASCII. More...
 
static bool isLowSurrogate (char16_t c)
 Tests if a character is a low surrogate. More...
 
static bool isHighSurrogate (char16_t c)
 Tests if a character is a high surrogate. More...
 
static char toASCII (char16_t c)
 Returns the character in ASCII, or NUL if the character is not in the range of ASCII characters. More...
 

Static Public Attributes

static const Char nul
 The NUL character. More...
 
static const Char BELL = Char('\a')
 The bell character. More...
 
static const Char BACKSPACE = Char('\b')
 The backspace character. More...
 
static const Char TAB = Char('\t')
 The tab character. More...
 
static const Char NEWLINE = Char(0x0A)
 The newline character. More...
 
static const Char VERTICAL_TAB = Char('\v')
 The vertical tab character. More...
 
static const Char FORM_FEED = Char('\f')
 The form feed character. More...
 
static const Char RETURN = Char('\r')
 The carriage return character. More...
 
static const Char ESCAPE = Char(27)
 The escape character. More...
 
static const Char SPACE = Char(' ')
 The space character. More...
 
static const Char DELETE = Char(127)
 The delete character. More...
 

Detailed Description

A class representing a UTF-16 character.

Constructor & Destructor Documentation

◆ Char() [1/4]

Char ( )

Construct a new, NUL character.

◆ Char() [2/4]

Char ( char  c)
explicit

Construct a new character with the given ASCII value.

◆ Char() [3/4]

Char ( char16_t  c)
explicit

Construct a new character with the given UTF-16 value.

◆ Char() [4/4]

Char ( int  c)

Construct a new character with the given unicode value.

Values above 0xFFFF are truncated.

◆ ~Char()

~Char ( )

Destructor.

Member Function Documentation

◆ isAlphabetic() [1/2]

bool isAlphabetic ( ) const

Tests if the character is alphabetic.

◆ isAlphabetic() [2/2]

bool isAlphabetic ( char16_t  c)
static

Tests if a character is alphabetic.

◆ isAlphaNumeric() [1/2]

bool isAlphaNumeric ( ) const

Tests if the character is alphanumeric.

◆ isAlphaNumeric() [2/2]

bool isAlphaNumeric ( char16_t  c)
static

Tests if a character is alphanumeric.

◆ isASCII() [1/2]

bool isASCII ( ) const

Tests if the character is ASCII.

◆ isASCII() [2/2]

bool isASCII ( char16_t  c)
static

Tests if a character is high ASCII.

◆ isControl() [1/2]

bool isControl ( ) const

Tests if the character is a control character.

◆ isControl() [2/2]

bool isControl ( char16_t  c)
static

Tests if a character is a control character.

◆ isDigit() [1/2]

bool isDigit ( ) const

Tests if the character is a digit.

◆ isDigit() [2/2]

bool isDigit ( char16_t  c)
static

Tests if a character is a digit.

◆ isGraphical() [1/2]

bool isGraphical ( ) const

Tests if the character is graphical.

◆ isGraphical() [2/2]

bool isGraphical ( char16_t  c)
static

Tests if a character is a graphical character.

◆ isHexDigit() [1/2]

bool isHexDigit ( ) const

Tests if the character is a hexadecimal digit.

◆ isHexDigit() [2/2]

bool isHexDigit ( char16_t  c)
static

Tests if a character is a hexadeciaml digit.

◆ isHighASCII() [1/2]

bool isHighASCII ( ) const

Tests if the character is high ASCII.

◆ isHighASCII() [2/2]

bool isHighASCII ( char16_t  c)
static

Tests if a character is high ASCII.

◆ isHighSurrogate() [1/2]

bool isHighSurrogate ( ) const

Tests if the character is a high surrogate.

◆ isHighSurrogate() [2/2]

bool isHighSurrogate ( char16_t  c)
static

Tests if a character is a high surrogate.

◆ isLetter() [1/2]

bool isLetter ( ) const

Tests if the character is a letter.

◆ isLetter() [2/2]

bool isLetter ( char16_t  c)
static

Tests if the character is a letter.

◆ isLowASCII() [1/2]

bool isLowASCII ( ) const

Tests if the character is low ASCII.

◆ isLowASCII() [2/2]

bool isLowASCII ( char16_t  c)
static

Tests if a character is low ASCII.

◆ isLowerCase() [1/2]

bool isLowerCase ( ) const

Tests if the character is a lowercase letter.

◆ isLowerCase() [2/2]

bool isLowerCase ( char16_t  c)
static

Tests if a character is a lowercase letter.

◆ isLowSurrogate() [1/2]

bool isLowSurrogate ( ) const

Tests if the character is a low surrogate.

◆ isLowSurrogate() [2/2]

bool isLowSurrogate ( char16_t  c)
static

Tests if a character is a low surrogate.

◆ isNul() [1/2]

bool isNul ( ) const

Tests if the character is NUL.

◆ isNul() [2/2]

bool isNul ( char16_t  c)
static

Tests if a character is NUL.

◆ isPrintable() [1/2]

bool isPrintable ( ) const

Tests if the character is printable.

◆ isPrintable() [2/2]

bool isPrintable ( char16_t  c)
static

Tests if a character is a printable character.

◆ isPunctuation() [1/2]

bool isPunctuation ( ) const

Tests if the character is punctuation.

◆ isPunctuation() [2/2]

bool isPunctuation ( char16_t  c)
static

Tests if a character is a punctuation character.

◆ isSign() [1/2]

bool isSign ( ) const

Tests if the character is a sign symbol (+ or -).

◆ isSign() [2/2]

bool isSign ( char16_t  c)
static

Tests if a character is a sign symbol (+ or -).

◆ isUpperCase() [1/2]

bool isUpperCase ( ) const

Tests if the character is an uppercase letter.

◆ isUpperCase() [2/2]

bool isUpperCase ( char16_t  c)
static

Tests if a character is an uppercase letter.

◆ isWhitespace() [1/2]

bool isWhitespace ( ) const

Tests if the character is whitespace.

◆ isWhitespace() [2/2]

bool isWhitespace ( char16_t  c)
static

Tests if a character is whitespace.

◆ operator!()

bool operator! ( ) const
inline

Equivalent to isNul().

◆ operator!=()

bool operator!= ( const Char other) const
inline

Inequality operator.

◆ operator++() [1/2]

Char& operator++ ( )
inline

Increment operator (prefix).

◆ operator++() [2/2]

Char operator++ ( int  )
inline

Increment operator (postfix).

◆ operator--() [1/2]

Char& operator-- ( )
inline

Decrement operator (prefix).

◆ operator--() [2/2]

Char operator-- ( int  )
inline

Decrement operator (postfix).

◆ operator<()

bool operator< ( const Char other) const
inline

◆ operator<=()

bool operator<= ( const Char other) const
inline

◆ operator=() [1/3]

Char & operator= ( char  c)

Assignment operator.

◆ operator=() [2/3]

Char & operator= ( char16_t  c)

Assignment operator.

◆ operator=() [3/3]

Char & operator= ( int  c)

Assignment operator.

◆ operator==() [1/2]

bool operator== ( const Char other) const
inline

Equality operator.

◆ operator==() [2/2]

bool operator== ( char16_t  other) const
inline

Equality operator.

◆ operator>()

bool operator> ( const Char other) const
inline

◆ operator>=()

bool operator>= ( const Char other) const
inline

◆ toASCII() [1/2]

char toASCII ( ) const

Returns the ASCII character equivalent for this character, or 0 if this character is not ASCII.

◆ toASCII() [2/2]

char toASCII ( char16_t  c)
static

Returns the character in ASCII, or NUL if the character is not in the range of ASCII characters.

◆ toChar16()

char16_t toChar16 ( ) const
inline

Returns the char16_t for this character.

◆ toLowerCase() [1/2]

Char toLowerCase ( ) const

Returns the lowercase form of the character.

◆ toLowerCase() [2/2]

char16_t toLowerCase ( char16_t  c)
static

Returns the lowercase form of a character.

◆ toUpperCase() [1/2]

Char toUpperCase ( ) const

Returns the uppercase form of the character.

◆ toUpperCase() [2/2]

char16_t toUpperCase ( char16_t  c)
static

Returns the uppercase form of a character.

Member Data Documentation

◆ BACKSPACE

const Char BACKSPACE = Char('\b')
static

The backspace character.

◆ BELL

const Char BELL = Char('\a')
static

The bell character.

◆ DELETE

const Char DELETE = Char(127)
static

The delete character.

◆ ESCAPE

const Char ESCAPE = Char(27)
static

The escape character.

◆ FORM_FEED

const Char FORM_FEED = Char('\f')
static

The form feed character.

◆ NEWLINE

const Char NEWLINE = Char(0x0A)
static

The newline character.

◆ nul

const Char nul
static

The NUL character.

◆ RETURN

const Char RETURN = Char('\r')
static

The carriage return character.

◆ SPACE

const Char SPACE = Char(' ')
static

The space character.

◆ TAB

const Char TAB = Char('\t')
static

The tab character.

◆ VERTICAL_TAB

const Char VERTICAL_TAB = Char('\v')
static

The vertical tab character.


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