diff options
Diffstat (limited to 'libraries/eina/src/include/eina_unicode.h')
-rw-r--r-- | libraries/eina/src/include/eina_unicode.h | 186 |
1 files changed, 0 insertions, 186 deletions
diff --git a/libraries/eina/src/include/eina_unicode.h b/libraries/eina/src/include/eina_unicode.h deleted file mode 100644 index 2bbfe45..0000000 --- a/libraries/eina/src/include/eina_unicode.h +++ /dev/null | |||
@@ -1,186 +0,0 @@ | |||
1 | #ifndef EINA_UNICODE_H | ||
2 | #define EINA_UNICODE_H | ||
3 | |||
4 | #include <stdlib.h> | ||
5 | |||
6 | #include "eina_config.h" | ||
7 | #include "eina_types.h" | ||
8 | |||
9 | /** | ||
10 | * @addtogroup Eina_Data_Types_Group Data Types | ||
11 | * | ||
12 | * @{ | ||
13 | */ | ||
14 | /** | ||
15 | * @addtogroup Eina_Unicode_String Unicode String | ||
16 | * | ||
17 | * @brief These functions provide basic unicode string handling | ||
18 | * | ||
19 | * Eina_Unicode is a type that holds unicode codepoints. | ||
20 | * | ||
21 | * @{ | ||
22 | */ | ||
23 | |||
24 | /** | ||
25 | * @typedef Eina_Unicode | ||
26 | * A type that holds Unicode codepoints. | ||
27 | */ | ||
28 | #if EINA_SIZEOF_WCHAR_T >= 4 | ||
29 | # include <wchar.h> | ||
30 | typedef wchar_t Eina_Unicode; | ||
31 | #elif defined(EINA_HAVE_INTTYPES_H) | ||
32 | # include <inttypes.h> | ||
33 | typedef uint32_t Eina_Unicode; | ||
34 | #elif defined(EINA_HAVE_STDINT_H) | ||
35 | # include <stdint.h> | ||
36 | typedef uint32_t Eina_Unicode; | ||
37 | #else | ||
38 | /* Hope that int is big enough */ | ||
39 | typedef unsigned int Eina_Unicode; | ||
40 | #endif | ||
41 | |||
42 | |||
43 | /** | ||
44 | * @brief Same as the standard strlen just with Eina_Unicode instead of char. | ||
45 | */ | ||
46 | EAPI extern const Eina_Unicode *EINA_UNICODE_EMPTY_STRING; | ||
47 | |||
48 | EAPI size_t eina_unicode_strlen(const Eina_Unicode *ustr) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT EINA_PURE; | ||
49 | |||
50 | /** | ||
51 | * @brief Returns the length of a Eina_Unicode string, up to a limit. | ||
52 | * | ||
53 | * This function returns the number of characters in string, up to a maximum | ||
54 | * of n. If the terminating character is not found in the string, it returns | ||
55 | * n. | ||
56 | * | ||
57 | * @param ustr String to search | ||
58 | * @param n Max length to search | ||
59 | * @return Number of characters or n. | ||
60 | */ | ||
61 | EAPI size_t eina_unicode_strnlen(const Eina_Unicode *ustr, int n) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT EINA_PURE; | ||
62 | |||
63 | |||
64 | /** | ||
65 | * @brief Same as the standard strdup just with Eina_Unicode instead of char. | ||
66 | */ | ||
67 | EAPI Eina_Unicode *eina_unicode_strdup(const Eina_Unicode *text) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; | ||
68 | |||
69 | |||
70 | /** | ||
71 | * @brief Same as strdup but cuts on the given size. Assumes n < len | ||
72 | * | ||
73 | * @param text The text to duplicate. | ||
74 | * @param n The maximum size of the text to duplicate. | ||
75 | * @return The duplicated string. | ||
76 | * | ||
77 | * This function duplicates @p text. The resuting string is cut on @p | ||
78 | * n. @p n is assumed to be lesser (<) than the length of @p | ||
79 | * text. When not needed anymore, the returned string must be freed. | ||
80 | * | ||
81 | * @since 1.1.0 | ||
82 | */ | ||
83 | EAPI Eina_Unicode *eina_unicode_strndup(const Eina_Unicode *text, size_t n) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; | ||
84 | |||
85 | |||
86 | /** | ||
87 | * @brief Same as the standard strcmp just with Eina_Unicode instead of char. | ||
88 | */ | ||
89 | EAPI int eina_unicode_strcmp(const Eina_Unicode *a, const Eina_Unicode *b) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE; | ||
90 | |||
91 | |||
92 | /** | ||
93 | * @brief Same as the standard strcpy just with Eina_Unicode instead of char. | ||
94 | */ | ||
95 | EAPI Eina_Unicode *eina_unicode_strcpy(Eina_Unicode *dest, const Eina_Unicode *source) EINA_ARG_NONNULL(1, 2); | ||
96 | |||
97 | |||
98 | /** | ||
99 | * @brief Same as the standard strstr just with Eina_Unicode instead of char. | ||
100 | */ | ||
101 | EAPI Eina_Unicode *eina_unicode_strstr(const Eina_Unicode *haystack, const Eina_Unicode *needle) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE; | ||
102 | |||
103 | |||
104 | /** | ||
105 | * @brief Same as the standard strncpy just with Eina_Unicode instead of char. | ||
106 | */ | ||
107 | EAPI Eina_Unicode *eina_unicode_strncpy(Eina_Unicode *dest, const Eina_Unicode *source, size_t n) EINA_ARG_NONNULL(1, 2); | ||
108 | |||
109 | |||
110 | /** | ||
111 | * @see eina_str_escape() | ||
112 | */ | ||
113 | EAPI Eina_Unicode *eina_unicode_escape(const Eina_Unicode *str) EINA_ARG_NONNULL(1) EINA_MALLOC EINA_WARN_UNUSED_RESULT; | ||
114 | |||
115 | /* UTF-8 Handling */ | ||
116 | |||
117 | |||
118 | /** | ||
119 | * Reads UTF8 bytes from @p buf, starting at @p iindex and returns | ||
120 | * the decoded code point at @p iindex offset, and advances @p iindex | ||
121 | * to the next code point after this. @p iindex is always advanced, | ||
122 | * unless if the advancement is after the NULL. | ||
123 | * On error: return a codepoint between DC80 to DCFF where the low 8 bits | ||
124 | * are the byte's value. | ||
125 | * | ||
126 | * @param buf the string | ||
127 | * @param iindex the index to look at and return by. | ||
128 | * @return the codepoint found. | ||
129 | * @since 1.1.0 | ||
130 | */ | ||
131 | EAPI Eina_Unicode eina_unicode_utf8_get_next(const char *buf, int *iindex) EINA_ARG_NONNULL(1, 2); | ||
132 | |||
133 | /** | ||
134 | * Reads UTF8 bytes from @p buf, starting at @p iindex and returns | ||
135 | * the decoded code point at @p iindex offset, and moves àp iindex | ||
136 | * to the previous code point. @p iindex is always moved, as long | ||
137 | * as it's not past the start of the string. | ||
138 | * On error: return a codepoint between DC80 to DCFF where the low 8 bits | ||
139 | * are the byte's value. | ||
140 | * | ||
141 | * @param buf the string | ||
142 | * @param iindex the index to look at and return by. | ||
143 | * @return the codepoint found. | ||
144 | * @since 1.1.0 | ||
145 | */ | ||
146 | EAPI Eina_Unicode eina_unicode_utf8_get_prev(const char *buf, int *iindex) EINA_ARG_NONNULL(1, 2); | ||
147 | |||
148 | /** | ||
149 | * Returns the number of unicode characters in the string. That is, | ||
150 | * the number of Eina_Unicodes it'll take to store this string in | ||
151 | * an Eina_Unicode string. | ||
152 | * | ||
153 | * @param buf the string | ||
154 | * @return the number of unicode characters (not bytes) in the string | ||
155 | * @since 1.1.0 | ||
156 | */ | ||
157 | EAPI int eina_unicode_utf8_get_len(const char *buf) EINA_ARG_NONNULL(1); | ||
158 | |||
159 | /** | ||
160 | * Converts a utf-8 string to a newly allocated Eina_Unicode string. | ||
161 | * | ||
162 | * @param utf the string in utf-8 | ||
163 | * @param _len the length of the returned Eina_Unicode string. | ||
164 | * @return the newly allocated Eina_Unicode string. | ||
165 | * @since 1.1.0 | ||
166 | */ | ||
167 | EAPI Eina_Unicode *eina_unicode_utf8_to_unicode(const char *utf, int *_len) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; | ||
168 | |||
169 | /** | ||
170 | * Converts an Eina_Unicode string to a newly allocated utf-8 string. | ||
171 | * | ||
172 | * @param uni the Eina_Unicode string | ||
173 | * @param _len the length byte length of the return utf8 string. | ||
174 | * @return the newly allocated utf-8 string. | ||
175 | * @since 1.1.0 | ||
176 | */ | ||
177 | EAPI char * eina_unicode_unicode_to_utf8(const Eina_Unicode *uni, int *_len) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; | ||
178 | |||
179 | /** | ||
180 | * @} | ||
181 | */ | ||
182 | /** | ||
183 | * @} | ||
184 | */ | ||
185 | |||
186 | #endif | ||