fastdo  0.6.16
json.hpp
浏览该文件的文档.
1 #ifndef __JSON_HPP__
2 #define __JSON_HPP__
3 //
4 // json 提供JSON相关的功能
5 //
6 
7 namespace winux
8 {
9 
14 WINUX_FUNC_DECL(bool) JsonSetByteOrderForUtf16( bool isLittleEndian );
15 
22 
24 WINUX_FUNC_DECL(bool) ParseJson( String const & json, Mixed * val );
25 
27 WINUX_FUNC_DECL(Mixed) Json( String const & json );
28 
29 WINUX_FUNC_DECL(AnsiString) MixedToJsonA( Mixed const & v, bool autoKeyQuotes );
30 WINUX_FUNC_DECL(UnicodeString) MixedToJsonW( Mixed const & v, bool autoKeyQuotes );
32 #if defined(_UNICODE) || defined(UNICODE)
33 inline UnicodeString MixedToJson( Mixed const & v, bool autoKeyQuotes ) { return MixedToJsonW( v, autoKeyQuotes ); }
34 #else
35 inline AnsiString MixedToJson( Mixed const & v, bool autoKeyQuotes ) { return MixedToJsonA( v, autoKeyQuotes ); }
36 #endif
37 
38 WINUX_FUNC_DECL(AnsiString) MixedToJsonExA( Mixed const & v, bool autoKeyQuotes, AnsiString const & spacer = "", AnsiString const & newline = "" );
39 WINUX_FUNC_DECL(UnicodeString) MixedToJsonExW( Mixed const & v, bool autoKeyQuotes, UnicodeString const & spacer = L"", UnicodeString const & newline = L"" );
44 #if defined(_UNICODE) || defined(UNICODE)
45 inline UnicodeString MixedToJsonEx( Mixed const & v, bool autoKeyQuotes, UnicodeString const & spacer = L"", UnicodeString const & newline = L"" ) { return MixedToJsonExW( v, autoKeyQuotes, spacer, newline ); }
46 #else
47 inline AnsiString MixedToJsonEx( Mixed const & v, bool autoKeyQuotes, AnsiString const & spacer = "", AnsiString const & newline = "" ) { return MixedToJsonExA( v, autoKeyQuotes, spacer, newline ); }
48 #endif
49 
50 
51 } // namespace winux
52 
53 #endif
XString< char > AnsiString
Definition: utilities.hpp:257
XString< wchar > UnicodeString
Definition: utilities.hpp:258
XString< tchar > String
Definition: utilities.hpp:261
UnicodeString MixedToJsonW(Mixed const &v, bool autoKeyQuotes)
AnsiString MixedToJsonExA(Mixed const &v, bool autoKeyQuotes, AnsiString const &spacer="", AnsiString const &newline="")
bool JsonSetByteOrderForUtf16(bool isLittleEndian)
设置字节序。此字节序是解析时,存储编码数字的字节序。
bool ParseJson(String const &json, Mixed *val)
JSON串解析成Mixed.
AnsiString MixedToJsonEx(Mixed const &v, bool autoKeyQuotes, AnsiString const &spacer="", AnsiString const &newline="")
Mixed输出成Json,支持结构化。
Definition: json.hpp:47
#define L(s)
Definition: strings.hpp:1139
#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:1440
AnsiString MixedToJsonA(Mixed const &v, bool autoKeyQuotes)
String JsonSetConvertToCharsetForUtf16(String const &charset)
设置转换到的字符集编码。此表示解析时,转换成什么编码。默认为空串,即本地编码。
AnsiString MixedToJson(Mixed const &v, bool autoKeyQuotes)
Mixed输出成Json.
Definition: json.hpp:35
跨平台基础功能库
Definition: archives.hpp:7