BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJLIB Reference

unicode.h
Go to the documentation of this file.
1 /* $Id: unicode.h 4537 2013-06-19 06:47:43Z riza $ */
2 /*
3  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 #ifndef __PJ_UNICODE_H__
21 #define __PJ_UNICODE_H__
22 
23 #include <pj/types.h>
24 
25 
33 
34 
50 PJ_DECL(wchar_t*) pj_ansi_to_unicode(const char *str, int len,
51  wchar_t *wbuf, int wbuf_count);
52 
53 
64 PJ_DECL(char*) pj_unicode_to_ansi(const wchar_t *wstr, pj_ssize_t len,
65  char *buf, int buf_size);
66 
67 
68 #if defined(PJ_NATIVE_STRING_IS_UNICODE) && PJ_NATIVE_STRING_IS_UNICODE!=0
69 
76 # define PJ_DECL_UNICODE_TEMP_BUF(buf,size) wchar_t buf[size];
77 
82 # define PJ_STRING_TO_NATIVE(s,buf,max) pj_ansi_to_unicode( \
83  s, strlen(s), \
84  buf, max)
85 
92 # define PJ_DECL_ANSI_TEMP_BUF(buf,size) char buf[size];
93 
94 
99 # define PJ_NATIVE_TO_STRING(cs,buf,max) pj_unicode_to_ansi( \
100  cs, wcslen(cs), \
101  buf, max)
102 
103 #else
104 
111 # define PJ_DECL_UNICODE_TEMP_BUF(var,size)
112 
116 # define PJ_STRING_TO_NATIVE(s,buf,max) ((char*)s)
117 
123 # define PJ_DECL_ANSI_TEMP_BUF(buf,size)
124 
128 # define PJ_NATIVE_TO_STRING(cs,buf,max) ((char*)(const char*)cs)
129 
130 #endif
131 
132 
133 
135 
136 /*
137  * @}
138  */
139 
140 
141 #endif /* __PJ_UNICODE_H__ */
wchar_t * pj_ansi_to_unicode(const char *str, int len, wchar_t *wbuf, int wbuf_count)
Declaration of basic types and utility.
#define PJ_END_DECL
Definition: config.h:1067
#define PJ_BEGIN_DECL
Definition: config.h:1066
long pj_ssize_t
Definition: types.h:64
char * pj_unicode_to_ansi(const wchar_t *wstr, pj_ssize_t len, char *buf, int buf_size)

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.