Skip to content

Commit 6fd54f1

Browse files
committed
Created solution for vs2013
Added bool support
1 parent 435e0eb commit 6fd54f1

File tree

10 files changed

+260
-1
lines changed

10 files changed

+260
-1
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ project/vs2012/JsonCreator/Release/
66
project/vs2012/UnitTests/Release/
77
project/vs2012/UnitTests/UnitTests.vcxproj.user
88
project/vs2012/JsonCreator.v11.suo
9+
project/vs2013/Debug/
10+
project/vs2013/JsonCreator/Debug/
11+
project/vs2013/UnitTests/Debug/
12+
project/vs2013/UnitTests/UnitTests.vcxproj.user

include/JsonCreator/Object.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ namespace JsonCreator
5858
this->GetWriter()->Int(value);
5959
}
6060

61+
void AddBool(const char *name, bool value)
62+
{
63+
this->StartAttribute(name);
64+
65+
this->GetWriter()->Bool(value);
66+
}
67+
6168
Object AddObject(const char *name)
6269
{
6370
this->StartAttribute(name);

include/JsonCreator/StringWriter.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ namespace JsonCreator
111111
return *this;
112112
}
113113

114+
StringWriter &Bool(bool value)
115+
{
116+
m_clWriter.Bool(value);
117+
118+
return *this;
119+
}
120+
114121
private:
115122
rapidjson::Writer<rapidjson::StringBuffer> m_clWriter;
116123
};

project/vs2013/JsonCreator.sln

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Express 2012 for Windows Desktop
4+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JsonCreator", "JsonCreator\JsonCreator.vcxproj", "{AF571A90-2DC4-411B-A691-301A9E865615}"
5+
EndProject
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\UnitTests.vcxproj", "{4C7C8875-D40D-4812-BC81-44EF16E9D9F2}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Win32 = Debug|Win32
11+
Release|Win32 = Release|Win32
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{AF571A90-2DC4-411B-A691-301A9E865615}.Debug|Win32.ActiveCfg = Debug|Win32
15+
{AF571A90-2DC4-411B-A691-301A9E865615}.Debug|Win32.Build.0 = Debug|Win32
16+
{AF571A90-2DC4-411B-A691-301A9E865615}.Release|Win32.ActiveCfg = Release|Win32
17+
{AF571A90-2DC4-411B-A691-301A9E865615}.Release|Win32.Build.0 = Release|Win32
18+
{4C7C8875-D40D-4812-BC81-44EF16E9D9F2}.Debug|Win32.ActiveCfg = Debug|Win32
19+
{4C7C8875-D40D-4812-BC81-44EF16E9D9F2}.Debug|Win32.Build.0 = Debug|Win32
20+
{4C7C8875-D40D-4812-BC81-44EF16E9D9F2}.Release|Win32.ActiveCfg = Release|Win32
21+
{4C7C8875-D40D-4812-BC81-44EF16E9D9F2}.Release|Win32.Build.0 = Release|Win32
22+
EndGlobalSection
23+
GlobalSection(SolutionProperties) = preSolution
24+
HideSolutionNode = FALSE
25+
EndGlobalSection
26+
EndGlobal

project/vs2013/JsonCreator.v12.suo

