UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
utf8.h
Go to the documentation of this file.
1 
5 /*
6 All original material Copyright (C) 2002-2020 UFO: Alien Invasion.
7 
8 Copyright (C) 1997-2001 Id Software, Inc.
9 
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License
12 as published by the Free Software Foundation; either version 2
13 of the License, or (at your option) any later version.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 See the GNU General Public License for more details.
20 
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 */
25 
26 #pragma once
27 
28 #include <stddef.h>
29 
31 /* The definition of UTF-8 guarantees that the second and later
32  * bytes of a multibyte character have high bits 10, and that
33  * singlebyte characters and the start of multibyte characters
34  * never do. */
35 #define UTF8_CONTINUATION_BYTE(c) (((c) & 0xc0) == 0x80)
36 
37 int UTF8_delete_char_at(char* s, int pos);
38 int UTF8_insert_char_at(char* s, int n, int pos, int codepoint);
39 int UTF8_char_len(unsigned char c);
40 int UTF8_next(const char** str);
41 int UTF8_encoded_len(int codepoint);
42 size_t UTF8_strlen(const char* str);
43 int UTF8_char_offset_to_byte_offset (char* str, int pos);
44 char* UTF8_strncpyz(char* dest, const char* src, size_t limit);
int UTF8_delete_char_at(char *s, int pos)
Delete a whole (possibly multibyte) character from a string.
Definition: utf8.cpp:35
size_t UTF8_strlen(const char *str)
Count the number of character (not the number of bytes) of a zero termination string.
Definition: utf8.cpp:207
int UTF8_next(const char **str)
Get the next utf-8 character from the given string.
Definition: utf8.cpp:132
char * UTF8_strncpyz(char *dest, const char *src, size_t limit)
UTF8 capable string copy function.
Definition: utf8.cpp:247
int UTF8_char_offset_to_byte_offset(char *str, int pos)
Convert UTF-8 character offset to a byte offset in the given string.
Definition: utf8.cpp:227
int UTF8_encoded_len(int codepoint)
Definition: utf8.cpp:188
QGL_EXTERN GLenum GLuint * dest
Definition: r_gl.h:101
int UTF8_insert_char_at(char *s, int n, int pos, int codepoint)
Insert a (possibly multibyte) UTF-8 character into a string.
Definition: utf8.cpp:63
int UTF8_char_len(unsigned char c)
length of UTF-8 character starting with this byte.
Definition: utf8.cpp:109