libUnihan 0.5.3
|
00001 00010 /* 00011 * Copyright © 2008 Red Hat, Inc. All rights reserved. 00012 * Copyright © 2008 Ding-Yi Chen <dchen at redhat dot com> 00013 * 00014 * This file is part of the libUnihan Project. 00015 * 00016 * This library is free software; you can redistribute it and/or 00017 * modify it under the terms of the GNU Lesser General Public 00018 * License as published by the Free Software Foundation; either 00019 * version 2 of the License, or (at your option) any later version. 00020 * 00021 * This library is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU Lesser General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU Lesser General Public 00027 * License along with this program; if not, write to the 00028 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 00029 * Boston, MA 02111-1307 USA 00030 */ 00031 00032 #ifndef STR_FUNCTIONS_H_ 00033 #define STR_FUNCTIONS_H_ 00034 #include <string.h> 00035 #include <glib.h> 00036 00047 typedef struct { 00048 GStringChunk *chunk; 00049 GPtrArray *ptrArray; 00050 GArray *constArray; 00051 guint len; 00052 } StringList; 00053 00059 StringList *stringList_new(); 00060 00072 StringList *stringList_sized_new(size_t chunk_size, size_t element_count, size_t const_count); 00073 00079 void stringList_clear(StringList *sList); 00080 00090 int stringList_find_string(StringList *sList,const char* str); 00091 00105 char **stringList_to_charPointerPointer(StringList *sList); 00106 00114 const char *stringList_index(StringList *sList,guint index); 00115 00132 guint stringList_insert(StringList *sList, const char *str); 00133 00150 guint stringList_insert_const(StringList *sList, const char *str); 00151 00161 void stringList_free(StringList *sList); 00162 00170 char* 00171 initString(char *str); 00172 00173 00180 gboolean 00181 isEmptyString(const char *str); 00182 00191 void string_trim(char *str); 00192 00193 00206 char* 00207 subString(char *buf,const char *str,int beginIndex, int length); 00208 00215 char* ucs4_to_utf8(gunichar ucs4_code); 00216 00223 gunichar* utf8_to_ucs4(const char* utf8_str); 00224 00232 char* utf8_concat_ucs4(char* utf8_str,gunichar ucs4_code); 00233 00246 int strcmp_unsigned_signed(const unsigned char *str1, const char *str2); 00247 00258 unsigned char *signedStr_to_unsignedStr(const char *str); 00259 00270 unsigned char *signedStr_to_unsignedStr_buffer(unsigned char *resultBuf, const char *str); 00271 00282 char *unsignedStr_to_signedStr(const unsigned char *str); 00283 00294 char *unsignedStr_to_signedStr_buffer(char* resultBuf, const unsigned char *str); 00295 00296 00297 #endif /*STR_FUNCTIONS_H_*/