UFO: Alien Invasion
Loading...
Searching...
No Matches
utf8.h
Go to the documentation of this file.
1
4
5/*
6All original material Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8Copyright (C) 1997-2001 Id Software, Inc.
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
19See the GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with this program; if not, write to the Free Software
23Foundation, 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
37int UTF8_delete_char_at(char* s, int pos);
38int UTF8_insert_char_at(char* s, int n, int pos, int codepoint);
39int UTF8_char_len(unsigned char c);
40int UTF8_next(const char** str);
41int UTF8_encoded_len(int codepoint);
42size_t UTF8_strlen(const char* str);
43int UTF8_char_offset_to_byte_offset (char* str, int pos);
44char* UTF8_strncpyz(char* dest, const char* src, size_t limit);
QGL_EXTERN GLenum GLuint * dest
Definition r_gl.h:101
int UTF8_char_len(unsigned char c)
length of UTF-8 character starting with this byte.
Definition utf8.cpp:109
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_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_next(const char **str)
Get the next utf-8 character from the given string.
Definition utf8.cpp:132
int UTF8_encoded_len(int codepoint)
Definition utf8.cpp:188
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