Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'origin/feature-json-refcount' into develop

  • Loading branch information...
commit 25311c7eed80068b6abeb872582a8a216bb0b3f8 2 parents 0fe58b7 + 0d79572
@aleks-f aleks-f authored
View
3  CHANGELOG
@@ -25,8 +25,7 @@ Release 1.5.2 (2013-03-??)
- fixed GH #124: Possible buffer overrun in Foundation/EventLogChannel
- fixed GH #119: JSON::Object holds values in ordered map
- added JSON::PrintHandler
-- renamed JSON::DefaultHandler to ParseHandler
-- redefined JSON::DefaultHandler as typedef to ParseHandler
+- renamed JSON::DefaultHandler to ParseHandler (breaking change!)
- fixed GH #127: Eliminate -Wshadow warnings
- fixed GH #79: Poco::Thread leak on Linux
- fixed GH #61: static_md build configs for Crypto and NetSSL
View
2  JSON/JSON_CE_vs90.vcproj
@@ -458,8 +458,6 @@
<File
RelativePath=".\include\Poco\JSON\Array.h"/>
<File
- RelativePath=".\include\Poco\JSON\DefaultHandler.h"/>
- <File
RelativePath=".\include\Poco\JSON\Handler.h"/>
<File
RelativePath=".\include\Poco\JSON\JSON.h"/>
View
1  JSON/JSON_vs100.vcxproj
@@ -268,7 +268,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="include\Poco\JSON\Array.h" />
- <ClInclude Include="include\Poco\JSON\DefaultHandler.h" />
<ClInclude Include="include\Poco\JSON\Handler.h" />
<ClInclude Include="include\Poco\JSON\JSON.h" />
<ClInclude Include="include\Poco\JSON\JSONException.h" />
View
3  JSON/JSON_vs100.vcxproj.filters
@@ -12,9 +12,6 @@
<ClInclude Include="include\Poco\JSON\Array.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="include\Poco\JSON\DefaultHandler.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="include\Poco\JSON\Handler.h">
<Filter>Header Files</Filter>
</ClInclude>
View
169 JSON/JSON_vs110.vcxproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug_shared|Win32">
@@ -32,82 +32,82 @@
<RootNamespace>JSON</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;" Label="Configuration">
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
- <ImportGroup Label="ExtensionSettings"/>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings" />
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">..\bin\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">obj\$(Configuration)\</IntDir>
- <LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">true</LinkIncremental>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">..\bin\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">obj\$(Configuration)\</IntDir>
- <LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">false</LinkIncremental>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">..\lib\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">obj\$(Configuration)\</IntDir>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">..\lib\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">obj\$(Configuration)\</IntDir>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">..\lib\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">obj\$(Configuration)\</IntDir>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">..\lib\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">obj\$(Configuration)\</IntDir>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">PocoJSONd</TargetName>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">PocoJSONmdd</TargetName>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">PocoJSONmtd</TargetName>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">PocoJSON</TargetName>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">PocoJSONmd</TargetName>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">PocoJSONmt</TargetName>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">..\bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">obj\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">..\bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">obj\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">..\lib\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">obj\$(Configuration)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">..\lib\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">obj\$(Configuration)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">..\lib\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">obj\$(Configuration)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">..\lib\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">obj\$(Configuration)\</IntDir>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">PocoJSONd</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">PocoJSONmdd</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">PocoJSONmtd</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">PocoJSON</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">PocoJSONmd</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">PocoJSONmt</TargetName>
</PropertyGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -120,7 +120,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@@ -138,7 +138,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@@ -153,9 +153,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat/>
+ <DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -172,7 +172,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -185,7 +185,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<ProgramDataBaseFileName>..\lib\PocoJSONmtd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
@@ -196,7 +196,7 @@
<OutputFile>..\lib\PocoJSONmtd.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@@ -211,9 +211,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat/>
+ <DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -221,7 +221,7 @@
<OutputFile>..\lib\PocoJSONmt.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -234,7 +234,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<ProgramDataBaseFileName>..\lib\PocoJSONmdd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
@@ -245,7 +245,7 @@
<OutputFile>..\lib\PocoJSONmdd.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@@ -260,10 +260,10 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<ProgramDataBaseFileName>..\lib\PocoJSONmd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat/>
+ <DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -273,33 +273,32 @@
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="src\Array.cpp"/>
- <ClCompile Include="src\ParseHandler.cpp"/>
- <ClCompile Include="src\Handler.cpp"/>
- <ClCompile Include="src\JSONException.cpp"/>
- <ClCompile Include="src\Object.cpp"/>
- <ClCompile Include="src\Parser.cpp"/>
- <ClCompile Include="src\PrintHandler.cpp"/>
- <ClCompile Include="src\Query.cpp"/>
- <ClCompile Include="src\Stringifier.cpp"/>
- <ClCompile Include="src\Template.cpp"/>
- <ClCompile Include="src\TemplateCache.cpp"/>
+ <ClCompile Include="src\Array.cpp" />
+ <ClCompile Include="src\ParseHandler.cpp" />
+ <ClCompile Include="src\Handler.cpp" />
+ <ClCompile Include="src\JSONException.cpp" />
+ <ClCompile Include="src\Object.cpp" />
+ <ClCompile Include="src\Parser.cpp" />
+ <ClCompile Include="src\PrintHandler.cpp" />
+ <ClCompile Include="src\Query.cpp" />
+ <ClCompile Include="src\Stringifier.cpp" />
+ <ClCompile Include="src\Template.cpp" />
+ <ClCompile Include="src\TemplateCache.cpp" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="include\Poco\JSON\Array.h"/>
- <ClInclude Include="include\Poco\JSON\DefaultHandler.h"/>
- <ClInclude Include="include\Poco\JSON\Handler.h"/>
- <ClInclude Include="include\Poco\JSON\JSON.h"/>
- <ClInclude Include="include\Poco\JSON\JSONException.h"/>
- <ClInclude Include="include\Poco\JSON\Object.h"/>
- <ClInclude Include="include\Poco\JSON\Parser.h"/>
- <ClInclude Include="include\Poco\JSON\ParseHandler.h"/>
- <ClInclude Include="include\Poco\JSON\PrintHandler.h"/>
- <ClInclude Include="include\Poco\JSON\Query.h"/>
- <ClInclude Include="include\Poco\JSON\Stringifier.h"/>
- <ClInclude Include="include\Poco\JSON\Template.h"/>
- <ClInclude Include="include\Poco\JSON\TemplateCache.h"/>
+ <ClInclude Include="include\Poco\JSON\Array.h" />
+ <ClInclude Include="include\Poco\JSON\Handler.h" />
+ <ClInclude Include="include\Poco\JSON\JSON.h" />
+ <ClInclude Include="include\Poco\JSON\JSONException.h" />
+ <ClInclude Include="include\Poco\JSON\Object.h" />
+ <ClInclude Include="include\Poco\JSON\Parser.h" />
+ <ClInclude Include="include\Poco\JSON\ParseHandler.h" />
+ <ClInclude Include="include\Poco\JSON\PrintHandler.h" />
+ <ClInclude Include="include\Poco\JSON\Query.h" />
+ <ClInclude Include="include\Poco\JSON\Stringifier.h" />
+ <ClInclude Include="include\Poco\JSON\Template.h" />
+ <ClInclude Include="include\Poco\JSON\TemplateCache.h" />
</ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
- <ImportGroup Label="ExtensionTargets"/>
-</Project>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets" />
+</Project>
View
3  JSON/JSON_vs110.vcxproj.filters
@@ -47,9 +47,6 @@
<ClInclude Include="include\Poco\JSON\Array.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="include\Poco\JSON\DefaultHandler.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="include\Poco\JSON\Handler.h">
<Filter>Header Files</Filter>
</ClInclude>
View
2  JSON/JSON_vs71.vcproj
@@ -390,8 +390,6 @@
<File
RelativePath=".\include\Poco\JSON\Array.h"/>
<File
- RelativePath=".\include\Poco\JSON\DefaultHandler.h"/>
- <File
RelativePath=".\include\Poco\JSON\Handler.h"/>
<File
RelativePath=".\include\Poco\JSON\JSON.h"/>
View
2  JSON/JSON_vs80.vcproj
@@ -411,8 +411,6 @@
<File
RelativePath=".\include\Poco\JSON\Array.h"/>
<File
- RelativePath=".\include\Poco\JSON\DefaultHandler.h"/>
- <File
RelativePath=".\include\Poco\JSON\Handler.h"/>
<File
RelativePath=".\include\Poco\JSON\JSON.h"/>
View
2  JSON/JSON_vs90.vcproj
@@ -410,8 +410,6 @@
<File
RelativePath=".\include\Poco\JSON\Array.h"/>
<File
- RelativePath=".\include\Poco\JSON\DefaultHandler.h"/>
- <File
RelativePath=".\include\Poco\JSON\Handler.h"/>
<File
RelativePath=".\include\Poco\JSON\JSON.h"/>
View
1  JSON/JSON_x64_vs100.vcxproj
@@ -285,7 +285,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Poco\JSON\Array.h"/>
- <ClInclude Include="include\Poco\JSON\DefaultHandler.h"/>
<ClInclude Include="include\Poco\JSON\Handler.h"/>
<ClInclude Include="include\Poco\JSON\JSON.h"/>
<ClInclude Include="include\Poco\JSON\JSONException.h"/>
View
3  JSON/JSON_x64_vs100.vcxproj.filters
@@ -47,9 +47,6 @@
<ClInclude Include="include\Poco\JSON\Array.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="include\Poco\JSON\DefaultHandler.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="include\Poco\JSON\Handler.h">
<Filter>Header Files</Filter>
</ClInclude>
View
1  JSON/JSON_x64_vs110.vcxproj
@@ -285,7 +285,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Poco\JSON\Array.h"/>
- <ClInclude Include="include\Poco\JSON\DefaultHandler.h"/>
<ClInclude Include="include\Poco\JSON\Handler.h"/>
<ClInclude Include="include\Poco\JSON\JSON.h"/>
<ClInclude Include="include\Poco\JSON\JSONException.h"/>
View
3  JSON/JSON_x64_vs110.vcxproj.filters
@@ -47,9 +47,6 @@
<ClInclude Include="include\Poco\JSON\Array.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="include\Poco\JSON\DefaultHandler.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="include\Poco\JSON\Handler.h">
<Filter>Header Files</Filter>
</ClInclude>
View
2  JSON/JSON_x64_vs90.vcproj
@@ -415,8 +415,6 @@
<File
RelativePath=".\include\Poco\JSON\Array.h"/>
<File
- RelativePath=".\include\Poco\JSON\DefaultHandler.h"/>
- <File
RelativePath=".\include\Poco\JSON\Handler.h"/>
<File
RelativePath=".\include\Poco\JSON\JSON.h"/>
View
57 JSON/include/Poco/JSON/DefaultHandler.h
@@ -1,57 +0,0 @@
-//
-// DefaultHandler.h
-//
-// $Id$
-//
-// Library: JSON
-// Package: JSON
-// Module: DefaultHandler
-//
-// Definition of the DefaultHandler class.
-//
-// Copyright (c) 2012, Applied Informatics Software Engineering GmbH.
-// and Contributors.
-//
-// Permission is hereby granted, free of charge, to any person or organization
-// obtaining a copy of the software and accompanying documentation covered by
-// this license (the "Software") to use, reproduce, display, distribute,
-// execute, and transmit the Software, and to prepare derivative works of the
-// Software, and to permit third-parties to whom the Software is furnished to
-// do so, all subject to the following:
-//
-// The copyright notices in the Software and this entire statement, including
-// the above license grant, this restriction and the following disclaimer,
-// must be included in all copies of the Software, in whole or in part, and
-// all derivative works of the Software, unless such copies or derivative
-// works are solely in the form of machine-executable object code generated by
-// a source language processor.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-//
-
-
-#ifndef JSON_DefaultHandler_INCLUDED
-#define JSON_DefaultHandler_INCLUDED
-
-
-#include "Poco/JSON/ParseHandler.h"
-
-
-namespace Poco {
-namespace JSON {
-
-
-//@deprecated
-typedef ParseHandler DefaultHandler;
-
-
-}} // namespace Poco::JSON
-
-
-#endif // JSON_DefaultHandler_INCLUDED
View
15 JSON/include/Poco/JSON/Handler.h
@@ -41,6 +41,7 @@
#include "Poco/JSON/JSON.h"
+#include "Poco/SharedPtr.h"
#include "Poco/Dynamic/Var.h"
@@ -51,8 +52,13 @@ namespace JSON {
class JSON_API Handler
{
public:
+ typedef SharedPtr<Handler> Ptr;
+
Handler();
/// Constructor;
+
+ virtual ~Handler();
+ /// Destructor
virtual void startObject() = 0;
/// The parser has read a {, meaning a new object will be read
@@ -100,12 +106,9 @@ class JSON_API Handler
virtual void comma();
/// A comma is read
-protected:
-
- virtual ~Handler();
- /// Destructor
-
-private:
+ virtual Dynamic::Var result() const;
+ /// Returns the result of the parser (an object, array or string),
+ /// empty Var if there is no result.
};
View
1  JSON/include/Poco/JSON/ParseHandler.h
@@ -54,7 +54,6 @@ class JSON_API ParseHandler : public Handler
/// on the handlers called by the parser.
{
public:
-
ParseHandler(bool preserveObjectOrder = false);
/// Creates the ParseHandler.
View
35 JSON/include/Poco/JSON/Parser.h
@@ -43,7 +43,7 @@
#include "Poco/JSON/JSON.h"
#include "Poco/JSON/Object.h"
#include "Poco/JSON/Array.h"
-#include "Poco/JSON/Handler.h"
+#include "Poco/JSON/ParseHandler.h"
#include "Poco/Dynamic/Var.h"
#include "Poco/StreamTokenizer.h"
#include <istream>
@@ -59,24 +59,27 @@ class JSON_API Parser
{
public:
- Parser();
+ Parser(const Handler::Ptr& pHandler = new ParseHandler);
/// Constructor.
virtual ~Parser();
/// Destructor.
- void parse(const std::string& source);
+ Dynamic::Var parse(const std::string& source);
/// Parses a string.
- void parse(std::istream& in);
+ Dynamic::Var parse(std::istream& in);
/// Parses a JSON from the input stream.
- void setHandler(Handler* handler);
+ void setHandler(const Handler::Ptr& pHandler);
/// Set the handler.
- Handler* getHandler();
+ const Handler::Ptr& getHandler();
/// Returns the handler.
+ Dynamic::Var result() const;
+ /// Returns the result of parsing;
+
private:
const Token* nextToken();
/// Returns the next token.
@@ -97,26 +100,32 @@ class JSON_API Parser
/// Read all elements of an array.
StreamTokenizer _tokenizer;
- Handler* _handler;
+ Handler::Ptr _pHandler;
};
-inline void Parser::parse(const std::string& source)
+inline Dynamic::Var Parser::parse(const std::string& source)
{
std::istringstream is(source);
- parse(is);
+ return parse(is);
+}
+
+
+inline void Parser::setHandler(const Handler::Ptr& pHandler)
+{
+ _pHandler = pHandler;
}
-inline void Parser::setHandler(Handler* handler)
+inline const Handler::Ptr& Parser::getHandler()
{
- _handler = handler;
+ return _pHandler;
}
-inline Handler* Parser::getHandler()
+inline Dynamic::Var Parser::result() const
{
- return _handler;
+ return _pHandler->result();
}
View
14 JSON/include/Poco/JSON/PrintHandler.h
@@ -55,6 +55,8 @@ class JSON_API PrintHandler : public Handler
/// otherwise, the proper indentation is applied to elements.
{
public:
+ typedef SharedPtr<PrintHandler> Ptr;
+
static const unsigned JSON_PRINT_FLAT = 0;
PrintHandler(unsigned indent = 0);
@@ -115,10 +117,8 @@ class JSON_API PrintHandler : public Handler
void comma();
/// A comma is read; it will be written to the output as "true" or "false".
- void setIndent(unsigned indent)
- {
- _indent = indent;
- }
+ void setIndent(unsigned indent);
+ /// Sets indentation.
private:
@@ -133,6 +133,12 @@ class JSON_API PrintHandler : public Handler
};
+inline void PrintHandler::setIndent(unsigned indent)
+{
+ _indent = indent;
+}
+
+
}} // namespace Poco::JSON
View
6 JSON/src/Handler.cpp
@@ -57,4 +57,10 @@ void Handler::comma()
}
+Dynamic::Var Handler::result() const
+{
+ return Dynamic::Var();
+}
+
+
} } // namespace Poco::JSON
View
64 JSON/src/Parser.cpp
@@ -484,7 +484,7 @@ class NumberToken: public Token
};
-Parser::Parser() : _tokenizer(), _handler(NULL)
+Parser::Parser(const Handler::Ptr& pHandler) : _tokenizer(), _pHandler(pHandler)
{
_tokenizer.addToken(new WhitespaceToken());
_tokenizer.addToken(new InvalidToken());
@@ -512,7 +512,7 @@ const Token* Parser::nextToken()
}
-void Parser::parse(std::istream& in)
+Dynamic::Var Parser::parse(std::istream& in)
{
_tokenizer.attachToStream(in);
const Token* token = nextToken();
@@ -542,14 +542,16 @@ void Parser::parse(std::istream& in)
{
throw JSONException(format("Invalid token '%s' found. Expecting { or [", token->asString()));
}
+
+ return result();
}
void Parser::readObject()
{
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->startObject();
+ _pHandler->startObject();
}
if ( readRow(true) ) // First call is special: check for empty object
@@ -557,9 +559,9 @@ void Parser::readObject()
while(readRow());
}
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->endObject();
+ _pHandler->endObject();
}
}
@@ -576,9 +578,9 @@ bool Parser::readRow(bool firstCall)
if (token->tokenClass() == Token::STRING_LITERAL_TOKEN)
{
std::string propertyName = token->tokenString();
- if ( _handler != NULL )
+ if ( !_pHandler.isNull() )
{
- _handler->key(propertyName);
+ _pHandler->key(propertyName);
}
token = nextToken();
@@ -594,9 +596,9 @@ bool Parser::readRow(bool firstCall)
{
if (token->asChar() == ',')
{
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->comma();
+ _pHandler->comma();
}
return true; // Read next row
}
@@ -637,7 +639,7 @@ void Parser::readValue(const Token* token)
break;
case Token::INTEGER_LITERAL_TOKEN:
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
#if defined(POCO_HAVE_INT64)
try
@@ -647,11 +649,11 @@ void Parser::readValue(const Token* token)
if ( value > std::numeric_limits<int>::max()
|| value < std::numeric_limits<int>::min() )
{
- _handler->value(value);
+ _pHandler->value(value);
}
else
{
- _handler->value(static_cast<int>(value));
+ _pHandler->value(static_cast<int>(value));
}
}
// try to handle error as unsigned in case of overflow
@@ -661,11 +663,11 @@ void Parser::readValue(const Token* token)
// if number is 32-bit, then handle as such
if ( value > std::numeric_limits<unsigned>::max() )
{
- _handler->value(value);
+ _pHandler->value(value);
}
else
{
- _handler->value(static_cast<unsigned>(value));
+ _pHandler->value(static_cast<unsigned>(value));
}
}
#else
@@ -687,23 +689,23 @@ void Parser::readValue(const Token* token)
{
if (token->tokenString().compare("null") == 0)
{
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->null();
+ _pHandler->null();
}
}
else if (token->tokenString().compare("true") == 0)
{
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->value(true);
+ _pHandler->value(true);
}
}
else if (token->tokenString().compare("false") == 0)
{
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->value(false);
+ _pHandler->value(false);
}
}
else
@@ -715,15 +717,15 @@ void Parser::readValue(const Token* token)
case Token::FLOAT_LITERAL_TOKEN:
// Fall through
case Token::DOUBLE_LITERAL_TOKEN:
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->value(token->asFloat());
+ _pHandler->value(token->asFloat());
}
break;
case Token::STRING_LITERAL_TOKEN:
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->value(token->tokenString());
+ _pHandler->value(token->tokenString());
}
break;
case Token::SEPARATOR_TOKEN:
@@ -746,9 +748,9 @@ void Parser::readValue(const Token* token)
void Parser::readArray()
{
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->startArray();
+ _pHandler->startArray();
}
if (readElements(true)) // First call is special: check for empty array
@@ -756,9 +758,9 @@ void Parser::readArray()
while(readElements());
}
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->endArray();
+ _pHandler->endArray();
}
}
@@ -784,9 +786,9 @@ bool Parser::readElements(bool firstCall)
if (token->asChar() == ',')
{
- if (_handler != NULL)
+ if (!_pHandler.isNull())
{
- _handler->comma();
+ _pHandler->comma();
}
return true;
}
View
176 JSON/testsuite/src/JSONTest.cpp
@@ -88,10 +88,7 @@ void JSONTest::testNullProperty()
Var result;
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -115,10 +112,7 @@ void JSONTest::testTrueProperty()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -144,10 +138,7 @@ void JSONTest::testFalseProperty()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -173,10 +164,7 @@ void JSONTest::testNumberProperty()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -203,10 +191,7 @@ void JSONTest::testUnsignedNumberProperty()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -234,10 +219,7 @@ void JSONTest::testNumber64Property()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -264,10 +246,7 @@ void JSONTest::testUnsignedNumber64Property()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -295,10 +274,7 @@ void JSONTest::testStringProperty()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -324,10 +300,7 @@ void JSONTest::testEmptyObject()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -404,10 +377,7 @@ void JSONTest::testComplexObject()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -427,10 +397,7 @@ void JSONTest::testDoubleProperty()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -456,10 +423,7 @@ void JSONTest::testDouble2Property()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -485,10 +449,7 @@ void JSONTest::testDouble3Property()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -514,10 +475,7 @@ void JSONTest::testObjectProperty()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -550,10 +508,7 @@ void JSONTest::testObjectArray()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -580,10 +535,7 @@ void JSONTest::testArrayOfObjects()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -611,10 +563,7 @@ void JSONTest::testEmptyArray()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -637,10 +586,7 @@ void JSONTest::testNestedArray()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -663,10 +609,7 @@ void JSONTest::testNullElement()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -691,10 +634,7 @@ void JSONTest::testTrueElement()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -720,10 +660,7 @@ void JSONTest::testFalseElement()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -749,10 +686,7 @@ void JSONTest::testNumberElement()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -778,10 +712,7 @@ void JSONTest::testStringElement()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -807,10 +738,7 @@ void JSONTest::testEmptyObjectElement()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -834,10 +762,7 @@ void JSONTest::testDoubleElement()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -863,10 +788,7 @@ void JSONTest::testOptValue()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -890,10 +812,7 @@ void JSONTest::testQuery()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -915,12 +834,12 @@ void JSONTest::testPrintHandler()
std::string json = "{ \"name\" : \"Homer\", \"age\" : 38, \"wife\" : \"Marge\", \"age\" : 36, \"children\" : [ \"Bart\", \"Lisa\", \"Maggie\" ] }";
Parser parser;
std::ostringstream ostr;
- PrintHandler handler(ostr);
- parser.setHandler(&handler);
+ PrintHandler::Ptr pHandler = new PrintHandler(ostr);
+ parser.setHandler(pHandler);
parser.parse(json);
assert (ostr.str() == "{\"name\":\"Homer\",\"age\":38,\"wife\":\"Marge\",\"age\":36,\"children\":[\"Bart\",\"Lisa\",\"Maggie\"]}");
- handler.setIndent(1);
+ pHandler->setIndent(1);
ostr.str("");
parser.parse(json);
assert (ostr.str() == "{\n"
@@ -936,7 +855,7 @@ void JSONTest::testPrintHandler()
"}"
);
- handler.setIndent(2);
+ pHandler->setIndent(2);
ostr.str("");
parser.parse(json);
assert (ostr.str() == "{\n"
@@ -952,7 +871,7 @@ void JSONTest::testPrintHandler()
"}"
);
- handler.setIndent(4);
+ pHandler->setIndent(4);
ostr.str("");
parser.parse(json);
assert (ostr.str() == "{\n"
@@ -980,10 +899,7 @@ void JSONTest::testStringify()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -1104,15 +1020,14 @@ void JSONTest::testStringifyPreserveOrder()
std::string json = "{ \"Simpsons\" : { \"husband\" : { \"name\" : \"Homer\" , \"age\" : 38 }, \"wife\" : { \"name\" : \"Marge\", \"age\" : 36 }, "
"\"children\" : [ \"Bart\", \"Lisa\", \"Maggie\" ], "
"\"address\" : { \"number\" : 742, \"street\" : \"Evergreen Terrace\", \"town\" : \"Springfield\" } } }";
- Parser parser;
+
+ ParseHandler::Ptr pHandler = new ParseHandler(true);
+ Parser parser(pHandler);
Var result;
try
{
- ParseHandler handler(true);
- parser.setHandler(&handler);
- parser.parse(json);
- result = handler.result();
+ result = parser.parse(json);
}
catch(JSONException& jsone)
{
@@ -1124,6 +1039,7 @@ void JSONTest::testStringifyPreserveOrder()
std::ostringstream ostr;
Stringifier::condense(result, ostr);
+ std::cout << ostr.str() << std::endl;
assert (ostr.str() == "{\"Simpsons\":{\"husband\":{\"name\":\"Homer\",\"age\":38},\"wife\":{\"name\":\"Marge\",\"age\":36},"
"\"children\":[\"Bart\",\"Lisa\",\"Maggie\"],"
"\"address\":{\"number\":742,\"street\":\"Evergreen Terrace\",\"town\":\"Springfield\"}}}");
@@ -1235,10 +1151,8 @@ void JSONTest::testValidJanssonFiles()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
parser.parse(fis);
- result = handler.result();
+ result = parser.result();
std::cout << "Ok!" << std::endl;
}
catch(JSONException& jsone)
@@ -1283,10 +1197,8 @@ void JSONTest::testInvalidJanssonFiles()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
parser.parse(fis);
- result = handler.result();
+ result = parser.result();
// We shouldn't get here.
std::cout << "We didn't get an exception. This is the result: " << result.convert<std::string>() << std::endl;
fail(result.convert<std::string>());
@@ -1327,10 +1239,8 @@ void JSONTest::testInvalidUnicodeJanssonFiles()
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
parser.parse(fis);
- result = handler.result();
+ result = parser.result();
// We shouldn't get here.
std::cout << "We didn't get an exception. This is the result: " << result.convert<std::string>() << std::endl;
fail(result.convert<std::string>());
@@ -1375,10 +1285,8 @@ void JSONTest::testUnicode()
Var result;
try
{
- ParseHandler handler;
- parser.setHandler(&handler);
parser.parse(json);
- result = handler.result();
+ result = parser.result();
}
catch(JSONException& jsone)
{
Please sign in to comment.
Something went wrong with that request. Please try again.