libguac  1.6.0
unicode.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef _GUAC_UNICODE_H
21 #define _GUAC_UNICODE_H
22 
29 #include <stddef.h>
30 
38 size_t guac_utf8_charsize(unsigned char c);
39 
47 size_t guac_utf8_strlen(const char* str);
48 
60 int guac_utf8_write(int codepoint, char* utf8, int length);
61 
75 int guac_utf8_read(const char* utf8, int length, int* codepoint);
76 
77 #endif
78 
int guac_utf8_write(int codepoint, char *utf8, int length)
Given destination buffer and its length, writes the given codepoint as UTF-8 to the buffer...
size_t guac_utf8_strlen(const char *str)
Given a UTF-8-encoded string, returns the length of the string in characters (not bytes)...
int guac_utf8_read(const char *utf8, int length, int *codepoint)
Given a buffer containing UTF-8 characters, reads the first codepoint in the buffer, returning the length of the codepoint in bytes.
size_t guac_utf8_charsize(unsigned char c)
Given the initial byte of a single UTF-8 character, returns the overall byte size of the entire chara...