mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 02:47:56 +08:00
commit
a1510793bc
117
.gitignore
vendored
117
.gitignore
vendored
@ -17,3 +17,120 @@
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.lib
|
||||
*.a
|
||||
acl_cpp_vc2015.VC.VC.opendb
|
||||
acl_cpp_vc2015.VC.db
|
||||
app/gson/debug/
|
||||
app/gson/gson
|
||||
app/gson/gson.vcxproj.user
|
||||
app/master_dispatch/manager/Debug/
|
||||
app/redis_tools/redis_builder/Debug/
|
||||
app/wizard/Debug/
|
||||
app/wizard_demo/httpd_download/Debug/
|
||||
app/wizard_demo/httpd_upload/Debug/
|
||||
ipch/
|
||||
lib_acl/Debug/
|
||||
lib_acl/StdAfx.h.gch
|
||||
lib_acl/debug/
|
||||
lib_acl/master/acl_master
|
||||
lib_acl/samples/dgate/Debug/
|
||||
lib_acl/samples/mmap_string/Debug/
|
||||
lib_acl/samples/winaio/Debug/
|
||||
lib_acl/samples/zdb/Debug/
|
||||
lib_acl_cpp/Debug/
|
||||
lib_acl_cpp/lib_acl_cpp_vc2015.vcxproj.user
|
||||
lib_acl_cpp/samples/aio/aio_client/Debug/
|
||||
lib_acl_cpp/samples/aio/aio_client_ssl/Debug/
|
||||
lib_acl_cpp/samples/aio/aio_connect/Debug/
|
||||
lib_acl_cpp/samples/aio/aio_dns/Debug/
|
||||
lib_acl_cpp/samples/aio/aio_ipc/Debug/
|
||||
lib_acl_cpp/samples/aio/aio_server/Debug/
|
||||
lib_acl_cpp/samples/aio/aio_server_ssl/Debug/
|
||||
lib_acl_cpp/samples/aio/pkg_client/Debug/
|
||||
lib_acl_cpp/samples/aio/pkg_server/Debug/
|
||||
lib_acl_cpp/samples/cgi/Debug/
|
||||
lib_acl_cpp/samples/cgi_upload/Debug/
|
||||
lib_acl_cpp/samples/connect_manager/Debug/
|
||||
lib_acl_cpp/samples/db/mysql_manager/Debug/
|
||||
lib_acl_cpp/samples/db/mysql_pool/Debug/
|
||||
lib_acl_cpp/samples/db/mysql_query/Debug/
|
||||
lib_acl_cpp/samples/db/query/Debug/
|
||||
lib_acl_cpp/samples/dbuf/dbuf1/Debug/
|
||||
lib_acl_cpp/samples/dbuf/dbuf2/Debug/
|
||||
lib_acl_cpp/samples/dbuf/dbuf3/Debug/
|
||||
lib_acl_cpp/samples/dbuf/dbuf4/Debug/
|
||||
lib_acl_cpp/samples/dircmp/Debug/
|
||||
lib_acl_cpp/samples/dircopy/Debug/
|
||||
lib_acl_cpp/samples/disque/disque_client/Debug/
|
||||
lib_acl_cpp/samples/disque/disque_cluster/Debug/
|
||||
lib_acl_cpp/samples/disque/disque_manager/Debug/
|
||||
lib_acl_cpp/samples/disque/disque_pool/Debug/
|
||||
lib_acl_cpp/samples/final_class/Debug/
|
||||
lib_acl_cpp/samples/flock/Debug/
|
||||
lib_acl_cpp/samples/fstream/Debug/
|
||||
lib_acl_cpp/samples/http_client/Debug/
|
||||
lib_acl_cpp/samples/http_request_manager/Debug/
|
||||
lib_acl_cpp/samples/http_request_pool/Debug/
|
||||
lib_acl_cpp/samples/http_servlet2/Debug/
|
||||
lib_acl_cpp/samples/json/json0/Debug/
|
||||
lib_acl_cpp/samples/json/json1/Debug/
|
||||
lib_acl_cpp/samples/json/json10/Debug/
|
||||
lib_acl_cpp/samples/json/json11/Debug/
|
||||
lib_acl_cpp/samples/json/json12/Debug/
|
||||
lib_acl_cpp/samples/json/json2/Debug/
|
||||
lib_acl_cpp/samples/json/json3/Debug/
|
||||
lib_acl_cpp/samples/json/json4/Debug/
|
||||
lib_acl_cpp/samples/json/json5/Debug/
|
||||
lib_acl_cpp/samples/json/json6/Debug/
|
||||
lib_acl_cpp/samples/json/json7/Debug/
|
||||
lib_acl_cpp/samples/json/json8/Debug/
|
||||
lib_acl_cpp/samples/json/json9/Debug/
|
||||
lib_acl_cpp/samples/master/master_aio/Debug/
|
||||
lib_acl_cpp/samples/master/master_threads/Debug/
|
||||
lib_acl_cpp/samples/master/master_udp/Debug/
|
||||
lib_acl_cpp/samples/master_aio_proxy/Debug/
|
||||
lib_acl_cpp/samples/md5/Debug/
|
||||
lib_acl_cpp/samples/memcache_pool/Debug/
|
||||
lib_acl_cpp/samples/mime/mail_build/Debug/
|
||||
lib_acl_cpp/samples/mime/mime/Debug/
|
||||
lib_acl_cpp/samples/mime/mime_base64/Debug/
|
||||
lib_acl_cpp/samples/mime/mime_qp/Debug/
|
||||
lib_acl_cpp/samples/redis/redis/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_client_cluster/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_client_cluster2/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_cluster/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_connection/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_geo/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_hash/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_hyperloglog/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_key/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_list/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_manager/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_pool/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_pubsub/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_set/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_string/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_trans/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_zset/Debug/
|
||||
lib_acl_cpp/samples/redis/redis_zset_pool/Debug/
|
||||
lib_acl_cpp/samples/rfc2047/Debug/
|
||||
lib_acl_cpp/samples/scan_dir/Debug/
|
||||
lib_acl_cpp/samples/singleton/Debug/
|
||||
lib_acl_cpp/samples/smtp_client/Debug/
|
||||
lib_acl_cpp/samples/socket_stream/Debug/
|
||||
lib_acl_cpp/samples/ssl/https_proxy/Debug/
|
||||
lib_acl_cpp/samples/ssl/ssl_client/Debug/
|
||||
lib_acl_cpp/samples/ssl/ssl_server/Debug/
|
||||
lib_acl_cpp/samples/string/blank_line/Debug/
|
||||
lib_acl_cpp/samples/string/string1/Debug/
|
||||
lib_acl_cpp/samples/string/string2/Debug/
|
||||
lib_acl_cpp/samples/string/string3/Debug/
|
||||
lib_acl_cpp/samples/thread/Debug/
|
||||
lib_acl_cpp/samples/thread_pool/Debug/
|
||||
lib_acl_cpp/samples/xml/xml1/Debug/
|
||||
lib_acl_cpp/samples/xml/xml2/Debug/
|
||||
lib_acl_cpp/src/acl_stdafx.hpp.gch
|
||||
lib_protocol/Debug/
|
||||
lib_protocol/debug/
|
||||
lib_rpc/Debug/
|
||||
|
@ -1,6 +1,6 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_acl", "lib_acl\lib_acl_vc2015.vcxproj", "{B40213C2-507C-4C7F-A6E1-B850C9BDC27B}"
|
||||
EndProject
|
||||
@ -741,6 +741,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dbuf4", "lib_acl_cpp\sample
|
||||
{FE724EF7-3763-4E78-BDF5-BCBC075719FD} = {FE724EF7-3763-4E78-BDF5-BCBC075719FD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gson", "app\gson\gson.vcxproj", "{D15D860E-5012-471A-83D4-81A1251BF88D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo", "app\gson\demo\demo.vcxproj", "{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
@ -3570,6 +3574,66 @@ Global
|
||||
{84BEC37E-F033-4B67-B05A-3166D1D6C72E}.Template|Win32.Build.0 = DebugDll|Win32
|
||||
{84BEC37E-F033-4B67-B05A-3166D1D6C72E}.Template|x64.ActiveCfg = DebugDll|x64
|
||||
{84BEC37E-F033-4B67-B05A-3166D1D6C72E}.Template|x64.Build.0 = DebugDll|x64
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Debug|x64.Build.0 = Debug|x64
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.DebugDll|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.DebugDll|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.DebugDll|Win32.ActiveCfg = Debug|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.DebugDll|Win32.Build.0 = Debug|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.DebugDll|x64.ActiveCfg = Debug|x64
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.DebugDll|x64.Build.0 = Debug|x64
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Release|Win32.Build.0 = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Release|x64.ActiveCfg = Release|x64
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Release|x64.Build.0 = Release|x64
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Releasedll|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Releasedll|Mixed Platforms.Build.0 = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Releasedll|Win32.ActiveCfg = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Releasedll|Win32.Build.0 = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Releasedll|x64.ActiveCfg = Release|x64
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Releasedll|x64.Build.0 = Release|x64
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Template|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Template|Mixed Platforms.Build.0 = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Template|Win32.ActiveCfg = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Template|Win32.Build.0 = Release|Win32
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Template|x64.ActiveCfg = Release|x64
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D}.Template|x64.Build.0 = Release|x64
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Debug|x64.Build.0 = Debug|x64
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.DebugDll|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.DebugDll|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.DebugDll|Win32.ActiveCfg = Debug|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.DebugDll|Win32.Build.0 = Debug|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.DebugDll|x64.ActiveCfg = Debug|x64
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.DebugDll|x64.Build.0 = Debug|x64
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Release|Win32.Build.0 = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Release|x64.ActiveCfg = Release|x64
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Release|x64.Build.0 = Release|x64
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Releasedll|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Releasedll|Mixed Platforms.Build.0 = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Releasedll|Win32.ActiveCfg = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Releasedll|Win32.Build.0 = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Releasedll|x64.ActiveCfg = Release|x64
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Releasedll|x64.Build.0 = Release|x64
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Template|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Template|Mixed Platforms.Build.0 = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Template|Win32.ActiveCfg = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Template|Win32.Build.0 = Release|Win32
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Template|x64.ActiveCfg = Release|x64
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}.Template|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -3696,5 +3760,7 @@ Global
|
||||
{4176134C-2A0A-43BD-BC25-9A40F73E03B2} = {8BA25233-2314-40FA-865B-FDE152CA1D63}
|
||||
{D2EA4AA9-CC7C-4B08-9941-920C2CCDF00A} = {8BA25233-2314-40FA-865B-FDE152CA1D63}
|
||||
{84BEC37E-F033-4B67-B05A-3166D1D6C72E} = {8BA25233-2314-40FA-865B-FDE152CA1D63}
|
||||
{D15D860E-5012-471A-83D4-81A1251BF88D} = {3CC8D45A-8E3F-4F5C-A7DF-4D8027E4EA9C}
|
||||
{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8} = {3CC8D45A-8E3F-4F5C-A7DF-4D8027E4EA9C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
131
app/gson/demo/demo.vcxproj
Normal file
131
app/gson/demo/demo.vcxproj
Normal file
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C4D52720-ED5E-45E7-81EA-CC3ABC8053F8}</ProjectGuid>
|
||||
<RootNamespace>demo</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)lib_acl_cpp\include;$(SolutionDir)lib_acl\include;./include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl_vc2015d.lib;lib_acl_cpp_vc2015d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\lib_acl_cpp;$(SolutionDir)\lib_acl;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="gson.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="struct.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="gson.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
39
app/gson/demo/demo.vcxproj.filters
Normal file
39
app/gson/demo/demo.vcxproj.filters
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="gson.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="struct.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="gson.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
4
app/gson/demo/demo.vcxproj.user
Normal file
4
app/gson/demo/demo.vcxproj.user
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
321
app/gson/demo/gson.cpp
Normal file
321
app/gson/demo/gson.cpp
Normal file
@ -0,0 +1,321 @@
|
||||
#include "stdafx.h"
|
||||
#include "struct.h"
|
||||
#include "gson.h"
|
||||
#include "acl_cpp/stdlib/gson_helper.ipp"
|
||||
namespace acl
|
||||
{
|
||||
acl::json_node& gson (acl::json & json, const base &obj)
|
||||
{
|
||||
acl::json_node &node = json.create_node();
|
||||
|
||||
if (check_nullptr(obj.string))
|
||||
node.add_null("string");
|
||||
else
|
||||
node.add_text("string", acl::get_value(obj.string));
|
||||
|
||||
if (check_nullptr(obj.string_ptr))
|
||||
node.add_null("string_ptr");
|
||||
else
|
||||
node.add_text("string_ptr", acl::get_value(obj.string_ptr));
|
||||
|
||||
if (check_nullptr(obj.a))
|
||||
node.add_null("a");
|
||||
else
|
||||
node.add_number("a", acl::get_value(obj.a));
|
||||
|
||||
if (check_nullptr(obj.a_ptr))
|
||||
node.add_null("a_ptr");
|
||||
else
|
||||
node.add_number("a_ptr", acl::get_value(obj.a_ptr));
|
||||
|
||||
if (check_nullptr(obj.b))
|
||||
node.add_null("b");
|
||||
else
|
||||
node.add_number("b", acl::get_value(obj.b));
|
||||
|
||||
if (check_nullptr(obj.b_ptr))
|
||||
node.add_null("b_ptr");
|
||||
else
|
||||
node.add_number("b_ptr", acl::get_value(obj.b_ptr));
|
||||
|
||||
if (check_nullptr(obj.c))
|
||||
node.add_null("c");
|
||||
else
|
||||
node.add_number("c", acl::get_value(obj.c));
|
||||
|
||||
if (check_nullptr(obj.c_ptr))
|
||||
node.add_null("c_ptr");
|
||||
else
|
||||
node.add_number("c_ptr", acl::get_value(obj.c_ptr));
|
||||
|
||||
if (check_nullptr(obj.d))
|
||||
node.add_null("d");
|
||||
else
|
||||
node.add_number("d", acl::get_value(obj.d));
|
||||
|
||||
if (check_nullptr(obj.d_ptr))
|
||||
node.add_null("d_ptr");
|
||||
else
|
||||
node.add_number("d_ptr", acl::get_value(obj.d_ptr));
|
||||
|
||||
if (check_nullptr(obj.e))
|
||||
node.add_null("e");
|
||||
else
|
||||
node.add_number("e", acl::get_value(obj.e));
|
||||
|
||||
if (check_nullptr(obj.e_ptr))
|
||||
node.add_null("e_ptr");
|
||||
else
|
||||
node.add_number("e_ptr", acl::get_value(obj.e_ptr));
|
||||
|
||||
if (check_nullptr(obj.f))
|
||||
node.add_null("f");
|
||||
else
|
||||
node.add_number("f", acl::get_value(obj.f));
|
||||
|
||||
if (check_nullptr(obj.f_ptr))
|
||||
node.add_null("f_ptr");
|
||||
else
|
||||
node.add_number("f_ptr", acl::get_value(obj.f_ptr));
|
||||
|
||||
if (check_nullptr(obj.g))
|
||||
node.add_null("g");
|
||||
else
|
||||
node.add_number("g", acl::get_value(obj.g));
|
||||
|
||||
if (check_nullptr(obj.g_ptr))
|
||||
node.add_null("g_ptr");
|
||||
else
|
||||
node.add_number("g_ptr", acl::get_value(obj.g_ptr));
|
||||
|
||||
if (check_nullptr(obj.acl_string))
|
||||
node.add_null("acl_string");
|
||||
else
|
||||
node.add_text("acl_string", acl::get_value(obj.acl_string));
|
||||
|
||||
if (check_nullptr(obj.acl_string_ptr))
|
||||
node.add_null("acl_string_ptr");
|
||||
else
|
||||
node.add_text("acl_string_ptr", acl::get_value(obj.acl_string_ptr));
|
||||
|
||||
if (check_nullptr(obj.h))
|
||||
node.add_null("h");
|
||||
else
|
||||
node.add_double("h", acl::get_value(obj.h));
|
||||
|
||||
if (check_nullptr(obj.h_ptr))
|
||||
node.add_null("h_ptr");
|
||||
else
|
||||
node.add_double("h_ptr", acl::get_value(obj.h_ptr));
|
||||
|
||||
if (check_nullptr(obj.i))
|
||||
node.add_null("i");
|
||||
else
|
||||
node.add_double("i", acl::get_value(obj.i));
|
||||
|
||||
if (check_nullptr(obj.i_ptr))
|
||||
node.add_null("i_ptr");
|
||||
else
|
||||
node.add_double("i_ptr", acl::get_value(obj.i_ptr));
|
||||
|
||||
|
||||
return node;
|
||||
}
|
||||
acl::json_node& gson (acl::json & json, const base*obj)
|
||||
{
|
||||
return gson (json, *obj);
|
||||
}
|
||||
|
||||
|
||||
acl::string gson(const base &obj)
|
||||
{
|
||||
acl::json json;
|
||||
acl::json_node &node = acl::gson (json, obj);
|
||||
return node.to_string ();
|
||||
}
|
||||
|
||||
|
||||
std::pair<bool,std::string> gson(acl::json_node &node, base &obj)
|
||||
{
|
||||
acl::json_node *string = node["string"];
|
||||
acl::json_node *string_ptr = node["string_ptr"];
|
||||
acl::json_node *a = node["a"];
|
||||
acl::json_node *a_ptr = node["a_ptr"];
|
||||
acl::json_node *b = node["b"];
|
||||
acl::json_node *b_ptr = node["b_ptr"];
|
||||
acl::json_node *c = node["c"];
|
||||
acl::json_node *c_ptr = node["c_ptr"];
|
||||
acl::json_node *d = node["d"];
|
||||
acl::json_node *d_ptr = node["d_ptr"];
|
||||
acl::json_node *e = node["e"];
|
||||
acl::json_node *e_ptr = node["e_ptr"];
|
||||
acl::json_node *f = node["f"];
|
||||
acl::json_node *f_ptr = node["f_ptr"];
|
||||
acl::json_node *g = node["g"];
|
||||
acl::json_node *g_ptr = node["g_ptr"];
|
||||
acl::json_node *acl_string = node["acl_string"];
|
||||
acl::json_node *acl_string_ptr = node["acl_string_ptr"];
|
||||
acl::json_node *h = node["h"];
|
||||
acl::json_node *h_ptr = node["h_ptr"];
|
||||
acl::json_node *i = node["i"];
|
||||
acl::json_node *i_ptr = node["i_ptr"];
|
||||
std::pair<bool, std::string> result;
|
||||
|
||||
if(string)
|
||||
gson(*string,&obj.string);
|
||||
|
||||
|
||||
if(!string_ptr ||!(result = gson(*string_ptr,&obj.string_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.string_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!a ||!(result = gson(*a,&obj.a), result.first))
|
||||
return std::make_pair(false,"required [base.a] failed:{"+result.second+"}");
|
||||
|
||||
if(!a_ptr ||!(result = gson(*a_ptr,&obj.a_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.a_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!b ||!(result = gson(*b,&obj.b), result.first))
|
||||
return std::make_pair(false,"required [base.b] failed:{"+result.second+"}");
|
||||
|
||||
if(!b_ptr ||!(result = gson(*b_ptr,&obj.b_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.b_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!c ||!(result = gson(*c,&obj.c), result.first))
|
||||
return std::make_pair(false,"required [base.c] failed:{"+result.second+"}");
|
||||
|
||||
if(!c_ptr ||!(result = gson(*c_ptr,&obj.c_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.c_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!d ||!(result = gson(*d,&obj.d), result.first))
|
||||
return std::make_pair(false,"required [base.d] failed:{"+result.second+"}");
|
||||
|
||||
if(!d_ptr ||!(result = gson(*d_ptr,&obj.d_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.d_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!e ||!(result = gson(*e,&obj.e), result.first))
|
||||
return std::make_pair(false,"required [base.e] failed:{"+result.second+"}");
|
||||
|
||||
if(!e_ptr ||!(result = gson(*e_ptr,&obj.e_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.e_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!f ||!(result = gson(*f,&obj.f), result.first))
|
||||
return std::make_pair(false,"required [base.f] failed:{"+result.second+"}");
|
||||
|
||||
if(!f_ptr ||!(result = gson(*f_ptr,&obj.f_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.f_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!g ||!(result = gson(*g,&obj.g), result.first))
|
||||
return std::make_pair(false,"required [base.g] failed:{"+result.second+"}");
|
||||
|
||||
if(!g_ptr ||!(result = gson(*g_ptr,&obj.g_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.g_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!acl_string ||!(result = gson(*acl_string,&obj.acl_string), result.first))
|
||||
return std::make_pair(false,"required [base.acl_string] failed:{"+result.second+"}");
|
||||
|
||||
if(!acl_string_ptr ||!(result = gson(*acl_string_ptr,&obj.acl_string_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.acl_string_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!h ||!(result = gson(*h,&obj.h), result.first))
|
||||
return std::make_pair(false,"required [base.h] failed:{"+result.second+"}");
|
||||
|
||||
if(!h_ptr ||!(result = gson(*h_ptr,&obj.h_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.h_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!i ||!(result = gson(*i,&obj.i), result.first))
|
||||
return std::make_pair(false,"required [base.i] failed:{"+result.second+"}");
|
||||
|
||||
if(!i_ptr ||!(result = gson(*i_ptr,&obj.i_ptr), result.first))
|
||||
return std::make_pair(false,"required [base.i_ptr] failed:{"+result.second+"}");
|
||||
|
||||
return std::make_pair(true,"");
|
||||
}
|
||||
|
||||
|
||||
std::pair<bool,std::string> gson(acl::json_node &node, base *obj)
|
||||
{
|
||||
return gson(node, *obj);
|
||||
}
|
||||
|
||||
|
||||
acl::json_node& gson (acl::json & json, const list1 &obj)
|
||||
{
|
||||
acl::json_node &node = json.create_node();
|
||||
|
||||
if (check_nullptr(obj.b))
|
||||
node.add_null("b");
|
||||
else
|
||||
node.add_child("b", acl::gson(json,obj.b));
|
||||
|
||||
if (check_nullptr(obj.b_ptr))
|
||||
node.add_null("b_ptr");
|
||||
else
|
||||
node.add_child("b_ptr", acl::gson(json,obj.b_ptr));
|
||||
|
||||
if (check_nullptr(obj.bases_list))
|
||||
node.add_null("bases_list");
|
||||
else
|
||||
node.add_child("bases_list", acl::gson(json,obj.bases_list));
|
||||
|
||||
if (check_nullptr(obj.bases_list_ptr))
|
||||
node.add_null("bases_list_ptr");
|
||||
else
|
||||
node.add_child("bases_list_ptr", acl::gson(json,obj.bases_list_ptr));
|
||||
|
||||
if (check_nullptr(obj.bases_ptr_list_ptr))
|
||||
node.add_null("bases_ptr_list_ptr");
|
||||
else
|
||||
node.add_child("bases_ptr_list_ptr", acl::gson(json,obj.bases_ptr_list_ptr));
|
||||
|
||||
|
||||
return node;
|
||||
}
|
||||
acl::json_node& gson (acl::json & json, const list1*obj)
|
||||
{
|
||||
return gson (json, *obj);
|
||||
}
|
||||
|
||||
|
||||
acl::string gson(const list1 &obj)
|
||||
{
|
||||
acl::json json;
|
||||
acl::json_node &node = acl::gson (json, obj);
|
||||
return node.to_string ();
|
||||
}
|
||||
|
||||
|
||||
std::pair<bool,std::string> gson(acl::json_node &node, list1 &obj)
|
||||
{
|
||||
acl::json_node *b = node["b"];
|
||||
acl::json_node *b_ptr = node["b_ptr"];
|
||||
acl::json_node *bases_list = node["bases_list"];
|
||||
acl::json_node *bases_list_ptr = node["bases_list_ptr"];
|
||||
acl::json_node *bases_ptr_list_ptr = node["bases_ptr_list_ptr"];
|
||||
std::pair<bool, std::string> result;
|
||||
|
||||
if(!b ||!b->get_obj()||!(result = gson(*b->get_obj(), &obj.b), result.first))
|
||||
return std::make_pair(false, "required [list1.b] failed:{"+result.second+"}");
|
||||
|
||||
if(!b_ptr ||!b_ptr->get_obj()||!(result = gson(*b_ptr->get_obj(), &obj.b_ptr), result.first))
|
||||
return std::make_pair(false, "required [list1.b_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!bases_list ||!bases_list->get_obj()||!(result = gson(*bases_list->get_obj(), &obj.bases_list), result.first))
|
||||
return std::make_pair(false, "required [list1.bases_list] failed:{"+result.second+"}");
|
||||
|
||||
if(!bases_list_ptr ||!bases_list_ptr->get_obj()||!(result = gson(*bases_list_ptr->get_obj(), &obj.bases_list_ptr), result.first))
|
||||
return std::make_pair(false, "required [list1.bases_list_ptr] failed:{"+result.second+"}");
|
||||
|
||||
if(!bases_ptr_list_ptr ||!bases_ptr_list_ptr->get_obj()||!(result = gson(*bases_ptr_list_ptr->get_obj(), &obj.bases_ptr_list_ptr), result.first))
|
||||
return std::make_pair(false, "required [list1.bases_ptr_list_ptr] failed:{"+result.second+"}");
|
||||
|
||||
return std::make_pair(true,"");
|
||||
}
|
||||
|
||||
|
||||
std::pair<bool,std::string> gson(acl::json_node &node, list1 *obj)
|
||||
{
|
||||
return gson(node, *obj);
|
||||
}
|
||||
|
||||
|
||||
}///end of acl.
|
15
app/gson/demo/gson.h
Normal file
15
app/gson/demo/gson.h
Normal file
@ -0,0 +1,15 @@
|
||||
namespace acl
|
||||
{
|
||||
//base
|
||||
acl::string gson(const base &obj);
|
||||
acl::json_node& gson (acl::json & json, const base &obj);
|
||||
acl::json_node& gson (acl::json & json, const base *obj);
|
||||
std::pair<bool,std::string> gson(acl::json_node &node, base &obj);
|
||||
std::pair<bool,std::string> gson(acl::json_node &node, base *obj);
|
||||
//list1
|
||||
acl::string gson(const list1 &obj);
|
||||
acl::json_node& gson (acl::json & json, const list1 &obj);
|
||||
acl::json_node& gson (acl::json & json, const list1 *obj);
|
||||
std::pair<bool,std::string> gson(acl::json_node &node, list1 &obj);
|
||||
std::pair<bool,std::string> gson(acl::json_node &node, list1 *obj);
|
||||
}///end of acl.
|
@ -15,7 +15,7 @@ void test_base()
|
||||
b.acl_string = "a";
|
||||
b.acl_string_ptr = new acl::string("a");
|
||||
b.string = "b";
|
||||
b.string_ptr = new std::string("b");
|
||||
b.string_ptr = 0;
|
||||
b.b = 2;
|
||||
b.b_ptr = new unsigned int( 2);
|
||||
b.c = 3;
|
||||
@ -40,8 +40,10 @@ void test_base()
|
||||
obj.bases_list_ptr = new std::list<base>;
|
||||
obj.bases_list_ptr->push_back(b);
|
||||
obj.bases_ptr_list_ptr = new std::list<base*>;
|
||||
obj.bases_ptr_list_ptr->push_back(new base(b));
|
||||
|
||||
obj.bases_ptr_list_ptr->push_back(nullptr);
|
||||
obj.bases_ptr_list_ptr->push_back(nullptr);
|
||||
obj.bases_ptr_list_ptr->push_back(nullptr);
|
||||
obj.bases_ptr_list_ptr->push_back(nullptr);
|
||||
acl::json json;
|
||||
acl::json_node &node = acl::gson(json, obj);
|
||||
printf("%s\n", node.to_string().c_str());
|
||||
@ -54,38 +56,26 @@ void test_base()
|
||||
std::pair<bool,std::string> ret = acl::gson(json2.get_root(), obj2);
|
||||
if(ret.first == false)
|
||||
printf("%s\n",ret.second.c_str());
|
||||
|
||||
acl::json json3;
|
||||
acl::json_node &node3 = acl::gson(json3, obj);
|
||||
printf("%s\n", node3.to_string().c_str());
|
||||
else
|
||||
{
|
||||
acl::json json3;
|
||||
acl::json_node &node3 = acl::gson(json3, obj2);
|
||||
printf("%s\n", node3.to_string().c_str());
|
||||
}
|
||||
|
||||
}
|
||||
void test02()
|
||||
{
|
||||
acl::gsoner gr;
|
||||
gr.read_file("struct2.h");
|
||||
gr.parse_code();
|
||||
}
|
||||
|
||||
void test04()
|
||||
void genfile()
|
||||
{
|
||||
acl::gsoner gr;
|
||||
|
||||
gr.read_multi_file({"struct.h" });
|
||||
gr.read_file("struct.h");
|
||||
gr.parse_code();
|
||||
gr.gen_gson();
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
//test_vector();
|
||||
test_base();
|
||||
return 0;
|
||||
std::string str = "std::string";
|
||||
std::string sub = str.substr(str.find("::"));
|
||||
printf("%s",sub.c_str());
|
||||
getchar();
|
||||
//test01();
|
||||
return 0;
|
||||
printf("enter any key to exit\r\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -11,5 +11,4 @@
|
||||
// TODO: 在此处引用程序要求的附加头文件
|
||||
|
||||
#include "lib_acl.h"
|
||||
#include "acl_cpp/lib_acl.hpp"
|
||||
#include "lib_protocol.h"
|
||||
#include "acl_cpp/lib_acl.hpp"
|
@ -80,6 +80,7 @@
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lib_acl_vc2015d.lib;lib_acl_cpp_vc2015d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)lib_acl_cpp;$(SolutionDir)lib_acl;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
@ -122,7 +123,12 @@
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
<ClCompile Include="src\stdafx.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\lib_acl_cpp\lib_acl_cpp_vc2015.vcxproj">
|
||||
<Project>{6ec1f44e-6a6a-48e9-b699-d7e89b63c8dc}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
@ -1,15 +0,0 @@
|
||||
// stdafx.h : 标准系统包含文件的包含文件,
|
||||
// 或是常用但不常更改的项目特定的包含文件
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
//#include <iostream>
|
||||
//#include <tchar.h>
|
||||
|
||||
// TODO: 在此处引用程序要求的附加头文件
|
||||
|
||||
#include "lib_acl.h"
|
||||
#include "acl_cpp/lib_acl.hpp"
|
||||
#include "lib_protocol.h"
|
@ -193,6 +193,22 @@ struct is_object :_Is_object<
|
||||
>
|
||||
{
|
||||
};
|
||||
//
|
||||
template <class T>
|
||||
typename std::enable_if<!std::is_pointer<T>::value,bool>::type
|
||||
static inline check_nullptr(T&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<!std::is_pointer<T>::value, bool>::type
|
||||
static inline check_nullptr(T *t)
|
||||
{
|
||||
if (t == nullptr)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//acl::string ,std::string
|
||||
template<class T>
|
||||
@ -267,14 +283,20 @@ template<class T>
|
||||
typename std::enable_if<is_object<T>::value , void>::type
|
||||
static inline add_item(acl::json &json, acl::json_node &node, const T &obj)
|
||||
{
|
||||
node.add_child(gson(json, obj));
|
||||
if (check_nullptr(obj))
|
||||
node.add_array_null();
|
||||
else
|
||||
node.add_child(gson(json, obj));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<is_object<T>::value , void>::type
|
||||
static inline add_item(acl::json &json,acl::json_node &node, const T *obj)
|
||||
{
|
||||
return add_item(json, node, *obj);
|
||||
if (check_nullptr(obj))
|
||||
node.add_array_null();
|
||||
else
|
||||
add_item(json, node, *obj);
|
||||
}
|
||||
|
||||
// number
|
||||
@ -282,14 +304,20 @@ template<class T>
|
||||
typename std::enable_if<is_number<T>::value, void>::type
|
||||
static inline add_item(acl::json &, acl::json_node &node, T value)
|
||||
{
|
||||
node.add_array_number(get_value(value));
|
||||
if (check_nullptr(value))
|
||||
node.add_array_null();
|
||||
else
|
||||
node.add_array_number(get_value(value));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
typename std::enable_if<is_number<T>::value, void>::type
|
||||
static inline add_item(acl::json &, acl::json_node &node, T *value)
|
||||
{
|
||||
node.add_array_number(get_value(value));
|
||||
if (check_nullptr(value))
|
||||
node.add_array_null();
|
||||
else
|
||||
node.add_array_number(get_value(value));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@ -297,7 +325,10 @@ typename std::enable_if<std::is_floating_point<
|
||||
typename std::remove_pointer<T>::type>::value, void>::type
|
||||
static inline add_item(acl::json &, acl::json_node &node, T value)
|
||||
{
|
||||
node.add_array_double(get_value(value));
|
||||
if (check_nullptr(value))
|
||||
node.add_array_null();
|
||||
else
|
||||
node.add_array_double(get_value(value));
|
||||
}
|
||||
|
||||
//bool
|
||||
@ -305,7 +336,10 @@ template<class T>
|
||||
typename std::enable_if<is_bool<T>::value, void>::type
|
||||
static inline add_item(acl::json &, acl::json_node &node, T value)
|
||||
{
|
||||
node.add_array_bool(get_value(value));
|
||||
if (check_nullptr(value))
|
||||
node.add_array_null();
|
||||
else
|
||||
node.add_array_bool(get_value(value));
|
||||
}
|
||||
|
||||
template<class V>
|
||||
@ -349,9 +383,6 @@ static inline acl::json_node &gson(acl::json &json, const std::vector<V> &object
|
||||
template<class V>
|
||||
static inline acl::json_node &gson(acl::json &json, const std::vector<V> *objects)
|
||||
{
|
||||
if(!objects)
|
||||
// {'a':[]} for empty vector.
|
||||
return json.create_array();
|
||||
return gson(json, *objects);
|
||||
}
|
||||
|
||||
@ -364,11 +395,16 @@ static inline gson(acl::json &json, const std::map<K, V> &objects)
|
||||
for(typename std::map<K, V>::const_iterator itr = objects.begin();
|
||||
itr != objects.end(); ++itr)
|
||||
{
|
||||
node.add_child(
|
||||
json.create_node().add_number(
|
||||
get_value(itr->first),
|
||||
get_value(itr->second))
|
||||
);
|
||||
const char *tag = get_value(itr->first);
|
||||
if (check_nullptr(itr->second))
|
||||
{
|
||||
node.add_child(json.create_node().add_null(tag));
|
||||
}
|
||||
else
|
||||
{
|
||||
acl::json_node &item = gson(json, itr->second);
|
||||
node.add_child(json.create_node().add_number(tag, item));
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@ -382,11 +418,16 @@ static inline gson(acl::json &json, const std::map<K, V> *objects)
|
||||
for(typename std::map<K, V>::const_iterator itr = objects->begin();
|
||||
itr != objects->end(); ++itr)
|
||||
{
|
||||
node.add_child(
|
||||
json.create_node().add_number(
|
||||
get_value(itr->first),
|
||||
get_value(itr->second))
|
||||
);
|
||||
const char *tag = get_value(itr->first);
|
||||
if (check_nullptr(itr->second))
|
||||
{
|
||||
node.add_child(json.create_node().add_null(tag));
|
||||
}
|
||||
else
|
||||
{
|
||||
acl::json_node &item = gson(json, itr->second);
|
||||
node.add_child(json.create_node().add_number(tag, item));
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@ -400,11 +441,16 @@ static inline gson(acl::json &json, const std::map<K, V> &objects)
|
||||
for(typename std::map<K, V>::const_iterator itr = objects.begin();
|
||||
itr != objects.end(); ++itr)
|
||||
{
|
||||
node.add_child(
|
||||
json.create_node().add_double(
|
||||
get_value(itr->first),
|
||||
get_value(itr->second))
|
||||
);
|
||||
const char *tag = get_value(itr->first);
|
||||
if (check_nullptr(itr->second))
|
||||
{
|
||||
node.add_child(json.create_node().add_null(tag));
|
||||
}
|
||||
else
|
||||
{
|
||||
acl::json_node &item = gson(json, itr->second);
|
||||
node.add_child(json.create_node().add_double(tag, item));
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@ -417,11 +463,16 @@ static inline gson(acl::json &json, const std::map<K, V> *objects)
|
||||
for(typename std::map<K, V>::const_iterator itr = objects->begin();
|
||||
itr != objects->end(); ++itr)
|
||||
{
|
||||
node.add_child(
|
||||
json.create_node().add_double(
|
||||
get_value(itr->first),
|
||||
get_value(itr->second))
|
||||
);
|
||||
const char *tag = get_value(itr->first);
|
||||
if (check_nullptr(itr->second))
|
||||
{
|
||||
node.add_child(json.create_node().add_null(tag));
|
||||
}
|
||||
else
|
||||
{
|
||||
acl::json_node &item = gson(json, itr->second);
|
||||
node.add_child(json.create_node().add_double(tag, item));
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@ -435,11 +486,16 @@ static inline gson(acl::json &json, const std::map<K, V> &objects)
|
||||
for(typename std::map<K, V>::const_iterator itr = objects;
|
||||
itr != objects.end(); ++itr)
|
||||
{
|
||||
node.add_child(
|
||||
json.create_node().add_bool(
|
||||
get_value(itr->first),
|
||||
get_value(itr->second))
|
||||
);
|
||||
const char *tag = get_value(itr->first);
|
||||
if (check_nullptr(itr->second))
|
||||
{
|
||||
node.add_child(json.create_node().add_null(tag));
|
||||
}
|
||||
else
|
||||
{
|
||||
acl::json_node &item = gson(json, itr->second);
|
||||
node.add_child(json.create_node().add_bool(tag, item));
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@ -447,17 +503,22 @@ static inline gson(acl::json &json, const std::map<K, V> &objects)
|
||||
template<class K, class V>
|
||||
typename std::enable_if<is_string<V>::value ||
|
||||
is_char_ptr<V>::value, acl::json_node &>::type
|
||||
static inline gson(acl::json &json, std::map<K, V> objects)
|
||||
static inline gson(acl::json &json, const std::map<K, V> & objects)
|
||||
{
|
||||
acl::json_node &node = json.create_array();
|
||||
for(typename std::map<K, V>::iterator itr = objects.begin();
|
||||
for(typename std::map<K, V>::const_iterator itr = objects.begin();
|
||||
itr != objects.end(); itr++)
|
||||
{
|
||||
node.add_child(
|
||||
json.create_node().add_text(
|
||||
get_value(itr->first),
|
||||
get_value(itr->second))
|
||||
);
|
||||
const char *tag = get_value(itr->first);
|
||||
if (check_nullptr(itr->second))
|
||||
{
|
||||
node.add_child(json.create_node().add_null(tag));
|
||||
}
|
||||
else
|
||||
{
|
||||
acl::json_node &item = gson(json, itr->second);
|
||||
node.add_child(json.create_node().add_text(tag, item));
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@ -471,8 +532,16 @@ static inline gson(acl::json &json,const std::map<T, V> &objects)
|
||||
itr = objects.begin(); itr != objects.end(); itr++)
|
||||
{
|
||||
const char *tag = get_value(itr->first);
|
||||
acl::json_node &item = gson(json, itr->second);
|
||||
node.add_child(json.create_node().add_child(tag, item));
|
||||
if (check_nullptr(itr->second))
|
||||
{
|
||||
node.add_child(json.create_node().add_null(tag));
|
||||
}
|
||||
else
|
||||
{
|
||||
acl::json_node &item = gson(json, itr->second);
|
||||
node.add_child(json.create_node().add_child(tag, item));
|
||||
}
|
||||
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@ -486,8 +555,16 @@ static inline gson(acl::json &json, const std::map<T, V> *objects)
|
||||
itr = objects->begin(); itr != objects->end(); itr++)
|
||||
{
|
||||
const char *tag = get_value(itr->first);
|
||||
acl::json_node &item = gson(json, itr->second);
|
||||
node.add_child(json.create_node().add_child(tag, item));
|
||||
if (check_nullptr(itr->second))
|
||||
{
|
||||
node.add_child(json.create_node().add_null(tag));
|
||||
}
|
||||
else
|
||||
{
|
||||
acl::json_node &item = gson(json, itr->second);
|
||||
node.add_child(json.create_node().add_child(tag, item));
|
||||
}
|
||||
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ private:
|
||||
function_code_t gen_unpack_code(const object_t &obj);
|
||||
std::string get_static_string();
|
||||
std::string get_include_files();
|
||||
std::string get_filename(const char *filepath);
|
||||
|
||||
bool skip_space_comment();
|
||||
|
||||
|
@ -195,11 +195,25 @@ gsoner::function_code_t gsoner::gen_pack_code(const object_t &obj)
|
||||
|
||||
str += "\n{\n";
|
||||
str += tab_;
|
||||
str += "acl::json_node &node = json.create_node();\n";
|
||||
str += "acl::json_node &node = json.create_node();\n\n";
|
||||
|
||||
/*
|
||||
if (check_nullptr(obj.string_ptr))
|
||||
node.add_null("string_ptr");
|
||||
else
|
||||
node.add_text("string_ptr", acl::get_value(obj.string_ptr));
|
||||
*/
|
||||
for(object_t::fields_t::const_iterator itr = obj.fields_.begin();
|
||||
itr != obj.fields_.end(); ++itr)
|
||||
{
|
||||
str += tab_;
|
||||
str += "if (check_nullptr(obj."+itr->name_+"))\n";
|
||||
str += tab_;
|
||||
str += tab_;
|
||||
str += "node.add_null(\""+itr->name_+"\");\n";
|
||||
str += tab_;
|
||||
str += "else\n";
|
||||
str += tab_;
|
||||
str += tab_;
|
||||
str += "node.";
|
||||
str += get_node_func(*itr);
|
||||
@ -209,7 +223,7 @@ gsoner::function_code_t gsoner::gen_pack_code(const object_t &obj)
|
||||
str += get_gson_func_laber(*itr);
|
||||
str += "obj.";
|
||||
str += itr->name_;
|
||||
str += "));\n";
|
||||
str += "));\n\n";
|
||||
}
|
||||
str += "\n";
|
||||
str += tab_;
|
||||
@ -1129,18 +1143,22 @@ bool gsoner::read_file(const char *filepath)
|
||||
std::istreambuf_iterator<char>());
|
||||
codes_.append(str);
|
||||
|
||||
files_.push_back(get_filename(filepath));
|
||||
|
||||
return true;
|
||||
}
|
||||
std::string gsoner::get_filename(const char *filepath)
|
||||
{
|
||||
std::string filename;
|
||||
int i = strlen(filepath) - 1;
|
||||
while(i >= 0 && (filepath[i] != '\\' || filepath[i] != '/'))
|
||||
while (i >= 0 && (filepath[i] != '\\' || filepath[i] != '/'))
|
||||
{
|
||||
filename.push_back(filepath[i]);
|
||||
i--;
|
||||
}
|
||||
std::reverse(filename.begin(), filename.end());
|
||||
|
||||
return true;
|
||||
return filename;
|
||||
}
|
||||
|
||||
bool gsoner::read_multi_file(const std::vector<std::string>& files)
|
||||
{
|
||||
for(std::vector<std::string>::const_iterator itr = files.begin();
|
||||
@ -1152,7 +1170,7 @@ bool gsoner::read_multi_file(const std::vector<std::string>& files)
|
||||
<< itr->c_str() << " error" << std::endl;
|
||||
return false;
|
||||
}
|
||||
files_.push_back(*itr);
|
||||
files_.push_back(get_filename(itr->c_str()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1254,9 +1272,10 @@ void gsoner::gen_gson()
|
||||
const char *namespace_end = "\n}///end of acl.";
|
||||
|
||||
write_source("#include \"stdafx.h\"\n");
|
||||
write_source(get_include_files());
|
||||
write_source("#include \"" + gen_header_filename_ + "\"\n");
|
||||
write_source("#include \"acl_cpp/stdlib/gson_helper.ipp\"\n");
|
||||
write_header(get_include_files());
|
||||
|
||||
write_header(namespace_start);
|
||||
write_source(namespace_start);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user