Static Public Member Functions
BUnicodeChar Class Reference

Management of all information about characters. More...

List of all members.

Static Public Member Functions

static int32 DigitValue (uint32 c)
 Gets the numeric value c.
static uint32 FromUTF8 (const char **in)
 Transform a UTF-8 string to an UTF-32 character.
static bool IsAlNum (uint32 c)
 Determine if c is alphanumeric.
static bool IsAlpha (uint32 c)
 Determine if c is alphabetic.
static bool IsBase (uint32 c)
 Determine if c can be used with a diacritic.
static bool IsControl (uint32 c)
 Determine if c is a control character.
static bool IsDefined (uint32 c)
 Determine if c is defined.
static bool IsDigit (uint32 c)
 Determine if c is numeric.
static bool IsHexDigit (uint32 c)
 Determine if c is a hexadecimal digit.
static bool IsLower (uint32 c)
 Determine if c is lowercase.
static bool IsPrintable (uint32 c)
 Determine if c is printable.
static bool IsPunctuation (uint32 c)
 Determine if c is punctuation character.
static bool IsSpace (uint32 c)
 Determine if c is a space.
static bool IsTitle (uint32 c)
 Determine if c is title case.
static bool IsUpper (uint32 c)
 Determine if c is uppercase.
static bool IsWhitespace (uint32 c)
 Determine if c is whitespace.
static uint32 ToLower (uint32 c)
 Transforms c to lowercase.
static uint32 ToTitle (uint32 c)
 Transforms c to title case.
static uint32 ToUpper (uint32 c)
 Transforms c to uppercase.
static void ToUTF8 (uint32 c, char **out)
 Transform a character to UTF-8 encoding.
static int8 Type (uint32 c)
 Gets the type of a character.
static size_t UTF8StringLength (const char *str)
 Counts the characters in the given NUL terminated string.
static size_t UTF8StringLength (const char *str, size_t maxLength)
 Counts the characters in the given string up to maxLength characters.

Detailed Description

Management of all information about characters.

This class provide a set of tools for managing the whole set of characters defined by unicode. This include information about special sets of characters such as if the character is whitespace, or alphanumeric. It also provides the uppercase equivalent of a character and determines whether a character can be ornamented with accents.

This class consists entirely of static methods, so you do not have to instantiate it. You can call one of the methods passing in the character that you want to be examined.

Note all the function work with chars encoded in UTF-32. This is not the most usual way to handle characters, but it is the fastest. To convert an UTF-8 string to an UTF-32 character use the FromUTF8() method.


Member Function Documentation

int32 BUnicodeChar::DigitValue ( uint32  c) [static]

Gets the numeric value c.

Returns:
The numeric version of the specified unicode character.
uint32 BUnicodeChar::FromUTF8 ( const char **  in) [static]

Transform a UTF-8 string to an UTF-32 character.

If the string contains multiple characters, only the fist one is used. This function updates the in pointer so that it points on the next character for the following call.

Returns:
The UTF-32 encoded version of in.
static bool BUnicodeChar::IsAlNum ( uint32  c) [static]

Determine if c is alphanumeric.

Returns:
true if the specified unicode character is a alphabetic or numeric character.
static bool BUnicodeChar::IsAlpha ( uint32  c) [static]

Determine if c is alphabetic.

Returns:
true if the specified unicode character is an alphabetic character.
static bool BUnicodeChar::IsBase ( uint32  c) [static]

Determine if c can be used with a diacritic.

Note:
IsBase() does not determine if a unicode character is distinct.
Returns:
true if the specified unicode character is a base form character that can be used with a diacritic.
static bool BUnicodeChar::IsControl ( uint32  c) [static]

Determine if c is a control character.

Example control characters are the non-printable ASCII characters from 0x0 to 0x1F.

Returns:
true if the specified unicode character is a control character.
See also:
IsPrintable()
static bool BUnicodeChar::IsDefined ( uint32  c) [static]

Determine if c is defined.

In unicode some codes are not valid or not attributed yet. For these codes this method will return false.

Returns:
true if the specified unicode character is defined.
static bool BUnicodeChar::IsDigit ( uint32  c) [static]

Determine if c is numeric.

Returns:
true if the specified unicode character is a number character.
static bool BUnicodeChar::IsHexDigit ( uint32  c) [static]

Determine if c is a hexadecimal digit.

Returns:
true if the specified unicode character is a hexadecimal number character.
static bool BUnicodeChar::IsLower ( uint32  c) [static]

Determine if c is lowercase.

Returns:
true if the specified unicode character is a lowercase character.
static bool BUnicodeChar::IsPrintable ( uint32  c) [static]

Determine if c is printable.

Printable characters are not control characters.

Returns:
true if the specified unicode character is a printable character.
See also:
IsControl()
static bool BUnicodeChar::IsPunctuation ( uint32  c) [static]

Determine if c is punctuation character.

Returns:
true if the specified unicode character is a punctuation character.
static bool BUnicodeChar::IsSpace ( uint32  c) [static]

Determine if c is a space.

Unlike IsWhitespace() this function will return true for non-breakable spaces. This method is useful for determining if the character will render as an empty space which can be stretched on-screen.

Returns:
true if the specified unicode character is some kind of a space character.
See also:
IsWhitespace()
static bool BUnicodeChar::IsTitle ( uint32  c) [static]

Determine if c is title case.

Title case characters are a smaller version of normal uppercase letters.

Returns:
true if the specified unicode character is a title case character.
static bool BUnicodeChar::IsUpper ( uint32  c) [static]

Determine if c is uppercase.

Returns:
true if the specified unicode character is an uppercase character.
static bool BUnicodeChar::IsWhitespace ( uint32  c) [static]

Determine if c is whitespace.

This method is essentially the same as IsSpace(), but excludes all non-breakable spaces.

Returns:
true if the specified unicode character is a whitespace character.
See also:
IsSpace()
uint32 BUnicodeChar::ToLower ( uint32  c) [static]

Transforms c to lowercase.

Returns:
The lowercase version of the specified unicode character.
uint32 BUnicodeChar::ToTitle ( uint32  c) [static]

Transforms c to title case.

Returns:
The title case version of the specified unicode character.
uint32 BUnicodeChar::ToUpper ( uint32  c) [static]

Transforms c to uppercase.

Returns:
The uppercase version of the specified unicode character.
void BUnicodeChar::ToUTF8 ( uint32  c,
char **  out 
) [static]

Transform a character to UTF-8 encoding.

Returns:
The UTF-8 encoding of the specified unicode character.
static int8 BUnicodeChar::Type ( uint32  c) [static]

Gets the type of a character.

Returns:
A member of the unicode_char_category enum.
size_t BUnicodeChar::UTF8StringLength ( const char *  str) [static]

Counts the characters in the given NUL terminated string.

Returns:
the number of UTF-8 characters in the NUL terminated string.
See also:
BString::CountChars()
size_t BUnicodeChar::UTF8StringLength ( const char *  str,
size_t  maxLength 
) [static]

Counts the characters in the given string up to maxLength characters.

The string does not need to be NUL terminated if you specify a maxLength that is shorter than the maximum length of the string.

Returns:
the number of UTF-8 characters in the NUL terminated string up to maxLength characters.

The Haiku Book pre-R1 - BUnicodeChar Class Reference
Generated on Fri May 24 2013 by Doxygen 1.7.5.1