1 /* 2 * Copyright (C) 2008 Red Hat, Inc. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 * 18 * Author(s): 19 * Behdad Esfahbod 20 */ 21 22 #ifndef novte_vteunistr_h_included 23 #define novte_vteunistr_h_included 24 25 #include <glib.h> 26 27 G_BEGIN_DECLS 28 29 /** 30 * vteunistr: 31 * 32 * vteunistr is a gunichar-compatible way to store strings. A string 33 * consisting of a single unichar c is represented as the same value 34 * as c itself. In that sense, gunichars can be readily used as 35 * vteunistrs. Longer strings can be built by appending a unichar 36 * to an already existing string. 37 * 38 * vteunistr is essentially just a gunicode-compatible quark value. 39 * It can be used to store strings (of a base followed by combining 40 * characters) where the code was designed to only allow one character. 41 * 42 * Strings are internalized efficiently and never freed. No memory 43 * management of vteunistr values is needed. 44 **/ 45 typedef guint32 vteunistr; 46 47 /** 48 * _vte_unistr_append_unichar: 49 * @s: a #vteunistr 50 * @c: Unicode character to append to @s 51 * 52 * Creates a vteunistr value for the string @s followed by the 53 * character @c. 54 * 55 * Returns: the new #vteunistr value 56 **/ 57 vteunistr _vte_unistr_append_unichar (vteunistr s, gunichar c); 58 59 gunichar _vte_unistr_get_base (vteunistr s); 60 61 /** 62 * _vte_unistr_append_to_string: 63 * @s: a #vteunistr 64 * @gs: a #GString to append @s to 65 * 66 * Appends @s to @gs. This is how one converts a #vteunistr to a 67 * traditional string. 68 **/ 69 void _vte_unistr_append_to_string (vteunistr s, GString *gs); 70 71 /** 72 * _vte_unistr_strlen: 73 * @s: a #vteunistr 74 * 75 * Counts the number of character in @s. 76 * 77 * Returns: length of @s in characters. 78 **/ 79 int _vte_unistr_strlen (vteunistr s); 80 81 G_END_DECLS 82 83 #endif 84