BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB Reference

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

 


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