utf8rewind  1.2.0
Cross-platform library for UTF-8 encoded text
codepoint.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2015 Quinten Lansu
3 
4  Permission is hereby granted, free of charge, to any person
5  obtaining a copy of this software and associated documentation
6  files (the "Software"), to deal in the Software without
7  restriction, including without limitation the rights to use,
8  copy, modify, merge, publish, distribute, sublicense, and/or
9  sell copies of the Software, and to permit persons to whom the
10  Software is furnished to do so, subject to the following
11  conditions:
12 
13  The above copyright notice and this permission notice shall be
14  included in all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23  OTHER DEALINGS IN THE SOFTWARE.
24 */
25 
26 #ifndef _UTF8REWIND_INTERNAL_CODEPOINT_H_
27 #define _UTF8REWIND_INTERNAL_CODEPOINT_H_
28 
36 #include "utf8rewind.h"
37 
47 #define MAX_BASIC_LATIN 0x007F
48 
53 #define MAX_LATIN_1 0x00FF
54 
59 #define MAX_BASIC_MULTILINGUAL_PLANE 0xFFFF
60 
65 #define MAX_LEGAL_UNICODE 0x10FFFF
66 
71 #define REPLACEMENT_CHARACTER 0xFFFD
72 
77 #define SURROGATE_HIGH_START 0xD800
78 
83 #define SURROGATE_HIGH_END 0xDBFF
84 
89 #define SURROGATE_LOW_START 0xDC00
90 
95 #define SURROGATE_LOW_END 0xDFFF
96 
101 #define HANGUL_JAMO_FIRST 0x1100
102 
107 #define HANGUL_JAMO_LAST 0x11FF
108 
114 #define HANGUL_L_FIRST 0x1100
115 
121 #define HANGUL_L_LAST 0x1112
122 
127 #define HANGUL_L_COUNT 19
128 
134 #define HANGUL_V_FIRST 0x1161
135 
141 #define HANGUL_V_LAST 0x1175
142 
147 #define HANGUL_V_COUNT 21
148 
154 #define HANGUL_T_FIRST 0x11A7
155 
161 #define HANGUL_T_LAST 0x11C2
162 
167 #define HANGUL_T_COUNT 28
168 
173 #define HANGUL_N_COUNT 588 /* VCount * TCount */
174 
179 #define HANGUL_S_FIRST 0xAC00
180 
185 #define HANGUL_S_LAST 0xD7A3
186 
191 #define HANGUL_S_COUNT 11172 /* LCount * NCount */
192 
200 extern const uint8_t codepoint_decoded_length[256];
201 
209 uint8_t codepoint_encoded_length(unicode_t codepoint);
210 
222 uint8_t codepoint_write(unicode_t encoded, char** target, size_t* targetSize);
223 
233 uint8_t codepoint_read(const char* input, size_t inputSize, unicode_t* decoded);
234 
241 #endif /* _UTF8REWIND_INTERNAL_CODEPOINT_H_ */
uint32_t unicode_t
Unicode codepoint.
Definition: utf8rewind.h:178
Public interface for UTF-8 functions.