xref: /haiku/docs/user/locale/UnicodeChar.dox (revision 675ffabd70492a962f8c0288a32208c22ce5de18)
1/*!
2\class BUnicodeChar
3\ingroup locale
4
5\brief Management of all information about characters.
6
7This class provide a set of tools for managing the whole set of characters
8defined in unicode. This include informations such as knowing if the character is
9whitespace, if it is alphanumeric, or solething else ; what is the uppercase
10equivalent of a character ; or wether it can be ornamented with accents.
11
12This class consists entirely of static methods, which means you don't have to
13instanciate it. Just call one of the methods with the char you want examinated.
14
15Note all the function work with chars encoded in utf-32. This is not the most usual
16way to handle characters, but it is the faster. To convert an utf-8 string to an
17utf-32 character, pass it to the FromUTF8 function.
18
19*/
20
21/*!
22\fn static bool BUnicodeChar::IsAlpha(uint32 c)
23\brief Tell if the character is alphabetic.
24*/
25
26/*!
27\fn static bool BUnicodeChar::IsAlNum(uint32 c)
28\brief Tell if the character is alphanumeric.
29*/
30
31/*!
32\fn static bool BUnicodeChar::IsDigit(uint32 c)
33\brief Tell if the caracter is numeric.
34*/
35
36/*!
37\fn static bool BUnicodeChar::IsHexDigit(uint32 c)
38\brief Tell if the character is numeric in base 16.
39*/
40
41/*!
42\fn static bool BUnicodeChar::IsUpper(uint32 c)
43\brief Tell if the character is uppercase.
44*/
45
46/*!
47\fn static bool BUnicodeChar::IsLower(uint32 c)
48\brief Tell if the character is lowercase.
49*/
50
51/*!
52\fn static bool BUnicodeChar::IsSpace(uint32 c)
53\brief Tell if the character is space.
54
55Unlike IsWhitespace, this function will return true for non-breakable
56spaces. It is the one to use for determining if the character will render
57as an empty space on screen and can be stretched to make the text look
58nicer.
59*/
60
61/*!
62\fn static bool BUnicodeChar::IsWhitespace(uint32 c)
63\brief Tell if the character is whitespace.
64
65Unlike IsSpace, this method will return false for non-breakable spaces.
66It is the one to use for selecting where to insert line breaks.
67*/
68
69/*!
70\fn static bool BUnicodeChar::IsControl(uint32 c)
71\brief Tell if the character is a control character.
72
73Example control characters are the non-printable ASCII characters 0 to 0x1F.
74*/
75
76/*!
77\fn static bool BUnicodeChar::IsPunctuation(uint32 c)
78\brief Tell if the character is a punctuation.
79*/
80
81/*!
82\fn static bool BUnicodeChar::IsPrintable(uint32 c)
83\brief Tell if the character is printable.
84*/
85
86/*!
87\fn static bool BUnicodeChar::IsTitle(uint32 c)
88\brief Tell if the character is title case.
89
90Title case is usually a smaller version of upercase letters.
91*/
92
93/*!
94\fn static bool BUnicodeChar::IsDefined(uint32 c)
95\brief Tell if the character is defined at all.
96
97In unicode, some codes are not valid, or not attributed yet.
98For these, this method wil lreturn false.
99*/
100
101/*!
102\fn static bool BUnicodeChar::IsBase(uint32 c)
103\brief Tell if the character can be used with a diacritic.
104*/
105
106/*!
107\fn static int8 BUnicodeChar::Type(uint32 c)
108\brief Returns the type of the character.
109
110Return value is a member of the unicode_char_category enum.
111*/
112
113/*!
114\fn static uint32 ToLower(uint32 c);
115\brief Returns the lowercase version of a character.
116*/
117
118/*!
119\fn static uint32 ToUpper(uint32 c);
120\brief Returns the uppercase version of a character.
121*/
122
123/*!
124\fn static uint32 ToTitle(uint32 c);
125\brief Returns the titlecase version of a character.
126*/
127
128/*!
129\fn static int32 DigitValue(uint32 c);
130\brief Returns the numeric value of the character.
131*/
132
133/*!
134\fn static void ToUTF8(uint32c, char ù**ou
135\brief Convert a character to utf8 encoding.
136*/
137
138/*!
139\fn static uint32 FromUTF8(const char** in)
140\brief Convert an utf-8 string to an utf-32 character.
141
142If the string contains multiple characters, only the fist one is used.
143This function updates the in pointer so that it points on the next
144character for the following call.
145*/
146
147/*!
148\fn static uint32 FromUTF8(const char* in)
149\brief Convert an utf�-8 string to an utf�-32 character.
150
151If the string contains multiple characters, only the first one is used.
152The in pointer is not modified.
153*/
154
155/*!
156\fn static size_t UTF8StringLength(const char* str)
157\brief This function counts the characters in the given null-terminated string.
158
159\sa BString::CountChars()
160*/
161
162/*!
163\fn static size_t UTF8StringLength(const char* str, size_t maxLength)
164\brief This function counts the characters in the given string.
165
166The string does not need to be null-terminated if you specify the length.
167*/
168