libUnihan  0.5.3
str_functions.h
Go to the documentation of this file.
1 
10 /*
11  * Copyright © 2008 Red Hat, Inc. All rights reserved.
12  * Copyright © 2008 Ding-Yi Chen <dchen at redhat dot com>
13  *
14  * This file is part of the libUnihan Project.
15  *
16  * This library is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU Lesser General Public
18  * License as published by the Free Software Foundation; either
19  * version 2 of the License, or (at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public
27  * License along with this program; if not, write to the
28  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
29  * Boston, MA 02111-1307 USA
30  */
31 
32 #ifndef STR_FUNCTIONS_H_
33 #define STR_FUNCTIONS_H_
34 #include <string.h>
35 #include <glib.h>
36 
47 typedef struct {
48  GStringChunk *chunk;
49  GPtrArray *ptrArray;
50  GArray *constArray;
51  guint len;
52 } StringList;
53 
60 
72 StringList *stringList_sized_new(size_t chunk_size, size_t element_count, size_t const_count);
73 
79 void stringList_clear(StringList *sList);
80 
90 int stringList_find_string(StringList *sList,const char* str);
91 
106 
114 const char *stringList_index(StringList *sList,guint index);
115 
132 guint stringList_insert(StringList *sList, const char *str);
133 
150 guint stringList_insert_const(StringList *sList, const char *str);
151 
161 void stringList_free(StringList *sList);
162 
170 char*
171 initString(char *str);
172 
173 
180 gboolean
181 isEmptyString(const char *str);
182 
191 void string_trim(char *str);
192 
193 
206 char*
207 subString(char *buf,const char *str,int beginIndex, int length);
208 
215 char* ucs4_to_utf8(gunichar ucs4_code);
216 
223 gunichar* utf8_to_ucs4(const char* utf8_str);
224 
232 char* utf8_concat_ucs4(char* utf8_str,gunichar ucs4_code);
233 
246 int strcmp_unsigned_signed(const unsigned char *str1, const char *str2);
247 
258 unsigned char *signedStr_to_unsignedStr(const char *str);
259 
270 unsigned char *signedStr_to_unsignedStr_buffer(unsigned char *resultBuf, const char *str);
271 
282 char *unsignedStr_to_signedStr(const unsigned char *str);
283 
294 char *unsignedStr_to_signedStr_buffer(char* resultBuf, const unsigned char *str);
295 
296 
297 #endif /*STR_FUNCTIONS_H_*/