libguac  0.9.10-incubating
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 
21 #ifndef _GUAC_UNICODE_H
22 #define _GUAC_UNICODE_H
23 
30 #include <stddef.h>
31 
39 size_t guac_utf8_charsize(unsigned char c);
40 
48 size_t guac_utf8_strlen(const char* str);
49 
61 int guac_utf8_write(int codepoint, char* utf8, int length);
62 
76 int guac_utf8_read(const char* utf8, int length, int* codepoint);
77 
78 #endif
79 
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...