1 /* 2 LibRCC - this header defines internal string representation: UTF-8 encoding 3 string + information on language. 4 5 Copyright (C) 2005-2008 Suren A. Chilingaryan <csa@dside.dyndns.org> 6 7 This library is free software; you can redistribute it and/or modify it 8 under the terms of the GNU Lesser General Public License version 2.1 or later 9 as published by the Free Software Foundation. 10 11 This library is distributed in the hope that it will be useful, but WITHOUT 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 14 for more details. 15 16 You should have received a copy of the GNU Lesser General Public License 17 along with this program; if not, write to the Free Software Foundation, Inc., 18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 */ 20 21 #ifndef _RCC_STRING_H 22 #define _RCC_STRING_H 23 24 #define RCC_STRING_MAGIC 0xFF7F01FF 25 26 struct rcc_string_header_t { 27 unsigned int magic; 28 rcc_language_id language_id; 29 char language[2]; 30 }; 31 typedef struct rcc_string_header_t rcc_string_header; 32 33 34 rcc_string rccCreateString(rcc_language_id language_id, const char *buf, size_t len); 35 void rccStringFree(rcc_string str); 36 37 int rccStringSetLang(rcc_string string, const char *sn); 38 int rccStringFixID(rcc_string string, rcc_context ctx); 39 int rccStringChangeID(rcc_string string, rcc_language_id language_id); 40 41 #ifndef HAVE_STRNLEN 42 int rccStrnlen(const char *str, size_t size); 43 #endif /* !HAVE_STRNLEN */ 44 int rccIsASCII(const char *str); 45 size_t rccStringSizedGetChars(const char *str, size_t size); 46 47 #endif /* _RCC_STRING_H */ 48