17 KB
Binary file not shown.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<ClInclude Include="..\..\..\include\JsonCreator\Array.h" />
15+
<ClInclude Include="..\..\..\include\JsonCreator\BaseValue.h" />
16+
<ClInclude Include="..\..\..\include\JsonCreator\Defs.h" />
17+
<ClInclude Include="..\..\..\include\JsonCreator\Object.h" />
18+
<ClInclude Include="..\..\..\include\JsonCreator\StringWriter.h" />
19+
<ClInclude Include="..\..\..\include\JsonCreator\StringWriterFwd.h" />
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<ProjectGuid>{AF571A90-2DC4-411B-A691-301A9E865615}</ProjectGuid>
23+
<Keyword>Win32Proj</Keyword>
24+
<RootNamespace>JsonCreator</RootNamespace>
25+
</PropertyGroup>
26+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
27+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
28+
<ConfigurationType>StaticLibrary</ConfigurationType>
29+
<UseDebugLibraries>true</UseDebugLibraries>
30+
<PlatformToolset>v120</PlatformToolset>
31+
<CharacterSet>Unicode</CharacterSet>
32+
</PropertyGroup>
33+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
34+
<ConfigurationType>StaticLibrary</ConfigurationType>
35+
<UseDebugLibraries>false</UseDebugLibraries>
36+
<PlatformToolset>v120</PlatformToolset>
37+
<WholeProgramOptimization>true</WholeProgramOptimization>
38+
<CharacterSet>Unicode</CharacterSet>
39+
</PropertyGroup>
40+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
41+
<ImportGroup Label="ExtensionSettings">
42+
</ImportGroup>
43+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
44+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
45+
</ImportGroup>
46+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
47+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
48+
</ImportGroup>
49+
<PropertyGroup Label="UserMacros" />
50+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
51+
<IncludePath>$(RAPID_JSON_HOME)\include;$(IncludePath)</IncludePath>
52+
</PropertyGroup>
53+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
54+
<ClCompile>
55+
<PrecompiledHeader>
56+
</PrecompiledHeader>
57+
<WarningLevel>Level3</WarningLevel>
58+
<Optimization>Disabled</Optimization>
59+
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
60+
<SDLCheck>true</SDLCheck>
61+
</ClCompile>
62+
<Link>
63+
<SubSystem>Windows</SubSystem>
64+
<GenerateDebugInformation>true</GenerateDebugInformation>
65+
</Link>
66+
</ItemDefinitionGroup>
67+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
68+
<ClCompile>
69+
<WarningLevel>Level3</WarningLevel>
70+
<PrecompiledHeader>
71+
</PrecompiledHeader>
72+
<Optimization>MaxSpeed</Optimization>
73+
<FunctionLevelLinking>true</FunctionLevelLinking>
74+
<IntrinsicFunctions>true</IntrinsicFunctions>
75+
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
76+
<SDLCheck>true</SDLCheck>
77+
</ClCompile>
78+
<Link>
79+
<SubSystem>Windows</SubSystem>
80+
<GenerateDebugInformation>true</GenerateDebugInformation>
81+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
82+
<OptimizeReferences>true</OptimizeReferences>
83+
</Link>
84+
</ItemDefinitionGroup>
85+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
86+
<ImportGroup Label="ExtensionTargets">
87+
</ImportGroup>
88+
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Resource Files">
5+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
6+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
7+
</Filter>
8+
</ItemGroup>
9+
<ItemGroup>
10+
<ClInclude Include="..\..\..\include\JsonCreator\Array.h" />
11+
<ClInclude Include="..\..\..\include\JsonCreator\BaseValue.h" />
12+
<ClInclude Include="..\..\..\include\JsonCreator\Defs.h" />
13+
<ClInclude Include="..\..\..\include\JsonCreator\Object.h" />
14+
<ClInclude Include="..\..\..\include\JsonCreator\StringWriter.h" />
15+
<ClInclude Include="..\..\..\include\JsonCreator\StringWriterFwd.h" />
16+
</ItemGroup>
17+
</Project>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<PropertyGroup Label="Globals">
14+
<ProjectGuid>{4C7C8875-D40D-4812-BC81-44EF16E9D9F2}</ProjectGuid>
15+
<Keyword>Win32Proj</Keyword>
16+
<RootNamespace>UnitTests</RootNamespace>
17+
</PropertyGroup>
18+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
20+
<ConfigurationType>Application</ConfigurationType>
21+
<UseDebugLibraries>true</UseDebugLibraries>
22+
<PlatformToolset>v120</PlatformToolset>
23+
<CharacterSet>Unicode</CharacterSet>
24+
</PropertyGroup>
25+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
26+
<ConfigurationType>Application</ConfigurationType>
27+
<UseDebugLibraries>false</UseDebugLibraries>
28+
<PlatformToolset>v120</PlatformToolset>
29+
<WholeProgramOptimization>true</WholeProgramOptimization>
30+
<CharacterSet>Unicode</CharacterSet>
31+
</PropertyGroup>
32+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
33+
<ImportGroup Label="ExtensionSettings">
34+
</ImportGroup>
35+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
36+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
37+
</ImportGroup>
38+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
39+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
40+
</ImportGroup>
41+
<PropertyGroup Label="UserMacros" />
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
43+
<LinkIncremental>true</LinkIncremental>
44+
<IncludePath>$(SolutionDir)\..\..\include;$(RAPID_JSON_HOME)\include;$(IncludePath)</IncludePath>
45+
</PropertyGroup>
46+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
47+
<LinkIncremental>false</LinkIncremental>
48+
<IncludePath>$(SolutionDir)\..\..\include;$(RAPID_JSON_HOME)\include;$(IncludePath)</IncludePath>
49+
</PropertyGroup>
50+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
51+
<ClCompile>
52+
<PrecompiledHeader>
53+
</PrecompiledHeader>
54+
<WarningLevel>Level3</WarningLevel>
55+
<Optimization>Disabled</Optimization>
56+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
57+
</ClCompile>
58+
<Link>
59+
<SubSystem>Console</SubSystem>
60+
<GenerateDebugInformation>true</GenerateDebugInformation>
61+
</Link>
62+
</ItemDefinitionGroup>
63+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<ClCompile>
65+
<WarningLevel>Level3</WarningLevel>
66+
<PrecompiledHeader>
67+
</PrecompiledHeader>
68+
<Optimization>MaxSpeed</Optimization>
69+
<FunctionLevelLinking>true</FunctionLevelLinking>
70+
<IntrinsicFunctions>true</IntrinsicFunctions>
71+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
72+
</ClCompile>
73+
<Link>
74+
<SubSystem>Console</SubSystem>
75+
<GenerateDebugInformation>true</GenerateDebugInformation>
76+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
77+
<OptimizeReferences>true</OptimizeReferences>
78+
</Link>
79+
</ItemDefinitionGroup>
80+
<ItemGroup>
81+
<ClCompile Include="..\..\..\src\UnitTests\main.cpp" />
82+
</ItemGroup>
83+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
84+
<ImportGroup Label="ExtensionTargets">
85+
</ImportGroup>
86+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="..\..\..\src\UnitTests\main.cpp">
19+
<Filter>Source Files</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
</Project>

src/UnitTests/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ BOOST_AUTO_TEST_CASE(NestedObject)
5151
address.AddStringValue("street", "Blah");
5252
address.AddStringValue("city", "Mordor");
5353
address.AddIntValue("number", 353);
54+
address.AddBool("valid", true);
55+
address.AddBool("home", false);
5456
}
5557

5658
obj.AddStringValue("age", "2");
5759

5860
obj.AddObject("empty");
5961
}
6062

61-
BOOST_CHECK(strcmp(writer.GetString(), "{\"name\":\"bcs\",\"address\":{\"street\":\"Blah\",\"city\":\"Mordor\",\"number\":353},\"age\":\"2\",\"empty\":{}}") == 0);
63+
BOOST_CHECK(strcmp(writer.GetString(), "{\"name\":\"bcs\",\"address\":{\"street\":\"Blah\",\"city\":\"Mordor\",\"number\":353,\"valid\":true,\"home\":false},\"age\":\"2\",\"empty\":{}}") == 0);
6264
}
6365

6466
BOOST_AUTO_TEST_CASE(ObjectWithArray)

0 commit comments

Comments
 (0)