ucs2char.h

Go to the documentation of this file.
00001 /*
00002  *      UCS-2 character set library.
00003  *
00004  *      Copyright (c) 2005-2007 Naoaki Okazaki
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  * 
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00019  *
00020  */
00021 
00022 /* $Id: ucs2char.h 328 2007-02-10 17:50:11Z nyaochi $ */
00023 
00024 #ifndef __UCS2CHAR_H__
00025 #define __UCS2CHAR_H__
00026 
00027 #include <stdio.h>
00028 
00029 #ifdef  UCS2_EXPORTS
00030 #define UCS2API __declspec(dllexport)
00031 #else
00032 #define UCS2API
00033 #endif
00034 
00035 #ifdef  __cplusplus
00036 extern "C" {
00037 #endif/*__cplusplus*/
00038 
00065 typedef uint16_t ucs2char_t;
00066 
00085 UCS2API int ucs2init();
00086 
00087 
00113 UCS2API int ucs2setenc(const char *encoding);
00114 
00126 UCS2API const char *ucs2getenc();
00127 
00139 UCS2API void ucs2setcp(int cp);
00140 
00149 UCS2API int ucs2getcp();
00150 
00169 UCS2API size_t ucs2tombs(char *mbstr, size_t mbs_size, const ucs2char_t *ucs2str, size_t ucs_size);
00170 
00192 UCS2API size_t mbstoucs2(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size);
00193 
00219 UCS2API size_t mbstoucs2_charset(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size, const char *charset);
00220 
00239 UCS2API size_t ucs2toutf8(char *mbstr, size_t mbs_size, const ucs2char_t *ucs2str, size_t ucs_size);
00240 
00260 UCS2API size_t utf8toucs2(ucs2char_t *ucs2str, size_t ucs_size, const char *mbstr, size_t mbs_size);
00261 
00269 UCS2API char *ucs2dupmbs(const ucs2char_t *ucs2str);
00270 
00278 UCS2API ucs2char_t* mbsdupucs2(const char *mbstr);
00279 
00290 UCS2API ucs2char_t* mbsdupucs2_charset(const char *mbstr, const char *charset);
00291 
00299 UCS2API char *ucs2duputf8(const ucs2char_t *ucs2str);
00300 
00308 UCS2API ucs2char_t* utf8dupucs2(const char *utf8str);
00309 
00330 UCS2API void *ucs2malloc(size_t size);
00331 
00338 UCS2API void *ucs2calloc(size_t size);
00339 
00347 UCS2API void *ucs2realloc(void *ptr, size_t size);
00348 
00354 UCS2API void ucs2free(void* ptr);
00355 
00373 UCS2API int ucs2issurrogate(ucs2char_t c);
00374 
00380 UCS2API int ucs2isspace(ucs2char_t c);
00381 
00387 UCS2API int ucs2isdigit(ucs2char_t c);
00388 
00394 UCS2API ucs2char_t ucs2lower(ucs2char_t c);
00395 
00401 UCS2API ucs2char_t ucs2upper(ucs2char_t c);
00402 
00428 UCS2API ucs2char_t* ucs2cat(ucs2char_t* dst, const ucs2char_t* src);
00429 
00438 UCS2API ucs2char_t* ucs2chr(const ucs2char_t* str, ucs2char_t c);
00439 
00449 UCS2API int ucs2cmp(const ucs2char_t* x, const ucs2char_t* y);
00450 
00458 UCS2API ucs2char_t* ucs2cpy(ucs2char_t* dst, const ucs2char_t* src);
00459 
00470 UCS2API size_t ucs2cspn(const ucs2char_t *str, const ucs2char_t *charset);
00471 
00478 UCS2API size_t ucs2len(const ucs2char_t* str);
00479 
00488 UCS2API ucs2char_t* ucs2ncat(ucs2char_t *dst, const ucs2char_t *src, size_t n);
00489 
00500 UCS2API int ucs2ncmp(const ucs2char_t* x, const ucs2char_t* y, size_t n);
00501 
00510 UCS2API ucs2char_t* ucs2ncpy(ucs2char_t* dst, const ucs2char_t* src, size_t n);
00511 
00521 UCS2API ucs2char_t* ucs2pbrk(const ucs2char_t *str, const ucs2char_t *charset);
00522 
00531 UCS2API ucs2char_t* ucs2rchr(const ucs2char_t* str, ucs2char_t c);
00532 
00542 UCS2API size_t ucs2spn(const ucs2char_t *str, const ucs2char_t *charset);
00543 
00553 UCS2API ucs2char_t* ucs2str(const ucs2char_t* str, const ucs2char_t* substr);
00554 
00577 UCS2API ucs2char_t* ucs2dup(const ucs2char_t* str);
00578 
00587 UCS2API ucs2char_t* ucs2ndup(const ucs2char_t* str, size_t length);
00588 
00600 UCS2API ucs2char_t* ucs2lwr(ucs2char_t* str);
00601 
00613 UCS2API ucs2char_t* ucs2upr(ucs2char_t* str);
00614 
00624 UCS2API int ucs2icmp(const ucs2char_t* x, const ucs2char_t* y);
00625 
00636 UCS2API int ucs2incmp(const ucs2char_t* x, const ucs2char_t* y, size_t n);
00637 
00649 UCS2API ucs2char_t* ucs2strip(ucs2char_t* str);
00650 
00670 UCS2API int ucs2toi(const ucs2char_t* str);
00671 
00680 UCS2API ucs2char_t* itoucs2(int value, ucs2char_t *string, int radix);
00681 
00689 UCS2API FILE *ucs2fopen(const ucs2char_t *filename, const char *mode);
00690 
00697 UCS2API int fputucs2c(ucs2char_t c, FILE *fp);
00698 
00699 
00700 
00705 #ifdef  __cplusplus
00706 }
00707 #endif/*__cplusplus*/
00708 
00709 #endif/*__UCS2CHAR_H__*/