mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-29 18:37:41 +08:00
add set support in Gson. and fix potemtial bug in gson_helper.ipp
This commit is contained in:
parent
5b02378b16
commit
f1ac0703ef
@ -7,6 +7,7 @@
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)include;$(SolutionDir)lib_acl_cpp\include;$(SolutionDir)lib_acl\include;$(SolutionDir)lib_protocol\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)include;$(SolutionDir)lib_acl_cpp\include;$(SolutionDir)lib_acl\include;$(SolutionDir)lib_protocol\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalLibraryDirectories>$(SolutionDir)lib_acl_cpp;$(SolutionDir)lib_acl;$(SolutionDir)lib_protocol;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)lib_acl_cpp;$(SolutionDir)lib_acl;$(SolutionDir)lib_protocol;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
@ -2,4 +2,4 @@ include ./Makefile.in
|
|||||||
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
|
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
|
||||||
EXTLIBS += -L/usr/local/lib -liconv
|
EXTLIBS += -L/usr/local/lib -liconv
|
||||||
endif
|
endif
|
||||||
PROG = json
|
PROG = demo
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<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" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\acl.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<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" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
@ -116,14 +117,14 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="gson.h" />
|
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
|
<ClInclude Include="struct.gson.h" />
|
||||||
<ClInclude Include="struct.h" />
|
<ClInclude Include="struct.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="gson.cpp" />
|
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
<ClCompile Include="stdafx.cpp" />
|
<ClCompile Include="stdafx.cpp" />
|
||||||
|
<ClCompile Include="struct.gson.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="struct.stub" />
|
<None Include="struct.stub" />
|
||||||
|
@ -15,15 +15,15 @@
|
|||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="gson.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="stdafx.h">
|
<ClInclude Include="stdafx.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="struct.h">
|
<ClInclude Include="struct.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="struct.gson.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp">
|
<ClCompile Include="main.cpp">
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<Filter>源文件</Filter>
|
<Filter>源文件</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="gson.cpp">
|
<ClCompile Include="struct.gson.cpp">
|
||||||
<Filter>源文件</Filter>
|
<Filter>源文件</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
#include "gson.h"
|
#include "struct.gson.h"
|
||||||
|
|
||||||
void test_base()
|
void test_base()
|
||||||
{
|
{
|
||||||
@ -52,6 +52,16 @@ void test_base()
|
|||||||
obj.base_list_map.insert( std::make_pair("base", obj.bases_list));
|
obj.base_list_map.insert( std::make_pair("base", obj.bases_list));
|
||||||
obj.vector_list_base.push_back(obj.bases_list);
|
obj.vector_list_base.push_back(obj.bases_list);
|
||||||
|
|
||||||
|
//set
|
||||||
|
obj.str_set_.insert("hello1");
|
||||||
|
obj.str_set_.insert("hello2");
|
||||||
|
obj.str_set_.insert("hello3");
|
||||||
|
obj.bool_set_.insert(true);
|
||||||
|
obj.bool_set_.insert(false);
|
||||||
|
obj.int_set_.insert(1);
|
||||||
|
obj.int_set_.insert(11);
|
||||||
|
obj.int_set_.insert(111);
|
||||||
|
|
||||||
acl::json json;
|
acl::json json;
|
||||||
acl::json_node &node = acl::gson(json, obj);
|
acl::json_node &node = acl::gson(json, obj);
|
||||||
printf("%s\n\n", node.to_string().c_str());
|
printf("%s\n\n", node.to_string().c_str());
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "struct.h"
|
#include "struct.h"
|
||||||
#include "gson.h"
|
#include "struct.gson.h"
|
||||||
#include "acl_cpp/serialize/gson_helper.ipp"
|
#include "acl_cpp/serialize/gson_helper.ipp"
|
||||||
namespace acl
|
namespace acl
|
||||||
{
|
{
|
||||||
@ -160,73 +160,73 @@ namespace acl
|
|||||||
acl::json_node *h_ptr = $node["h_ptr"];
|
acl::json_node *h_ptr = $node["h_ptr"];
|
||||||
acl::json_node *i = $node["i"];
|
acl::json_node *i = $node["i"];
|
||||||
acl::json_node *i_ptr = $node["i_ptr"];
|
acl::json_node *i_ptr = $node["i_ptr"];
|
||||||
std::pair<bool, std::string> result;
|
std::pair<bool, std::string> $result;
|
||||||
|
|
||||||
if(!string ||!(result = gson(*string, &$obj.string), result.first))
|
if(!string ||!($result = gson(*string, &$obj.string), $result.first))
|
||||||
return std::make_pair(false, "required [base.string] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.string] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(string_ptr)
|
if(string_ptr)
|
||||||
gson(*string_ptr, &$obj.string_ptr);
|
gson(*string_ptr, &$obj.string_ptr);
|
||||||
|
|
||||||
if(!a ||!(result = gson(*a, &$obj.a), result.first))
|
if(!a ||!($result = gson(*a, &$obj.a), $result.first))
|
||||||
return std::make_pair(false, "required [base.a] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.a] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!a_ptr ||!(result = gson(*a_ptr, &$obj.a_ptr), result.first))
|
if(!a_ptr ||!($result = gson(*a_ptr, &$obj.a_ptr), $result.first))
|
||||||
return std::make_pair(false, "required [base.a_ptr] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.a_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!b ||!(result = gson(*b, &$obj.b), result.first))
|
if(!b ||!($result = gson(*b, &$obj.b), $result.first))
|
||||||
return std::make_pair(false, "required [base.b] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.b] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!b_ptr ||!(result = gson(*b_ptr, &$obj.b_ptr), result.first))
|
if(!b_ptr ||!($result = gson(*b_ptr, &$obj.b_ptr), $result.first))
|
||||||
return std::make_pair(false, "required [base.b_ptr] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.b_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!c ||!(result = gson(*c, &$obj.c), result.first))
|
if(!c ||!($result = gson(*c, &$obj.c), $result.first))
|
||||||
return std::make_pair(false, "required [base.c] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.c] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!c_ptr ||!(result = gson(*c_ptr, &$obj.c_ptr), result.first))
|
if(!c_ptr ||!($result = gson(*c_ptr, &$obj.c_ptr), $result.first))
|
||||||
return std::make_pair(false, "required [base.c_ptr] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.c_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!d ||!(result = gson(*d, &$obj.d), result.first))
|
if(!d ||!($result = gson(*d, &$obj.d), $result.first))
|
||||||
return std::make_pair(false, "required [base.d] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.d] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!d_ptr ||!(result = gson(*d_ptr, &$obj.d_ptr), result.first))
|
if(!d_ptr ||!($result = gson(*d_ptr, &$obj.d_ptr), $result.first))
|
||||||
return std::make_pair(false, "required [base.d_ptr] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.d_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!e ||!(result = gson(*e, &$obj.e), result.first))
|
if(!e ||!($result = gson(*e, &$obj.e), $result.first))
|
||||||
return std::make_pair(false, "required [base.e] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.e] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!e_ptr ||!(result = gson(*e_ptr, &$obj.e_ptr), result.first))
|
if(!e_ptr ||!($result = gson(*e_ptr, &$obj.e_ptr), $result.first))
|
||||||
return std::make_pair(false, "required [base.e_ptr] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.e_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!f ||!(result = gson(*f, &$obj.f), result.first))
|
if(!f ||!($result = gson(*f, &$obj.f), $result.first))
|
||||||
return std::make_pair(false, "required [base.f] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.f] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!f_ptr ||!(result = gson(*f_ptr, &$obj.f_ptr), result.first))
|
if(!f_ptr ||!($result = gson(*f_ptr, &$obj.f_ptr), $result.first))
|
||||||
return std::make_pair(false, "required [base.f_ptr] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.f_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!g ||!(result = gson(*g, &$obj.g), result.first))
|
if(!g ||!($result = gson(*g, &$obj.g), $result.first))
|
||||||
return std::make_pair(false, "required [base.g] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.g] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!g_ptr ||!(result = gson(*g_ptr, &$obj.g_ptr), result.first))
|
if(!g_ptr ||!($result = gson(*g_ptr, &$obj.g_ptr), $result.first))
|
||||||
return std::make_pair(false, "required [base.g_ptr] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.g_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!acl_string ||!(result = gson(*acl_string, &$obj.acl_string), result.first))
|
if(!acl_string ||!($result = gson(*acl_string, &$obj.acl_string), $result.first))
|
||||||
return std::make_pair(false, "required [base.acl_string] failed:{"+result.second+"}");
|
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))
|
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+"}");
|
return std::make_pair(false, "required [base.acl_string_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!h ||!(result = gson(*h, &$obj.h), result.first))
|
if(!h ||!($result = gson(*h, &$obj.h), $result.first))
|
||||||
return std::make_pair(false, "required [base.h] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.h] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!h_ptr ||!(result = gson(*h_ptr, &$obj.h_ptr), result.first))
|
if(!h_ptr ||!($result = gson(*h_ptr, &$obj.h_ptr), $result.first))
|
||||||
return std::make_pair(false, "required [base.h_ptr] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.h_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!i ||!(result = gson(*i, &$obj.i), result.first))
|
if(!i ||!($result = gson(*i, &$obj.i), $result.first))
|
||||||
return std::make_pair(false, "required [base.i] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [base.i] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!i_ptr ||!(result = gson(*i_ptr, &$obj.i_ptr), result.first))
|
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(false, "required [base.i_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
return std::make_pair(true,"");
|
return std::make_pair(true,"");
|
||||||
}
|
}
|
||||||
@ -238,6 +238,18 @@ namespace acl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::pair<bool,std::string> gson(const acl::string &$str, base &$obj)
|
||||||
|
{
|
||||||
|
acl::json _json;
|
||||||
|
_json.update($str.c_str());
|
||||||
|
if (!_json.finish())
|
||||||
|
{
|
||||||
|
return std::make_pair(false, "json not finish error");
|
||||||
|
}
|
||||||
|
return gson(_json.get_root(), $obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
acl::json_node& gson(acl::json &$json, const hello::world &$obj)
|
acl::json_node& gson(acl::json &$json, const hello::world &$obj)
|
||||||
{
|
{
|
||||||
acl::json_node &$node = $json.create_node();
|
acl::json_node &$node = $json.create_node();
|
||||||
@ -267,6 +279,16 @@ namespace acl
|
|||||||
else
|
else
|
||||||
$node.add_child("bases_ptr_list_ptr", acl::gson($json, $obj.bases_ptr_list_ptr));
|
$node.add_child("bases_ptr_list_ptr", acl::gson($json, $obj.bases_ptr_list_ptr));
|
||||||
|
|
||||||
|
if (check_nullptr($obj.vector_string))
|
||||||
|
$node.add_null("vector_string");
|
||||||
|
else
|
||||||
|
$node.add_child("vector_string", acl::gson($json, $obj.vector_string));
|
||||||
|
|
||||||
|
if (check_nullptr($obj.vector_list_base))
|
||||||
|
$node.add_null("vector_list_base");
|
||||||
|
else
|
||||||
|
$node.add_child("vector_list_base", acl::gson($json, $obj.vector_list_base));
|
||||||
|
|
||||||
if (check_nullptr($obj.base_map))
|
if (check_nullptr($obj.base_map))
|
||||||
$node.add_null("base_map");
|
$node.add_null("base_map");
|
||||||
else
|
else
|
||||||
@ -292,15 +314,20 @@ namespace acl
|
|||||||
else
|
else
|
||||||
$node.add_child("base_list_map", acl::gson($json, $obj.base_list_map));
|
$node.add_child("base_list_map", acl::gson($json, $obj.base_list_map));
|
||||||
|
|
||||||
if (check_nullptr($obj.vector_string))
|
if (check_nullptr($obj.str_set_))
|
||||||
$node.add_null("vector_string");
|
$node.add_null("str_set_");
|
||||||
else
|
else
|
||||||
$node.add_child("vector_string", acl::gson($json, $obj.vector_string));
|
$node.add_child("str_set_", acl::gson($json, $obj.str_set_));
|
||||||
|
|
||||||
if (check_nullptr($obj.vector_list_base))
|
if (check_nullptr($obj.int_set_))
|
||||||
$node.add_null("vector_list_base");
|
$node.add_null("int_set_");
|
||||||
else
|
else
|
||||||
$node.add_child("vector_list_base", acl::gson($json, $obj.vector_list_base));
|
$node.add_child("int_set_", acl::gson($json, $obj.int_set_));
|
||||||
|
|
||||||
|
if (check_nullptr($obj.bool_set_))
|
||||||
|
$node.add_null("bool_set_");
|
||||||
|
else
|
||||||
|
$node.add_child("bool_set_", acl::gson($json, $obj.bool_set_));
|
||||||
|
|
||||||
if (check_nullptr($obj.me))
|
if (check_nullptr($obj.me))
|
||||||
$node.add_null("me");
|
$node.add_null("me");
|
||||||
@ -332,54 +359,66 @@ namespace acl
|
|||||||
acl::json_node *bases_list = $node["bases_list"];
|
acl::json_node *bases_list = $node["bases_list"];
|
||||||
acl::json_node *bases_list_ptr = $node["bases_list_ptr"];
|
acl::json_node *bases_list_ptr = $node["bases_list_ptr"];
|
||||||
acl::json_node *bases_ptr_list_ptr = $node["bases_ptr_list_ptr"];
|
acl::json_node *bases_ptr_list_ptr = $node["bases_ptr_list_ptr"];
|
||||||
|
acl::json_node *vector_string = $node["vector_string"];
|
||||||
|
acl::json_node *vector_list_base = $node["vector_list_base"];
|
||||||
acl::json_node *base_map = $node["base_map"];
|
acl::json_node *base_map = $node["base_map"];
|
||||||
acl::json_node *string_map = $node["string_map"];
|
acl::json_node *string_map = $node["string_map"];
|
||||||
acl::json_node *int_map = $node["int_map"];
|
acl::json_node *int_map = $node["int_map"];
|
||||||
acl::json_node *bool_map = $node["bool_map"];
|
acl::json_node *bool_map = $node["bool_map"];
|
||||||
acl::json_node *base_list_map = $node["base_list_map"];
|
acl::json_node *base_list_map = $node["base_list_map"];
|
||||||
acl::json_node *vector_string = $node["vector_string"];
|
acl::json_node *str_set_ = $node["str_set_"];
|
||||||
acl::json_node *vector_list_base = $node["vector_list_base"];
|
acl::json_node *int_set_ = $node["int_set_"];
|
||||||
|
acl::json_node *bool_set_ = $node["bool_set_"];
|
||||||
acl::json_node *me = $node["me"];
|
acl::json_node *me = $node["me"];
|
||||||
std::pair<bool, std::string> result;
|
std::pair<bool, std::string> $result;
|
||||||
|
|
||||||
if(!b ||!b->get_obj()||!(result = gson(*b->get_obj(), &$obj.b), result.first))
|
if(!b ||!b->get_obj()||!($result = gson(*b->get_obj(), &$obj.b), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.b] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.b] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!b_ptr ||!b_ptr->get_obj()||!(result = gson(*b_ptr->get_obj(), &$obj.b_ptr), result.first))
|
if(!b_ptr ||!b_ptr->get_obj()||!($result = gson(*b_ptr->get_obj(), &$obj.b_ptr), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.b_ptr] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.b_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!bases_list ||!bases_list->get_obj()||!(result = gson(*bases_list->get_obj(), &$obj.bases_list), result.first))
|
if(!bases_list ||!bases_list->get_obj()||!($result = gson(*bases_list->get_obj(), &$obj.bases_list), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.bases_list] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.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))
|
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 [hello::world.bases_list_ptr] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.bases_list_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(bases_ptr_list_ptr&& bases_ptr_list_ptr->get_obj())
|
if(bases_ptr_list_ptr&& bases_ptr_list_ptr->get_obj())
|
||||||
gson(*bases_ptr_list_ptr->get_obj(), &$obj.bases_ptr_list_ptr);
|
gson(*bases_ptr_list_ptr->get_obj(), &$obj.bases_ptr_list_ptr);
|
||||||
|
|
||||||
if(!base_map ||!base_map->get_obj()||!(result = gson(*base_map->get_obj(), &$obj.base_map), result.first))
|
if(!vector_string ||!vector_string->get_obj()||!($result = gson(*vector_string->get_obj(), &$obj.vector_string), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.base_map] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.vector_string] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!string_map ||!string_map->get_obj()||!(result = gson(*string_map->get_obj(), &$obj.string_map), result.first))
|
if(!vector_list_base ||!vector_list_base->get_obj()||!($result = gson(*vector_list_base->get_obj(), &$obj.vector_list_base), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.string_map] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.vector_list_base] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!int_map ||!int_map->get_obj()||!(result = gson(*int_map->get_obj(), &$obj.int_map), result.first))
|
if(!base_map ||!base_map->get_obj()||!($result = gson(*base_map->get_obj(), &$obj.base_map), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.int_map] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.base_map] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!bool_map ||!bool_map->get_obj()||!(result = gson(*bool_map->get_obj(), &$obj.bool_map), result.first))
|
if(!string_map ||!string_map->get_obj()||!($result = gson(*string_map->get_obj(), &$obj.string_map), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.bool_map] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.string_map] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!base_list_map ||!base_list_map->get_obj()||!(result = gson(*base_list_map->get_obj(), &$obj.base_list_map), result.first))
|
if(!int_map ||!int_map->get_obj()||!($result = gson(*int_map->get_obj(), &$obj.int_map), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.base_list_map] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.int_map] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!vector_string ||!vector_string->get_obj()||!(result = gson(*vector_string->get_obj(), &$obj.vector_string), result.first))
|
if(!bool_map ||!bool_map->get_obj()||!($result = gson(*bool_map->get_obj(), &$obj.bool_map), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.vector_string] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.bool_map] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!vector_list_base ||!vector_list_base->get_obj()||!(result = gson(*vector_list_base->get_obj(), &$obj.vector_list_base), result.first))
|
if(!base_list_map ||!base_list_map->get_obj()||!($result = gson(*base_list_map->get_obj(), &$obj.base_list_map), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.vector_list_base] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.base_list_map] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!me ||!(result = gson(*me, &$obj.me), result.first))
|
if(!str_set_ ||!str_set_->get_obj()||!($result = gson(*str_set_->get_obj(), &$obj.str_set_), $result.first))
|
||||||
return std::make_pair(false, "required [hello::world.me] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [hello::world.str_set_] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
|
if(!int_set_ ||!int_set_->get_obj()||!($result = gson(*int_set_->get_obj(), &$obj.int_set_), $result.first))
|
||||||
|
return std::make_pair(false, "required [hello::world.int_set_] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
|
if(!bool_set_ ||!bool_set_->get_obj()||!($result = gson(*bool_set_->get_obj(), &$obj.bool_set_), $result.first))
|
||||||
|
return std::make_pair(false, "required [hello::world.bool_set_] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
|
if(!me ||!($result = gson(*me, &$obj.me), $result.first))
|
||||||
|
return std::make_pair(false, "required [hello::world.me] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
return std::make_pair(true,"");
|
return std::make_pair(true,"");
|
||||||
}
|
}
|
||||||
@ -391,6 +430,18 @@ namespace acl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::pair<bool,std::string> gson(const acl::string &$str, hello::world &$obj)
|
||||||
|
{
|
||||||
|
acl::json _json;
|
||||||
|
_json.update($str.c_str());
|
||||||
|
if (!_json.finish())
|
||||||
|
{
|
||||||
|
return std::make_pair(false, "json not finish error");
|
||||||
|
}
|
||||||
|
return gson(_json.get_root(), $obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
acl::json_node& gson(acl::json &$json, const list1 &$obj)
|
acl::json_node& gson(acl::json &$json, const list1 &$obj)
|
||||||
{
|
{
|
||||||
acl::json_node &$node = $json.create_node();
|
acl::json_node &$node = $json.create_node();
|
||||||
@ -420,6 +471,16 @@ namespace acl
|
|||||||
else
|
else
|
||||||
$node.add_child("bases_ptr_list_ptr", acl::gson($json, $obj.bases_ptr_list_ptr));
|
$node.add_child("bases_ptr_list_ptr", acl::gson($json, $obj.bases_ptr_list_ptr));
|
||||||
|
|
||||||
|
if (check_nullptr($obj.vector_string))
|
||||||
|
$node.add_null("vector_string");
|
||||||
|
else
|
||||||
|
$node.add_child("vector_string", acl::gson($json, $obj.vector_string));
|
||||||
|
|
||||||
|
if (check_nullptr($obj.vector_list_base))
|
||||||
|
$node.add_null("vector_list_base");
|
||||||
|
else
|
||||||
|
$node.add_child("vector_list_base", acl::gson($json, $obj.vector_list_base));
|
||||||
|
|
||||||
if (check_nullptr($obj.base_map))
|
if (check_nullptr($obj.base_map))
|
||||||
$node.add_null("base_map");
|
$node.add_null("base_map");
|
||||||
else
|
else
|
||||||
@ -445,15 +506,20 @@ namespace acl
|
|||||||
else
|
else
|
||||||
$node.add_child("base_list_map", acl::gson($json, $obj.base_list_map));
|
$node.add_child("base_list_map", acl::gson($json, $obj.base_list_map));
|
||||||
|
|
||||||
if (check_nullptr($obj.vector_string))
|
if (check_nullptr($obj.str_set_))
|
||||||
$node.add_null("vector_string");
|
$node.add_null("str_set_");
|
||||||
else
|
else
|
||||||
$node.add_child("vector_string", acl::gson($json, $obj.vector_string));
|
$node.add_child("str_set_", acl::gson($json, $obj.str_set_));
|
||||||
|
|
||||||
if (check_nullptr($obj.vector_list_base))
|
if (check_nullptr($obj.int_set_))
|
||||||
$node.add_null("vector_list_base");
|
$node.add_null("int_set_");
|
||||||
else
|
else
|
||||||
$node.add_child("vector_list_base", acl::gson($json, $obj.vector_list_base));
|
$node.add_child("int_set_", acl::gson($json, $obj.int_set_));
|
||||||
|
|
||||||
|
if (check_nullptr($obj.bool_set_))
|
||||||
|
$node.add_null("bool_set_");
|
||||||
|
else
|
||||||
|
$node.add_child("bool_set_", acl::gson($json, $obj.bool_set_));
|
||||||
|
|
||||||
|
|
||||||
return $node;
|
return $node;
|
||||||
@ -480,50 +546,62 @@ namespace acl
|
|||||||
acl::json_node *bases_list = $node["bases_list"];
|
acl::json_node *bases_list = $node["bases_list"];
|
||||||
acl::json_node *bases_list_ptr = $node["bases_list_ptr"];
|
acl::json_node *bases_list_ptr = $node["bases_list_ptr"];
|
||||||
acl::json_node *bases_ptr_list_ptr = $node["bases_ptr_list_ptr"];
|
acl::json_node *bases_ptr_list_ptr = $node["bases_ptr_list_ptr"];
|
||||||
|
acl::json_node *vector_string = $node["vector_string"];
|
||||||
|
acl::json_node *vector_list_base = $node["vector_list_base"];
|
||||||
acl::json_node *base_map = $node["base_map"];
|
acl::json_node *base_map = $node["base_map"];
|
||||||
acl::json_node *string_map = $node["string_map"];
|
acl::json_node *string_map = $node["string_map"];
|
||||||
acl::json_node *int_map = $node["int_map"];
|
acl::json_node *int_map = $node["int_map"];
|
||||||
acl::json_node *bool_map = $node["bool_map"];
|
acl::json_node *bool_map = $node["bool_map"];
|
||||||
acl::json_node *base_list_map = $node["base_list_map"];
|
acl::json_node *base_list_map = $node["base_list_map"];
|
||||||
acl::json_node *vector_string = $node["vector_string"];
|
acl::json_node *str_set_ = $node["str_set_"];
|
||||||
acl::json_node *vector_list_base = $node["vector_list_base"];
|
acl::json_node *int_set_ = $node["int_set_"];
|
||||||
std::pair<bool, std::string> result;
|
acl::json_node *bool_set_ = $node["bool_set_"];
|
||||||
|
std::pair<bool, std::string> $result;
|
||||||
|
|
||||||
if(!b ||!b->get_obj()||!(result = gson(*b->get_obj(), &$obj.b), result.first))
|
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+"}");
|
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))
|
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+"}");
|
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))
|
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+"}");
|
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))
|
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+"}");
|
return std::make_pair(false, "required [list1.bases_list_ptr] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(bases_ptr_list_ptr&& bases_ptr_list_ptr->get_obj())
|
if(bases_ptr_list_ptr&& bases_ptr_list_ptr->get_obj())
|
||||||
gson(*bases_ptr_list_ptr->get_obj(), &$obj.bases_ptr_list_ptr);
|
gson(*bases_ptr_list_ptr->get_obj(), &$obj.bases_ptr_list_ptr);
|
||||||
|
|
||||||
if(!base_map ||!base_map->get_obj()||!(result = gson(*base_map->get_obj(), &$obj.base_map), result.first))
|
if(!vector_string ||!vector_string->get_obj()||!($result = gson(*vector_string->get_obj(), &$obj.vector_string), $result.first))
|
||||||
return std::make_pair(false, "required [list1.base_map] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [list1.vector_string] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!string_map ||!string_map->get_obj()||!(result = gson(*string_map->get_obj(), &$obj.string_map), result.first))
|
if(!vector_list_base ||!vector_list_base->get_obj()||!($result = gson(*vector_list_base->get_obj(), &$obj.vector_list_base), $result.first))
|
||||||
return std::make_pair(false, "required [list1.string_map] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [list1.vector_list_base] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!int_map ||!int_map->get_obj()||!(result = gson(*int_map->get_obj(), &$obj.int_map), result.first))
|
if(!base_map ||!base_map->get_obj()||!($result = gson(*base_map->get_obj(), &$obj.base_map), $result.first))
|
||||||
return std::make_pair(false, "required [list1.int_map] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [list1.base_map] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!bool_map ||!bool_map->get_obj()||!(result = gson(*bool_map->get_obj(), &$obj.bool_map), result.first))
|
if(!string_map ||!string_map->get_obj()||!($result = gson(*string_map->get_obj(), &$obj.string_map), $result.first))
|
||||||
return std::make_pair(false, "required [list1.bool_map] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [list1.string_map] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!base_list_map ||!base_list_map->get_obj()||!(result = gson(*base_list_map->get_obj(), &$obj.base_list_map), result.first))
|
if(!int_map ||!int_map->get_obj()||!($result = gson(*int_map->get_obj(), &$obj.int_map), $result.first))
|
||||||
return std::make_pair(false, "required [list1.base_list_map] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [list1.int_map] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!vector_string ||!vector_string->get_obj()||!(result = gson(*vector_string->get_obj(), &$obj.vector_string), result.first))
|
if(!bool_map ||!bool_map->get_obj()||!($result = gson(*bool_map->get_obj(), &$obj.bool_map), $result.first))
|
||||||
return std::make_pair(false, "required [list1.vector_string] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [list1.bool_map] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
if(!vector_list_base ||!vector_list_base->get_obj()||!(result = gson(*vector_list_base->get_obj(), &$obj.vector_list_base), result.first))
|
if(!base_list_map ||!base_list_map->get_obj()||!($result = gson(*base_list_map->get_obj(), &$obj.base_list_map), $result.first))
|
||||||
return std::make_pair(false, "required [list1.vector_list_base] failed:{"+result.second+"}");
|
return std::make_pair(false, "required [list1.base_list_map] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
|
if(!str_set_ ||!str_set_->get_obj()||!($result = gson(*str_set_->get_obj(), &$obj.str_set_), $result.first))
|
||||||
|
return std::make_pair(false, "required [list1.str_set_] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
|
if(!int_set_ ||!int_set_->get_obj()||!($result = gson(*int_set_->get_obj(), &$obj.int_set_), $result.first))
|
||||||
|
return std::make_pair(false, "required [list1.int_set_] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
|
if(!bool_set_ ||!bool_set_->get_obj()||!($result = gson(*bool_set_->get_obj(), &$obj.bool_set_), $result.first))
|
||||||
|
return std::make_pair(false, "required [list1.bool_set_] failed:{"+$result.second+"}");
|
||||||
|
|
||||||
return std::make_pair(true,"");
|
return std::make_pair(true,"");
|
||||||
}
|
}
|
||||||
@ -535,4 +613,16 @@ namespace acl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::pair<bool,std::string> gson(const acl::string &$str, list1 &$obj)
|
||||||
|
{
|
||||||
|
acl::json _json;
|
||||||
|
_json.update($str.c_str());
|
||||||
|
if (!_json.finish())
|
||||||
|
{
|
||||||
|
return std::make_pair(false, "json not finish error");
|
||||||
|
}
|
||||||
|
return gson(_json.get_root(), $obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}///end of acl.
|
}///end of acl.
|
@ -6,16 +6,22 @@ namespace acl
|
|||||||
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);
|
||||||
std::pair<bool,std::string> gson(acl::json_node &$node, base *$obj);
|
std::pair<bool,std::string> gson(acl::json_node &$node, base *$obj);
|
||||||
|
std::pair<bool,std::string> gson(const acl::string &str, base &$obj);
|
||||||
|
|
||||||
//hello::world
|
//hello::world
|
||||||
acl::string gson(const hello::world &$obj);
|
acl::string gson(const hello::world &$obj);
|
||||||
acl::json_node& gson(acl::json &$json, const hello::world &$obj);
|
acl::json_node& gson(acl::json &$json, const hello::world &$obj);
|
||||||
acl::json_node& gson(acl::json &$json, const hello::world *$obj);
|
acl::json_node& gson(acl::json &$json, const hello::world *$obj);
|
||||||
std::pair<bool,std::string> gson(acl::json_node &$node, hello::world &$obj);
|
std::pair<bool,std::string> gson(acl::json_node &$node, hello::world &$obj);
|
||||||
std::pair<bool,std::string> gson(acl::json_node &$node, hello::world *$obj);
|
std::pair<bool,std::string> gson(acl::json_node &$node, hello::world *$obj);
|
||||||
|
std::pair<bool,std::string> gson(const acl::string &str, hello::world &$obj);
|
||||||
|
|
||||||
//list1
|
//list1
|
||||||
acl::string gson(const list1 &$obj);
|
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);
|
||||||
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);
|
||||||
std::pair<bool,std::string> gson(acl::json_node &$node, list1 *$obj);
|
std::pair<bool,std::string> gson(acl::json_node &$node, list1 *$obj);
|
||||||
|
std::pair<bool,std::string> gson(const acl::string &str, list1 &$obj);
|
||||||
|
|
||||||
}///end of acl.
|
}///end of acl.
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include <set>
|
||||||
|
|
||||||
struct base
|
struct base
|
||||||
{
|
{
|
||||||
@ -37,13 +38,19 @@ struct list1
|
|||||||
std::list<base> *bases_list_ptr;
|
std::list<base> *bases_list_ptr;
|
||||||
//Gson@optional
|
//Gson@optional
|
||||||
std::list<base*> *bases_ptr_list_ptr;
|
std::list<base*> *bases_ptr_list_ptr;
|
||||||
std::map<std::string,base> base_map;
|
std::vector<std::string> vector_string;
|
||||||
std::map<std::string,std::string> string_map;
|
std::vector<std::list<base> > vector_list_base;
|
||||||
|
|
||||||
|
std::map<std::string, base> base_map;
|
||||||
|
std::map<std::string, std::string> string_map;
|
||||||
std::map<std::string, int> int_map;
|
std::map<std::string, int> int_map;
|
||||||
std::map<std::string, bool > bool_map;
|
std::map<std::string, bool > bool_map;
|
||||||
std::map<std::string,std::list<base> > base_list_map;
|
std::map<std::string, std::list<base> > base_list_map;
|
||||||
std::vector<std::string> vector_string;
|
|
||||||
std::vector<std::list<base> > vector_list_base;
|
//set
|
||||||
|
std::set<std::string> str_set_;
|
||||||
|
std::set<int> int_set_;
|
||||||
|
std::set<bool> bool_set_;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace hello
|
namespace hello
|
||||||
|
@ -1,4 +1,66 @@
|
|||||||
#pragma once
|
#pragma once#pragma once
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
struct base
|
||||||
|
{
|
||||||
|
std::string string ;
|
||||||
|
//Gson@optional
|
||||||
|
std::string *string_ptr ;
|
||||||
|
int a ;
|
||||||
|
int *a_ptr ;
|
||||||
|
unsigned int b ;
|
||||||
|
unsigned int *b_ptr;
|
||||||
|
int64_t c ;
|
||||||
|
int64_t *c_ptr ;
|
||||||
|
unsigned long d;
|
||||||
|
unsigned long *d_ptr ;
|
||||||
|
unsigned long long e ;
|
||||||
|
unsigned long long *e_ptr;
|
||||||
|
long f ;
|
||||||
|
long *f_ptr ;
|
||||||
|
long long g;
|
||||||
|
|
||||||
|
long long *g_ptr ;
|
||||||
|
acl::string acl_string;
|
||||||
|
acl::string *acl_string_ptr;
|
||||||
|
|
||||||
|
float h;
|
||||||
|
float *h_ptr;
|
||||||
|
double i;
|
||||||
|
double *i_ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct list1
|
||||||
|
{
|
||||||
|
base b;
|
||||||
|
base *b_ptr;
|
||||||
|
std::list<base> bases_list;
|
||||||
|
std::list<base> *bases_list_ptr;
|
||||||
|
//Gson@optional
|
||||||
|
std::list<base*> *bases_ptr_list_ptr;
|
||||||
|
std::vector<std::string> vector_string;
|
||||||
|
std::vector<std::list<base> > vector_list_base;
|
||||||
|
|
||||||
|
std::map<std::string, base> base_map;
|
||||||
|
std::map<std::string, std::string> string_map;
|
||||||
|
std::map<std::string, int> int_map;
|
||||||
|
std::map<std::string, bool > bool_map;
|
||||||
|
std::map<std::string, std::list<base> > base_list_map;
|
||||||
|
|
||||||
|
//set
|
||||||
|
std::set<std::string> str_set_;
|
||||||
|
std::set<int> int_set_;
|
||||||
|
std::set<bool> bool_set_;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace hello
|
||||||
|
{
|
||||||
|
struct world : list1
|
||||||
|
{
|
||||||
|
int me;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct base
|
struct base
|
||||||
{
|
{
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<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" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\acl.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<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" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "../stdlib/string.hpp"
|
#include "../stdlib/string.hpp"
|
||||||
#include "../stdlib/json.hpp"
|
#include "../stdlib/json.hpp"
|
||||||
#include "../stdlib/string.hpp"
|
#include "../stdlib/string.hpp"
|
||||||
|
#include <set>
|
||||||
namespace acl
|
namespace acl
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ static inline void add_item(acl::json &, acl::json_node &node, char *value)
|
|||||||
else
|
else
|
||||||
node.add_array_text(value);
|
node.add_array_text(value);
|
||||||
}
|
}
|
||||||
|
//list
|
||||||
template<class T>
|
template<class T>
|
||||||
static inline acl::json_node &gson(acl::json &json,
|
static inline acl::json_node &gson(acl::json &json,
|
||||||
const std::list<T> &objects)
|
const std::list<T> &objects)
|
||||||
@ -445,7 +445,6 @@ static inline acl::json_node &gson(acl::json &json,
|
|||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
static inline acl::json_node &gson(acl::json &json,
|
static inline acl::json_node &gson(acl::json &json,
|
||||||
const std::list<T> *objects)
|
const std::list<T> *objects)
|
||||||
@ -453,6 +452,7 @@ static inline acl::json_node &gson(acl::json &json,
|
|||||||
return gson(json, *objects);
|
return gson(json, *objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//vector
|
||||||
template<class T>
|
template<class T>
|
||||||
static inline acl::json_node &gson(acl::json &json,
|
static inline acl::json_node &gson(acl::json &json,
|
||||||
const std::vector<T> &objects)
|
const std::vector<T> &objects)
|
||||||
@ -473,6 +473,26 @@ static inline acl::json_node &gson(acl::json &json,
|
|||||||
{
|
{
|
||||||
return gson(json, *objects);
|
return gson(json, *objects);
|
||||||
}
|
}
|
||||||
|
//set
|
||||||
|
template<class T>
|
||||||
|
static inline acl::json_node &gson(acl::json &json, const std::set<T> *objects)
|
||||||
|
{
|
||||||
|
return gson(json, *objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
static inline acl::json_node &gson(acl::json &json,
|
||||||
|
const std::set<T> &objects)
|
||||||
|
{
|
||||||
|
acl::json_node &node = json.create_array();
|
||||||
|
for (typename std::set<T>::const_iterator
|
||||||
|
itr = objects.begin(); itr != objects.end(); ++itr)
|
||||||
|
{
|
||||||
|
add_item(json, node, *itr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
//define number map
|
//define number map
|
||||||
template<class K, class V>
|
template<class K, class V>
|
||||||
@ -860,7 +880,6 @@ static inline std::pair<bool, std::string>
|
|||||||
gson(acl::json_node &node, std::list<T> *objs)
|
gson(acl::json_node &node, std::list<T> *objs)
|
||||||
{
|
{
|
||||||
std::pair<bool, std::string> result;
|
std::pair<bool, std::string> result;
|
||||||
std::string error_string;
|
|
||||||
acl::json_node *itr = node.first_child();
|
acl::json_node *itr = node.first_child();
|
||||||
|
|
||||||
while (itr)
|
while (itr)
|
||||||
@ -873,16 +892,18 @@ gson(acl::json_node &node, std::list<T> *objs)
|
|||||||
objs->push_back(obj);
|
objs->push_back(obj);
|
||||||
typename std::list<T>::iterator it = objs->end();
|
typename std::list<T>::iterator it = objs->end();
|
||||||
--it;
|
--it;
|
||||||
result = gson(*itr, *it);
|
result = gson(*itr, &*it);
|
||||||
if (!result.first)
|
if (!result.first)
|
||||||
{
|
{
|
||||||
error_string.append(result.second);
|
break;
|
||||||
objs->erase(it);
|
|
||||||
}
|
}
|
||||||
itr = node.next_child();
|
itr = node.next_child();
|
||||||
}
|
}
|
||||||
|
if (result.first)
|
||||||
return std::make_pair(!!!objs->empty(), error_string);
|
return result;
|
||||||
|
|
||||||
|
objs->clear();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// list
|
// list
|
||||||
@ -891,28 +912,25 @@ static inline std::pair<bool, std::string>
|
|||||||
gson(acl::json_node &node, std::list<T*> *objs)
|
gson(acl::json_node &node, std::list<T*> *objs)
|
||||||
{
|
{
|
||||||
std::pair<bool, std::string> result;
|
std::pair<bool, std::string> result;
|
||||||
std::string error_string;
|
|
||||||
acl::json_node *itr = node.first_child();
|
acl::json_node *itr = node.first_child();
|
||||||
|
|
||||||
while (itr)
|
while (itr)
|
||||||
{
|
{
|
||||||
// for avoiding object's member pointor copy
|
|
||||||
// ---lindawei
|
|
||||||
|
|
||||||
T* obj = new T;
|
T* obj = new T;
|
||||||
objs->push_back(obj);
|
objs->push_back(obj);
|
||||||
typename std::list<T*>::iterator it = objs->end();
|
result = gson(*itr, obj);
|
||||||
--it;
|
|
||||||
result = gson(*itr, *it);
|
|
||||||
if (!result.first)
|
if (!result.first)
|
||||||
{
|
{
|
||||||
error_string.append(result.second);
|
break;
|
||||||
objs->erase(it);
|
|
||||||
}
|
}
|
||||||
itr = node.next_child();
|
itr = node.next_child();
|
||||||
}
|
}
|
||||||
|
if(objs->size())
|
||||||
return std::make_pair(!!!objs->empty(), error_string);
|
{
|
||||||
|
delete *objs->begin();
|
||||||
|
objs->pop_front();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// vector
|
// vector
|
||||||
@ -922,7 +940,6 @@ static inline gson(acl::json_node &node, std::vector<T> *objs)
|
|||||||
{
|
{
|
||||||
std::pair<bool, std::string> result;
|
std::pair<bool, std::string> result;
|
||||||
acl::json_node *itr = node.first_child();
|
acl::json_node *itr = node.first_child();
|
||||||
std::string error_string;
|
|
||||||
|
|
||||||
while (itr)
|
while (itr)
|
||||||
{
|
{
|
||||||
@ -933,16 +950,17 @@ static inline gson(acl::json_node &node, std::vector<T> *objs)
|
|||||||
objs->push_back(obj);
|
objs->push_back(obj);
|
||||||
typename std::vector<T>::iterator it = objs->end();
|
typename std::vector<T>::iterator it = objs->end();
|
||||||
--it;
|
--it;
|
||||||
result = gson(*itr, *it);
|
result = gson(*itr, &*it);
|
||||||
if (!result.first)
|
if (!result.first)
|
||||||
{
|
{
|
||||||
error_string.append(result.second);
|
break;
|
||||||
objs->erase(it);
|
|
||||||
}
|
}
|
||||||
itr = node.next_child();
|
itr = node.next_child();
|
||||||
}
|
}
|
||||||
|
if(result.first)
|
||||||
return std::make_pair(!!!objs->empty(), error_string);
|
return result;
|
||||||
|
objs->clear();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// vector
|
// vector
|
||||||
@ -952,7 +970,6 @@ static inline gson(acl::json_node &node, std::vector<T*> *objs)
|
|||||||
{
|
{
|
||||||
std::pair<bool, std::string> result;
|
std::pair<bool, std::string> result;
|
||||||
acl::json_node *itr = node.first_child();
|
acl::json_node *itr = node.first_child();
|
||||||
std::string error_string;
|
|
||||||
|
|
||||||
while (itr)
|
while (itr)
|
||||||
{
|
{
|
||||||
@ -963,13 +980,78 @@ static inline gson(acl::json_node &node, std::vector<T*> *objs)
|
|||||||
result = gson(*itr, *it);
|
result = gson(*itr, *it);
|
||||||
if (!result.first)
|
if (!result.first)
|
||||||
{
|
{
|
||||||
error_string.append(result.second);
|
break;
|
||||||
objs->erase(it);
|
|
||||||
}
|
}
|
||||||
itr = node.next_child();
|
itr = node.next_child();
|
||||||
}
|
}
|
||||||
|
if(result.first)
|
||||||
|
return result;
|
||||||
|
|
||||||
return std::make_pair(!!!objs->empty(), error_string);
|
while(objs->size())
|
||||||
|
{
|
||||||
|
delete objs[0];
|
||||||
|
objs->pop_back();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//set
|
||||||
|
template<class T>
|
||||||
|
std::pair<bool, std::string>
|
||||||
|
static inline gson(acl::json_node &node, std::set<T*> *objs)
|
||||||
|
{
|
||||||
|
std::pair<bool, std::string> result;
|
||||||
|
acl::json_node *itr = node.first_child();
|
||||||
|
|
||||||
|
while (itr)
|
||||||
|
{
|
||||||
|
T* obj = new T;
|
||||||
|
result = gson(*itr, obj);
|
||||||
|
if (!result.first)
|
||||||
|
{
|
||||||
|
delete obj;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
objs->insert(obj);
|
||||||
|
itr = node.next_child();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.first)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
while(objs->size())
|
||||||
|
{
|
||||||
|
T* obj = *objs->begin();
|
||||||
|
objs->erase(objs->begin());
|
||||||
|
delete obj;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
std::pair<bool, std::string>
|
||||||
|
static inline gson(acl::json_node &node, std::set<T> *objs)
|
||||||
|
{
|
||||||
|
std::pair<bool, std::string> result;
|
||||||
|
acl::json_node *itr = node.first_child();
|
||||||
|
|
||||||
|
while (itr)
|
||||||
|
{
|
||||||
|
T obj;
|
||||||
|
result = gson(*itr, &obj);
|
||||||
|
if (!result.first)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
objs->insert(obj);
|
||||||
|
itr = node.next_child();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.first)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
objs->clear();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@ -1108,7 +1190,7 @@ static inline expand(acl::json_node &node, std::map<K, T*> *objs)
|
|||||||
for (typename std::map<K, T*>::iterator it = objs->begin();
|
for (typename std::map<K, T*>::iterator it = objs->begin();
|
||||||
it != objs->end(); ++it)
|
it != objs->end(); ++it)
|
||||||
{
|
{
|
||||||
del(it->second);
|
del(&it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
objs->clear();
|
objs->clear();
|
||||||
@ -1140,7 +1222,7 @@ static inline expand(acl::json_node &node, std::map<K, T*> *objs)
|
|||||||
for (typename std::map<K, T*>::iterator itr2 = objs->begin();
|
for (typename std::map<K, T*>::iterator itr2 = objs->begin();
|
||||||
itr2 != objs->end(); ++itr2)
|
itr2 != objs->end(); ++itr2)
|
||||||
{
|
{
|
||||||
del(itr2->second);
|
del(&itr2->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
objs->clear();
|
objs->clear();
|
||||||
|
@ -55,6 +55,7 @@ private:
|
|||||||
e_list,
|
e_list,
|
||||||
e_vector,
|
e_vector,
|
||||||
e_map,
|
e_map,
|
||||||
|
e_set,
|
||||||
e_object,
|
e_object,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -104,8 +105,8 @@ private:
|
|||||||
std::string get_node_func (const field_t &field);
|
std::string get_node_func (const field_t &field);
|
||||||
std::string get_gson_func_laber (const field_t &field);
|
std::string get_gson_func_laber (const field_t &field);
|
||||||
function_code_t gen_pack_code (const object_t &obj);
|
function_code_t gen_pack_code (const object_t &obj);
|
||||||
std::string get_unpack_code(const std::string &obj_name,
|
std::string get_unpack_code(const std::string &obj_name,
|
||||||
const field_t &field);
|
const field_t &field)const ;
|
||||||
std::string get_node_name(const std::string &name);
|
std::string get_node_name(const std::string &name);
|
||||||
std::string next_token(std::string delimiters);
|
std::string next_token(std::string delimiters);
|
||||||
std::string get_namespace();
|
std::string get_namespace();
|
||||||
@ -116,6 +117,7 @@ private:
|
|||||||
|
|
||||||
bool skip_space_comment();
|
bool skip_space_comment();
|
||||||
|
|
||||||
|
bool check_use_namespace();
|
||||||
bool check_namespace();
|
bool check_namespace();
|
||||||
bool check_namespace_end();
|
bool check_namespace_end();
|
||||||
bool check_struct_begin ();
|
bool check_struct_begin ();
|
||||||
|
@ -144,6 +144,7 @@ std::string gsoner::get_node_func(const field_t &field)
|
|||||||
case gsoner::field_t::e_vector:
|
case gsoner::field_t::e_vector:
|
||||||
case gsoner::field_t::e_map:
|
case gsoner::field_t::e_map:
|
||||||
case gsoner::field_t::e_object:
|
case gsoner::field_t::e_object:
|
||||||
|
case gsoner::field_t::e_set:
|
||||||
return "add_child";
|
return "add_child";
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -161,6 +162,7 @@ std::string gsoner::get_gson_func_laber(const field_t &field)
|
|||||||
case gsoner::field_t::e_list:
|
case gsoner::field_t::e_list:
|
||||||
case gsoner::field_t::e_vector:
|
case gsoner::field_t::e_vector:
|
||||||
case gsoner::field_t::e_map:
|
case gsoner::field_t::e_map:
|
||||||
|
case gsoner::field_t::e_set:
|
||||||
case gsoner::field_t::e_object:
|
case gsoner::field_t::e_object:
|
||||||
return "acl::gson($json, ";
|
return "acl::gson($json, ";
|
||||||
default:
|
default:
|
||||||
@ -248,7 +250,7 @@ gsoner::function_code_t gsoner::gen_pack_code(const object_t &obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string gsoner::get_unpack_code(const std::string &obj_name,
|
std::string gsoner::get_unpack_code(const std::string &obj_name,
|
||||||
const field_t &field)
|
const field_t &field)const
|
||||||
{
|
{
|
||||||
if (field.type_ == field_t::e_bool ||
|
if (field.type_ == field_t::e_bool ||
|
||||||
field.type_ == field_t::e_bool_ptr ||
|
field.type_ == field_t::e_bool_ptr ||
|
||||||
@ -336,9 +338,42 @@ gsoner::function_code_t gsoner::gen_unpack_code(const object_t &obj)
|
|||||||
code.definition_ptr_ += prefix + obj.name_ + " *$obj)";
|
code.definition_ptr_ += prefix + obj.name_ + " *$obj)";
|
||||||
code.definition_ptr_ += "\n{\n" + tab_ + "return gson($node, *$obj);\n}\n\n";
|
code.definition_ptr_ += "\n{\n" + tab_ + "return gson($node, *$obj);\n}\n\n";
|
||||||
|
|
||||||
|
code.declare2_ = "std::pair<bool,std::string> "
|
||||||
|
"gson(const acl::string &str, "+ obj.name_ +" &$obj);";
|
||||||
|
code.definition2_ = " std::pair<bool,std::string> "
|
||||||
|
"gson(const acl::string &$str, " + obj.name_ + " &$obj)\n"
|
||||||
|
"{\n"
|
||||||
|
+ tab_ + "acl::json _json;\n"
|
||||||
|
+ tab_ + "_json.update($str.c_str());\n"
|
||||||
|
+ tab_ + "if (!_json.finish())\n"
|
||||||
|
+ tab_ + "{\n"
|
||||||
|
+ tab_ + tab_ + "return std::make_pair(false, \"json not finish error\");\n"
|
||||||
|
+ tab_ + "}\n"
|
||||||
|
+ tab_ + "return gson(_json.get_root(), $obj);\n"
|
||||||
|
"}\n\n";
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool gsoner::check_use_namespace()
|
||||||
|
{
|
||||||
|
//using namespace xxx;
|
||||||
|
int pos = pos_;
|
||||||
|
std::string token = codes_.substr(pos_, strlen("using"));
|
||||||
|
if (token == "using")
|
||||||
|
{
|
||||||
|
pos_ += (int)strlen("using");
|
||||||
|
if(next_token(default_delimiters_) == "namespace")
|
||||||
|
{
|
||||||
|
token = next_token(default_delimiters_ + ";");
|
||||||
|
pos_++;//skip ;
|
||||||
|
std::cout << "find:using namespace " << token << std::endl;;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pos_ = pos;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool gsoner::check_namespace()
|
bool gsoner::check_namespace()
|
||||||
{
|
{
|
||||||
std::string temp = codes_.substr(pos_, strlen("namespace"));
|
std::string temp = codes_.substr(pos_, strlen("namespace"));
|
||||||
@ -1181,6 +1216,15 @@ bool gsoner::check_member()
|
|||||||
f.type_ = field_t::e_map;
|
f.type_ = field_t::e_map;
|
||||||
current_obj_.fields_.push_back(f);
|
current_obj_.fields_.push_back(f);
|
||||||
|
|
||||||
|
return true;;
|
||||||
|
}
|
||||||
|
else if(itr->find("set") != std::string::npos)
|
||||||
|
{
|
||||||
|
field_t f;
|
||||||
|
f.name_ = name;
|
||||||
|
f.type_ = field_t::e_set;
|
||||||
|
current_obj_.fields_.push_back(f);
|
||||||
|
|
||||||
return true;;
|
return true;;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1347,6 +1391,9 @@ void gsoner::parse_code()
|
|||||||
case 's':
|
case 's':
|
||||||
if(check_struct_begin())
|
if(check_struct_begin())
|
||||||
continue;
|
continue;
|
||||||
|
case 'u':
|
||||||
|
if (check_use_namespace())
|
||||||
|
continue;
|
||||||
default:
|
default:
|
||||||
if(check_function())
|
if(check_function())
|
||||||
continue;
|
continue;
|
||||||
@ -1428,12 +1475,40 @@ std::string gsoner::get_include_files()
|
|||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
static std::string get_filename_without_ext(std::string filename)
|
||||||
|
{
|
||||||
|
std::string result;
|
||||||
|
|
||||||
|
if (filename.empty())
|
||||||
|
return{};
|
||||||
|
|
||||||
|
std::size_t pos = filename.find_last_of('.');
|
||||||
|
if (pos != filename.npos)
|
||||||
|
filename = filename.substr(0, pos);
|
||||||
|
|
||||||
|
for(int i = (int)filename.size() -1; i >= 0; --i)
|
||||||
|
{
|
||||||
|
char ch = filename[i];
|
||||||
|
if (ch == '/' || ch == '\\')
|
||||||
|
break;
|
||||||
|
result += filename[i];
|
||||||
|
}
|
||||||
|
if (result.empty())
|
||||||
|
return{};
|
||||||
|
std::reverse(result.begin(), result.end());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
void gsoner::gen_gson()
|
void gsoner::gen_gson()
|
||||||
{
|
{
|
||||||
const char *namespace_start = "namespace acl\n{";
|
const char *namespace_start = "namespace acl\n{";
|
||||||
const char *namespace_end = "\n}///end of acl.\n";
|
const char *namespace_end = "\n}///end of acl.\n";
|
||||||
|
|
||||||
|
if(files_.size() == 1)
|
||||||
|
{
|
||||||
|
std::string filename = get_filename_without_ext(files_.front());
|
||||||
|
gen_header_filename_ = filename + ".gson.h";
|
||||||
|
gen_source_filename_ = filename + ".gson.cpp";
|
||||||
|
}
|
||||||
write_source("#include \"stdafx.h\"\n");
|
write_source("#include \"stdafx.h\"\n");
|
||||||
write_source(get_include_files());
|
write_source(get_include_files());
|
||||||
write_source("#include \"" + gen_header_filename_ + "\"\n");
|
write_source("#include \"" + gen_header_filename_ + "\"\n");
|
||||||
@ -1452,14 +1527,16 @@ void gsoner::gen_gson()
|
|||||||
write_header(('\n' + tab_ + pack.declare2_));
|
write_header(('\n' + tab_ + pack.declare2_));
|
||||||
write_header(('\n' + tab_ + pack.declare_));
|
write_header(('\n' + tab_ + pack.declare_));
|
||||||
write_header(('\n' + tab_ + pack.declare_ptr_));
|
write_header(('\n' + tab_ + pack.declare_ptr_));
|
||||||
write_header('\n' + tab_ + unpack.declare_);
|
write_header('\n' + tab_ + unpack.declare_);
|
||||||
write_header('\n' + tab_ + unpack.declare_ptr_);
|
write_header('\n' + tab_ + unpack.declare_ptr_);
|
||||||
|
write_header('\n' + tab_ + unpack.declare2_+"\n");
|
||||||
|
|
||||||
write_source(add_4space(pack.definition_));
|
write_source(add_4space(pack.definition_));
|
||||||
write_source(add_4space(pack.definition_ptr_));
|
write_source(add_4space(pack.definition_ptr_));
|
||||||
write_source(add_4space(pack.definition2_));
|
write_source(add_4space(pack.definition2_));
|
||||||
write_source(add_4space(unpack.definition_));
|
write_source(add_4space(unpack.definition_));
|
||||||
write_source(add_4space(unpack.definition_ptr_));
|
write_source(add_4space(unpack.definition_ptr_));
|
||||||
|
write_source(add_4space(unpack.definition2_));
|
||||||
}
|
}
|
||||||
|
|
||||||
write_header(namespace_end);
|
write_header(namespace_end);
|
||||||
@ -1613,3 +1690,4 @@ bool gsoner::check_pragma()
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace acl
|
} // namespace acl
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user