@@ -23,10 +23,13 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="Common.h" />
<ClInclude Include="Document\Document.h" />
<ClInclude Include="Document\DocumentPath.h" />
<ClInclude Include="Reflection\Reflection.h" />
<ClInclude Include="Reflection\ReflectionJson.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Document\DocumentPath.cpp" />
<ClCompile Include="Reflection\TypeDatabase.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
@@ -7,6 +7,9 @@
<Filter Include="Reflection">
<UniqueIdentifier>{82f4cc32-a3ee-4696-86bd-d263f8bb9ad3}</UniqueIdentifier>
</Filter>
<Filter Include="Document">
<UniqueIdentifier>{42b140c8-cc5b-46d9-a9fb-feef0c3c7f84}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Reflection\Reflection.h">
@@ -16,10 +19,19 @@
<ClInclude Include="Reflection\ReflectionJson.h">
<Filter>Reflection</Filter>
</ClInclude>
<ClInclude Include="Document\Document.h">
<Filter>Document</Filter>
</ClInclude>
<ClInclude Include="Document\DocumentPath.h">
<Filter>Document</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Reflection\TypeDatabase.cpp">
<Filter>Reflection</Filter>
</ClCompile>
<ClCompile Include="Document\DocumentPath.cpp">
<Filter>Document</Filter>
</ClCompile>
</ItemGroup>
</Project>
@@ -1,13 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25029.0
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Foundation", "Foundation\Foundation.vcxproj", "{39856B1A-B463-4D99-9859-74912E1C6D00}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "External", "External\External.vcxproj", "{F2C9910C-3E6E-4752-A69E-810CC743BC10}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\UnitTests.vcxproj", "{78903FAA-D030-4287-AF7D-980A26193FE6}"
ProjectSection(ProjectDependencies) = postProject
{39856B1A-B463-4D99-9859-74912E1C6D00} = {39856B1A-B463-4D99-9859-74912E1C6D00}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Data", "Data\Data.vcxproj", "{A9EBCF0F-5C76-4487-AC43-A09536E31735}"
EndProject
@@ -1,5 +1,3 @@
// UnitTests.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <vector>
@@ -9,6 +7,8 @@
#include "Foundation\Reflection\Reflection.h"
#include "Foundation\Reflection\ReflectionJson.h"

#include "Foundation\Document\DocumentPath.h"

REFL_ENUM(TestEnum, int, kA, kB, kC);

struct Inventory
@@ -43,16 +43,39 @@ struct Person
)
};

template <class T>
void TEST(T & t, bool expect_exception = false)
{
try
{
bool val = t();
if (expect_exception)
{
assert(false);
}

assert(val);
}
catch (std::exception & ex)
{
assert(false);
}
}

int main()
{
Person p("Tom", 82);
p.e = TestEnum::kC;
auto a = []() { DocumentPath p("a.a"); return p.GetSize() == 2 && p[0].m_Data == "a" && p[0].m_Type == DocumentPath::kFieldName; };

TEST(a);

//Person p("Tom", 82);
//p.e = TestEnum::kC;

nlohmann::json json_value = encode_json(p);
std::cout << json_value.dump(2);
//nlohmann::json json_value = encode_json(p);
//std::cout << json_value.dump(2);

Person copy("", 0);
decode_json(copy, json_value);
//Person copy("", 0);
//decode_json(copy, json_value);

return 0;
}