fastdo  0.6.8
json.hpp
浏览该文件的文档.
1 #ifndef __JSON_HPP__
2 #define __JSON_HPP__
3 //
4 // json 提供JSON相关的功能
5 //
6 
7 namespace winux
8 {
9 
11 WINUX_FUNC_DECL(bool) JsonSetByteOrderForUtf16( bool isLittleEndian );
12 
18 
20 WINUX_FUNC_DECL(bool) JsonParse( String const & json, Mixed * val );
21 
23 WINUX_FUNC_DECL(Mixed) Json( String const & json );
24 
25 WINUX_FUNC_DECL(AnsiString) MixedToJsonA( Mixed const & v, bool autoKeyQuotes );
26 WINUX_FUNC_DECL(UnicodeString) MixedToJsonW( Mixed const & v, bool autoKeyQuotes );
28 #if defined(_UNICODE) || defined(UNICODE)
29 inline UnicodeString MixedToJson( Mixed const & v, bool autoKeyQuotes ) { return MixedToJsonW( v, autoKeyQuotes ); }
30 #else
31 inline AnsiString MixedToJson( Mixed const & v, bool autoKeyQuotes ) { return MixedToJsonA( v, autoKeyQuotes ); }
32 #endif
33 
34 WINUX_FUNC_DECL(AnsiString) MixedToJsonExA( Mixed const & v, bool autoKeyQuotes, AnsiString const & spacer = "", AnsiString const & newline = "" );
35 WINUX_FUNC_DECL(UnicodeString) MixedToJsonExW( Mixed const & v, bool autoKeyQuotes, UnicodeString const & spacer = L"", UnicodeString const & newline = L"" );
40 #if defined(_UNICODE) || defined(UNICODE)
41 inline UnicodeString MixedToJsonEx( Mixed const & v, bool autoKeyQuotes, UnicodeString const & spacer = L"", UnicodeString const & newline = L"" ) { return MixedToJsonExW( v, autoKeyQuotes, spacer, newline ); }
42 #else
43 inline AnsiString MixedToJsonEx( Mixed const & v, bool autoKeyQuotes, AnsiString const & spacer = "", AnsiString const & newline = "" ) { return MixedToJsonExA( v, autoKeyQuotes, spacer, newline ); }
44 #endif
45 
46 }
47 
48 #endif
bool JsonParse(String const &json, Mixed *val)
Json解析成Mixed.
XString< char > AnsiString
Definition: utilities.hpp:212
XString< wchar > UnicodeString
Definition: utilities.hpp:213
XString< tchar > String
Definition: utilities.hpp:216
UnicodeString MixedToJsonW(Mixed const &v, bool autoKeyQuotes)
AnsiString MixedToJsonExA(Mixed const &v, bool autoKeyQuotes, AnsiString const &spacer="", AnsiString const &newline="")
bool JsonSetByteOrderForUtf16(bool isLittleEndian)
设置字节序。此字节序是解析时,存储编码数字的字节序。默认小端序。
AnsiString MixedToJsonEx(Mixed const &v, bool autoKeyQuotes, AnsiString const &spacer="", AnsiString const &newline="")
Mixed输出成Json,支持结构化。
Definition: json.hpp:43
#define WINUX_FUNC_DECL(ret)
Definition: utilities.hpp:64
UnicodeString MixedToJsonExW(Mixed const &v, bool autoKeyQuotes, UnicodeString const &spacer=L"", UnicodeString const &newline=L"")
Mixed Json(String const &json)
Json解析成Mixed.
混合体,能表示多种类型的值
Definition: utilities.hpp:750
AnsiString MixedToJsonA(Mixed const &v, bool autoKeyQuotes)
String JsonSetConvertToCharsetForUtf16(String const &charset)
设置转换到的字符集编码。此表示解析时,转换成什么编码。默认为空串,即本地编码。
AnsiString MixedToJson(Mixed const &v, bool autoKeyQuotes)
Mixed输出成Json.
Definition: json.hpp:31
跨平台基础功能库
Definition: archives.hpp:7