Merge remote-tracking branch 'origin/ip-address-soo' into develop

This commit is contained in:
aleks-f 2013-02-17 16:33:44 -06:00
Родитель 5cf5693bf0 efc0387838
Коммит 9378680c0b
98 изменённых файлов: 4278 добавлений и 1834 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -100,3 +100,6 @@ lib/
lib64/
pocomsg.h
# Temporary files #
###################
*.bak

Просмотреть файл

@ -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|x64">
@ -16,40 +16,40 @@
<RootNamespace>ApacheConnector</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;" Label="Configuration">
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ImportGroup Label="ExtensionSettings"/>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&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_shared|x64'" 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|x64&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|x64'" 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|x64&apos;">..\bin64\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">..\bin64\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">false</LinkIncremental>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">mod_poco64d</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">mod_poco64</TargetName>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">..\bin64\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">..\bin64\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">false</LinkIncremental>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">mod_poco64d</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">mod_poco64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\Foundation\include;..\Net\include;..\Util\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ApacheHandlers_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;_USRDLL;ApacheHandlers_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -58,7 +58,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -76,7 +76,7 @@
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -84,16 +84,16 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>.\include;..\Foundation\include;..\Net\include;..\Util\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ApacheHandlers_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;_USRDLL;ApacheHandlers_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<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>
@ -111,23 +111,23 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="include\ApacheApplication.h"/>
<ClInclude Include="include\ApacheChannel.h"/>
<ClInclude Include="include\ApacheConnector.h"/>
<ClInclude Include="include\ApacheRequestHandlerFactory.h"/>
<ClInclude Include="include\ApacheServerRequest.h"/>
<ClInclude Include="include\ApacheServerResponse.h"/>
<ClInclude Include="include\ApacheStream.h"/>
<ClInclude Include="include\ApacheApplication.h" />
<ClInclude Include="include\ApacheChannel.h" />
<ClInclude Include="include\ApacheConnector.h" />
<ClInclude Include="include\ApacheRequestHandlerFactory.h" />
<ClInclude Include="include\ApacheServerRequest.h" />
<ClInclude Include="include\ApacheServerResponse.h" />
<ClInclude Include="include\ApacheStream.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\ApacheApplication.cpp"/>
<ClCompile Include="src\ApacheChannel.cpp"/>
<ClCompile Include="src\ApacheConnector.cpp"/>
<ClCompile Include="src\ApacheRequestHandlerFactory.cpp"/>
<ClCompile Include="src\ApacheServerRequest.cpp"/>
<ClCompile Include="src\ApacheServerResponse.cpp"/>
<ClCompile Include="src\ApacheStream.cpp"/>
<ClCompile Include="src\ApacheApplication.cpp" />
<ClCompile Include="src\ApacheChannel.cpp" />
<ClCompile Include="src\ApacheConnector.cpp" />
<ClCompile Include="src\ApacheRequestHandlerFactory.cpp" />
<ClCompile Include="src\ApacheServerRequest.cpp" />
<ClCompile Include="src\ApacheServerResponse.cpp" />
<ClCompile Include="src\ApacheStream.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/>
</Project>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

Просмотреть файл

@ -38,16 +38,16 @@ public:
ActiveTest(Test* test);
~ActiveTest();
void run(TestResult* result);
void run(TestResult* result);
protected:
HANDLE _threadHandle;
CEvent _runCompleted;
TestResult* _currentTestResult;
void run ();
void setTestResult(TestResult* result);
static UINT threadFunction(LPVOID thisInstance);
HANDLE _threadHandle;
CEvent _runCompleted;
TestResult* _currentTestResult;
void run ();
void setTestResult(TestResult* result);
static UINT threadFunction(LPVOID thisInstance);
};

Просмотреть файл

@ -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|x64">
@ -32,90 +32,92 @@
<RootNamespace>TestSuite</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;" Label="Configuration">
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ImportGroup Label="ExtensionSettings"/>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&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|x64'" 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|x64&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|x64'" 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|x64&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|x64'" 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|x64&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|x64'" 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|x64&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|x64'" 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|x64&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|x64'" 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|x64&apos;">bin64\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">bin64\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">false</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;">bin64\static_mt\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;">bin64\static_mt\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;">false</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;">bin64\static_md\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;">bin64\static_md\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;">false</LinkIncremental>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">TestSuited</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;">TestSuited</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;">TestSuited</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">TestSuite</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;">TestSuite</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;">TestSuite</TargetName>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">bin64\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">bin64\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'">bin64\static_mt\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'">bin64\static_mt\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'">bin64\static_md\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'">bin64\static_md\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'">false</LinkIncremental>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">TestSuited</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'">TestSuited</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'">TestSuited</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">TestSuite</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'">TestSuite</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'">TestSuite</TargetName>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">C:\openssl\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">C:\openssl\lib;$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64;</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;WINVER=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -124,7 +126,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -141,7 +143,7 @@
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -149,16 +151,16 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;WINVER=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;WINVER=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<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>
@ -173,11 +175,11 @@
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -186,7 +188,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -204,7 +206,7 @@
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -212,16 +214,16 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<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>
@ -237,11 +239,11 @@
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -250,7 +252,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -267,7 +269,7 @@
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -275,16 +277,16 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<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>
@ -300,18 +302,18 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="src\CryptoTest.h"/>
<ClInclude Include="src\DigestEngineTest.h"/>
<ClInclude Include="src\RSATest.h"/>
<ClInclude Include="src\CryptoTestSuite.h"/>
<ClInclude Include="src\CryptoTest.h" />
<ClInclude Include="src\DigestEngineTest.h" />
<ClInclude Include="src\RSATest.h" />
<ClInclude Include="src\CryptoTestSuite.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\DigestEngineTest.cpp"/>
<ClCompile Include="src\CryptoTest.cpp"/>
<ClCompile Include="src\RSATest.cpp"/>
<ClCompile Include="src\CryptoTestSuite.cpp"/>
<ClCompile Include="src\WinDriver.cpp"/>
<ClCompile Include="src\DigestEngineTest.cpp" />
<ClCompile Include="src\CryptoTest.cpp" />
<ClCompile Include="src\RSATest.cpp" />
<ClCompile Include="src\CryptoTestSuite.cpp" />
<ClCompile Include="src\WinDriver.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/>
</Project>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

Просмотреть файл

@ -44,6 +44,12 @@
#include "Poco/Data/Connector.h"
// Note: to avoid static (de)initialization problems,
// during connector automatic (un)registration, it is
// best to have this as a macro.
#define POCO_DATA_MYSQL_CONNECTOR_NAME "mysql"
namespace Poco {
namespace Data {
namespace MySQL {
@ -80,4 +86,55 @@ public:
} } } // namespace Poco::Data::MySQL
//
// Automatic Connector registration
//
struct MySQL_API MySQLConnectorRegistrator
/// Connector registering class.
/// A global instance of this class is instantiated
/// with sole purpose to automatically register the
/// MySQL connector with central Poco Data registry.
{
MySQLConnectorRegistrator()
/// Calls Poco::Data::MySQL::registerConnector();
{
Poco::Data::MySQL::Connector::registerConnector();
}
~MySQLConnectorRegistrator()
/// Calls Poco::Data::MySQL::unregisterConnector();
{
Poco::Data::MySQL::Connector::unregisterConnector();
}
};
#if !defined(POCO_NO_AUTOMATIC_LIB_INIT)
#if defined(POCO_OS_FAMILY_WINDOWS)
extern "C" const struct MySQL_API MySQLConnectorRegistrator pocoMySQLConnectorRegistrator;
#if defined(MySQL_EXPORTS)
#if defined(_WIN64)
#define POCO_DATA_MYSQL_FORCE_SYMBOL(s) __pragma(comment (linker, "/export:"#s))
#elif defined(_WIN32)
#define POCO_DATA_MYSQL_FORCE_SYMBOL(s) __pragma(comment (linker, "/export:_"#s))
#endif
#else // !MySQL_EXPORTS
#if defined(_WIN64)
#define POCO_DATA_MYSQL_FORCE_SYMBOL(s) __pragma(comment (linker, "/include:"#s))
#elif defined(_WIN32)
#define POCO_DATA_MYSQL_FORCE_SYMBOL(s) __pragma(comment (linker, "/include:_"#s))
#endif
#endif // MySQL_EXPORTS
#else // !POCO_OS_FAMILY_WINDOWS
#define POCO_DATA_MYSQL_FORCE_SYMBOL(s) extern "C" const struct MySQLConnectorRegistrator s;
#endif // POCO_OS_FAMILY_WINDOWS
POCO_DATA_MYSQL_FORCE_SYMBOL(pocoMySQLConnectorRegistrator)
#endif // POCO_NO_AUTOMATIC_LIB_INIT
//
// End automatic Connector registration
//
#endif // Data_MySQL_Connector_INCLUDED

Просмотреть файл

@ -141,7 +141,7 @@ public:
SessionHandle& handle();
// Get handle
const std::string& connectorName();
const std::string& connectorName() const;
/// Returns the name of the connector.
private:
@ -208,7 +208,7 @@ inline SessionHandle& SessionImpl::handle()
}
inline const std::string& SessionImpl::connectorName()
inline const std::string& SessionImpl::connectorName() const
{
return _connector;
}

Просмотреть файл

@ -38,16 +38,18 @@
#include "Poco/Data/MySQL/SessionImpl.h"
#include "Poco/Data/SessionFactory.h"
#include "Poco/Exception.h"
#include <mysql.h>
const MySQLConnectorRegistrator pocoMySQLConnectorRegistrator;
namespace Poco {
namespace Data {
namespace MySQL {
std::string Connector::KEY("mysql");
std::string Connector::KEY(POCO_DATA_MYSQL_CONNECTOR_NAME);
Connector::Connector()
@ -61,7 +63,8 @@ Connector::~Connector()
const std::string& Connector::name() const
{
return KEY;
static const std::string n(POCO_DATA_MYSQL_CONNECTOR_NAME);
return n;
}
Poco::AutoPtr<Poco::Data::SessionImpl> Connector::createSession(const std::string& connectionString,
@ -84,7 +87,7 @@ void Connector::registerConnector()
void Connector::unregisterConnector()
{
Poco::Data::SessionFactory::instance().remove(KEY);
Poco::Data::SessionFactory::instance().remove(POCO_DATA_MYSQL_CONNECTOR_NAME);
mysql_library_end();
}

Просмотреть файл

@ -44,6 +44,12 @@
#include "Poco/Data/Connector.h"
// Note: to avoid static (de)initialization problems,
// during connector automatic (un)registration, it is
// best to have this as a macro.
#define POCO_DATA_ODBC_CONNECTOR_NAME "odbc"
namespace Poco {
namespace Data {
namespace ODBC {
@ -83,11 +89,63 @@ public:
inline const std::string& Connector::name() const
{
return KEY;
static const std::string n(POCO_DATA_ODBC_CONNECTOR_NAME);
return n;
}
} } } // namespace Poco::Data::ODBC
//
// Automatic Connector registration
//
struct ODBC_API ODBCConnectorRegistrator
/// Connector registering class.
/// A global instance of this class is instantiated
/// with sole purpose to automatically register the
/// ODBC connector with central Poco Data registry.
{
ODBCConnectorRegistrator()
/// Calls Poco::Data::ODBC::registerConnector();
{
Poco::Data::ODBC::Connector::registerConnector();
}
~ODBCConnectorRegistrator()
/// Calls Poco::Data::ODBC::unregisterConnector();
{
Poco::Data::ODBC::Connector::unregisterConnector();
}
};
#if !defined(POCO_NO_AUTOMATIC_LIB_INIT)
#if defined(POCO_OS_FAMILY_WINDOWS)
extern "C" const struct ODBC_API ODBCConnectorRegistrator pocoODBCConnectorRegistrator;
#if defined(ODBC_EXPORTS)
#if defined(_WIN64)
#define POCO_DATA_ODBC_FORCE_SYMBOL(s) __pragma(comment (linker, "/export:"#s))
#elif defined(_WIN32)
#define POCO_DATA_ODBC_FORCE_SYMBOL(s) __pragma(comment (linker, "/export:_"#s))
#endif
#else // !ODBC_EXPORTS
#if defined(_WIN64)
#define POCO_DATA_ODBC_FORCE_SYMBOL(s) __pragma(comment (linker, "/include:"#s))
#elif defined(_WIN32)
#define POCO_DATA_ODBC_FORCE_SYMBOL(s) __pragma(comment (linker, "/include:_"#s))
#endif
#endif // ODBC_EXPORTS
#else // !POCO_OS_FAMILY_WINDOWS
#define POCO_DATA_ODBC_FORCE_SYMBOL(s) extern "C" const struct ODBCConnectorRegistrator s;
#endif // POCO_OS_FAMILY_WINDOWS
POCO_DATA_ODBC_FORCE_SYMBOL(pocoODBCConnectorRegistrator)
#endif // POCO_NO_AUTOMATIC_LIB_INIT
//
// End automatic Connector registration
//
#endif // Data_ODBC_Connector_INCLUDED

Просмотреть файл

@ -122,7 +122,7 @@ public:
bool isTransaction();
/// Returns true iff a transaction is in progress.
const std::string& connectorName();
const std::string& connectorName() const;
/// Returns the name of the connector.
bool canTransact();
@ -263,7 +263,7 @@ inline bool SessionImpl::isAutoExtract(const std::string& name)
}
inline const std::string& SessionImpl::connectorName()
inline const std::string& SessionImpl::connectorName() const
{
return _connector;
}

Просмотреть файл

@ -39,12 +39,15 @@
#include "Poco/Data/SessionFactory.h"
const ODBCConnectorRegistrator pocoODBCConnectorRegistrator;
namespace Poco {
namespace Data {
namespace ODBC {
const std::string Connector::KEY("odbc");
const std::string Connector::KEY(POCO_DATA_ODBC_CONNECTOR_NAME);
Connector::Connector()
@ -72,7 +75,7 @@ void Connector::registerConnector()
void Connector::unregisterConnector()
{
Poco::Data::SessionFactory::instance().remove(KEY);
Poco::Data::SessionFactory::instance().remove(POCO_DATA_ODBC_CONNECTOR_NAME);
}

Просмотреть файл

@ -1313,7 +1313,6 @@ ODBCTest::SessionPtr ODBCTest::init(const std::string& driver,
Utility::drivers(_drivers);
if (!canConnect(driver, dsn, uid, pwd, dbConnString, db)) return 0;
Poco::Data::ODBC::Connector::registerConnector();
try
{
std::cout << "Conecting to [" << dbConnString << ']' << std::endl;

Просмотреть файл

@ -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,76 +32,76 @@
<RootNamespace>SQLite</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>
</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>
</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>
</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>
</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>
</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>
</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;">PocoDataSQLited</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">PocoDataSQLitemdd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">PocoDataSQLitemtd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">PocoDataSQLite</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">PocoDataSQLitemd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">PocoDataSQLitemt</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'">PocoDataSQLited</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">PocoDataSQLitemdd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">PocoDataSQLitemtd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">PocoDataSQLite</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">PocoDataSQLitemd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">PocoDataSQLitemt</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;..\..\Data\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -114,7 +114,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -132,7 +132,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>
@ -147,9 +147,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4996;4244;4018;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -166,7 +166,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;..\..\Data\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -179,7 +179,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\..\lib\PocoDataSQLitemtd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
@ -190,7 +190,7 @@
<OutputFile>..\..\lib\PocoDataSQLitemtd.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>
@ -205,9 +205,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4996;4244;4018;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -215,7 +215,7 @@
<OutputFile>..\..\lib\PocoDataSQLitemt.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;..\..\Data\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -228,7 +228,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\..\lib\PocoDataSQLitemdd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
@ -239,7 +239,7 @@
<OutputFile>..\..\lib\PocoDataSQLitemdd.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>
@ -254,10 +254,10 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\..\lib\PocoDataSQLitemd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4996;4244;4018;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -267,26 +267,26 @@
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="include\Poco\Data\SQLite\Binder.h"/>
<ClInclude Include="include\Poco\Data\SQLite\Connector.h"/>
<ClInclude Include="include\Poco\Data\SQLite\Extractor.h"/>
<ClInclude Include="include\Poco\Data\SQLite\SessionImpl.h"/>
<ClInclude Include="include\Poco\Data\SQLite\SQLite.h"/>
<ClInclude Include="include\Poco\Data\SQLite\SQLiteException.h"/>
<ClInclude Include="include\Poco\Data\SQLite\SQLiteStatementImpl.h"/>
<ClInclude Include="include\Poco\Data\SQLite\Utility.h"/>
<ClInclude Include="src\sqlite3.h"/>
<ClInclude Include="include\Poco\Data\SQLite\Binder.h" />
<ClInclude Include="include\Poco\Data\SQLite\Connector.h" />
<ClInclude Include="include\Poco\Data\SQLite\Extractor.h" />
<ClInclude Include="include\Poco\Data\SQLite\SessionImpl.h" />
<ClInclude Include="include\Poco\Data\SQLite\SQLite.h" />
<ClInclude Include="include\Poco\Data\SQLite\SQLiteException.h" />
<ClInclude Include="include\Poco\Data\SQLite\SQLiteStatementImpl.h" />
<ClInclude Include="include\Poco\Data\SQLite\Utility.h" />
<ClInclude Include="src\sqlite3.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Binder.cpp"/>
<ClCompile Include="src\Connector.cpp"/>
<ClCompile Include="src\Extractor.cpp"/>
<ClCompile Include="src\SessionImpl.cpp"/>
<ClCompile Include="src\SQLiteException.cpp"/>
<ClCompile Include="src\SQLiteStatementImpl.cpp"/>
<ClCompile Include="src\Utility.cpp"/>
<ClCompile Include="src\sqlite3.c"/>
<ClCompile Include="src\Binder.cpp" />
<ClCompile Include="src\Connector.cpp" />
<ClCompile Include="src\Extractor.cpp" />
<ClCompile Include="src\SessionImpl.cpp" />
<ClCompile Include="src\SQLiteException.cpp" />
<ClCompile Include="src\SQLiteStatementImpl.cpp" />
<ClCompile Include="src\Utility.cpp" />
<ClCompile Include="src\sqlite3.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/>
</Project>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

Просмотреть файл

@ -44,6 +44,12 @@
#include "Poco/Data/Connector.h"
// Note: to avoid static (de)initialization problems,
// during connector automatic (un)registration, it is
// best to have this as a macro.
#define POCO_DATA_SQLITE_CONNECTOR_NAME "sqlite"
namespace Poco {
namespace Data {
namespace SQLite {
@ -91,11 +97,62 @@ public:
///
inline const std::string& Connector::name() const
{
return KEY;
static const std::string n(POCO_DATA_SQLITE_CONNECTOR_NAME);
return n;
}
} } } // namespace Poco::Data::SQLite
//
// Automatic Connector registration
//
struct SQLite_API SQLiteConnectorRegistrator
/// Connector registering class.
/// A global instance of this class is instantiated
/// with sole purpose to automatically register the
/// SQLite connector with central Poco Data registry.
{
SQLiteConnectorRegistrator()
/// Calls Poco::Data::SQLite::registerConnector();
{
Poco::Data::SQLite::Connector::registerConnector();
}
~SQLiteConnectorRegistrator()
/// Calls Poco::Data::SQLite::unregisterConnector();
{
Poco::Data::SQLite::Connector::unregisterConnector();
}
};
#if !defined(POCO_NO_AUTOMATIC_LIB_INIT)
#if defined(POCO_OS_FAMILY_WINDOWS)
extern "C" const struct SQLite_API SQLiteConnectorRegistrator pocoSQLiteConnectorRegistrator;
#if defined(SQLite_EXPORTS)
#if defined(_WIN64)
#define POCO_DATA_SQLITE_FORCE_SYMBOL(s) __pragma(comment (linker, "/export:"#s))
#elif defined(_WIN32)
#define POCO_DATA_SQLITE_FORCE_SYMBOL(s) __pragma(comment (linker, "/export:_"#s))
#endif
#else // !SQLite_EXPORTS
#if defined(_WIN64)
#define POCO_DATA_SQLITE_FORCE_SYMBOL(s) __pragma(comment (linker, "/include:"#s))
#elif defined(_WIN32)
#define POCO_DATA_SQLITE_FORCE_SYMBOL(s) __pragma(comment (linker, "/include:_"#s))
#endif
#endif // SQLite_EXPORTS
#else // !POCO_OS_FAMILY_WINDOWS
#define POCO_DATA_SQLITE_FORCE_SYMBOL(s) extern "C" const struct SQLiteConnectorRegistrator s;
#endif // POCO_OS_FAMILY_WINDOWS
POCO_DATA_SQLITE_FORCE_SYMBOL(pocoSQLiteConnectorRegistrator)
#endif // POCO_NO_AUTOMATIC_LIB_INIT
//
// End automatic Connector registration
//
#endif // Data_SQLite_Connector_INCLUDED

Просмотреть файл

@ -84,7 +84,7 @@
//
// Thread safety mode defaults to "serialized".
// See http://www.sqlite.org/threadsafe.html for details.
// Threading mode significantly affects performance
// Threading mode may significantly affect performance
// (see TestSuite::benchmarkThreadModesTiming)
//
#ifndef SQLITE_THREADSAFE

Просмотреть файл

@ -41,6 +41,7 @@
#include "Poco/Data/SQLite/SQLite.h"
#include "Poco/Data/SQLite/Connector.h"
#include "Poco/Data/SQLite/Binder.h"
#include "Poco/Data/AbstractSessionImpl.h"
#include "Poco/SharedPtr.h"
@ -51,6 +52,9 @@ struct sqlite3_stmt;
namespace Poco {
class Mutex;
namespace Data {
namespace SQLite {
@ -124,17 +128,22 @@ public:
/// Returns true iff the transaction isolation level corresponds
/// to the supplied bitmask.
const std::string& connectorName();
void autoCommit(const std::string&, bool val);
/// Sets autocommit property for the session.
bool isAutoCommit(const std::string& name="");
/// Returns autocommit property value.
const std::string& connectorName() const;
/// Returns the name of the connector.
private:
std::string _connector;
sqlite3* _pDB;
bool _connected;
bool _isTransaction;
int _timeout;
Mutex _mutex;
static const std::string DEFERRED_BEGIN_TRANSACTION;
static const std::string COMMIT_TRANSACTION;
static const std::string ABORT_TRANSACTION;
@ -156,7 +165,7 @@ inline bool SessionImpl::isTransaction()
}
inline const std::string& SessionImpl::connectorName()
inline const std::string& SessionImpl::connectorName() const
{
return _connector;
}

Просмотреть файл

@ -42,7 +42,9 @@
#include "Poco/Data/SQLite/SQLite.h"
#include "Poco/Data/MetaColumn.h"
#include "Poco/Data/Session.h"
#include "Poco/Mutex.h"
#include "Poco/Types.h"
#include <map>
@ -56,7 +58,7 @@ namespace SQLite {
class SQLite_API Utility
/// Various utility functions for SQLite, mostly return code handling
/// Various utility functions for SQLite.
{
public:
static const std::string SQLITE_DATE_FORMAT;
@ -67,16 +69,18 @@ public:
static const int THREAD_MODE_MULTI;
static const int THREAD_MODE_SERIAL;
Utility();
/// Maps SQLite column declared types to Poco::Data types through
/// static TypeMap member.
/// Note: SQLite is type-agnostic and it is the end-user responsibility
/// to ensure that column declared data type corresponds to the type of
/// data actually held in the database.
/// Column types are case-insensitive.
static const int OPERATION_INSERT;
static const int OPERATION_DELETE;
static const int OPERATION_UPDATE;
static sqlite3* dbHandle(const Session& session);
/// Returns native DB handle.
static std::string lastError(sqlite3* pDb);
/// Retreives the last error code from sqlite and converts it to a string
/// Retreives the last error code from sqlite and converts it to a string.
static std::string lastError(const Session& session);
/// Retreives the last error code from sqlite and converts it to a string.
static void throwException(int rc, const std::string& addErrMsg = std::string());
/// Throws for an error code the appropriate exception
@ -88,13 +92,25 @@ public:
/// Loads the contents of a database file on disk into an opened
/// database in memory.
///
/// Returns true if succesful
/// Returns true if succesful.
static bool fileToMemory(const Session& session, const std::string& fileName);
/// Loads the contents of a database file on disk into an opened
/// database in memory.
///
/// Returns true if succesful.
static bool memoryToFile(const std::string& fileName, sqlite3* pInMemory);
/// Saves the contents of an opened database in memory to the
/// database on disk.
///
/// Returns true if succesful
/// Returns true if succesful.
static bool memoryToFile(const std::string& fileName, const Session& session);
/// Saves the contents of an opened database in memory to the
/// database on disk.
///
/// Returns true if succesful.
static bool isThreadSafe();
/// Returns true if SQLite was compiled in multi-thread or serialized mode.
@ -111,14 +127,131 @@ public:
static int getThreadMode();
/// Returns the thread mode.
typedef void(*UpdateCallbackType)(void*, int, const char*, const char*, Poco::Int64);
/// Update callback function type.
typedef int(*CommitCallbackType)(void*);
/// Commit callback function type.
typedef void(*RollbackCallbackType)(void*);
/// Rollback callback function type.
template <typename T, typename CBT>
static bool registerUpdateHandler(sqlite3* pDB, CBT callbackFn, T* pParam)
/// Registers the callback for (1)(insert, delete, update), (2)(commit) or
/// or (3)(rollback) events. Only one function per group can be registered
/// at a time. Registration is not thread-safe. Storage pointed to by pParam
/// must remain valid as long as registration is active. Registering with
/// callbackFn set to zero disables notifications.
///
/// See http://www.sqlite.org/c3ref/update_hook.html and
/// http://www.sqlite.org/c3ref/commit_hook.html for details.
{
typedef std::pair<CBT, T*> CBPair;
typedef std::multimap<sqlite3*, CBPair> CBMap;
typedef typename CBMap::iterator CBMapIt;
typedef std::pair<CBMapIt, CBMapIt> CBMapItPair;
static CBMap retMap;
T* pRet = reinterpret_cast<T*>(eventHookRegister(pDB, callbackFn, pParam));
if (pRet == 0)
{
if (retMap.find(pDB) == retMap.end())
{
retMap.insert(std::make_pair(pDB, CBPair(callbackFn, pParam)));
return true;
}
}
else
{
CBMapItPair retMapRange = retMap.equal_range(pDB);
for (CBMapIt it = retMapRange.first; it != retMapRange.second; ++it)
{
poco_assert (it->second.first != 0);
if ((callbackFn == 0) && (*pRet == *it->second.second))
{
retMap.erase(it);
return true;
}
if ((callbackFn == it->second.first) && (*pRet == *it->second.second))
{
it->second.second = pParam;
return true;
}
}
}
return false;
}
template <typename T, typename CBT>
static bool registerUpdateHandler(const Session& session, CBT callbackFn, T* pParam)
/// Registers the callback by calling registerUpdateHandler(sqlite3*, CBT, T*).
{
return registerUpdateHandler(dbHandle(session), callbackFn, pParam);
}
private:
static TypeMap _types;
Poco::FastMutex _mutex;
static int _threadMode;
Utility();
/// Maps SQLite column declared types to Poco::Data types through
/// static TypeMap member.
///
/// Note: SQLite is type-agnostic and it is the end-user responsibility
/// to ensure that column declared data type corresponds to the type of
/// data actually held in the database.
///
/// Column types are case-insensitive.
Utility(const Utility&);
Utility& operator = (const Utility&);
static void* eventHookRegister(sqlite3* pDB, UpdateCallbackType callbackFn, void* pParam);
static void* eventHookRegister(sqlite3* pDB, CommitCallbackType callbackFn, void* pParam);
static void* eventHookRegister(sqlite3* pDB, RollbackCallbackType callbackFn, void* pParam);
static TypeMap _types;
static Poco::Mutex _mutex;
static int _threadMode;
};
//
// inlines
//
inline sqlite3* Utility::dbHandle(const Session& session)
{
#ifdef POCO_COMPILER_CLANG
sqlite3* p = 0; Any a = p; // ??? clang fails to AnyCast without these ???
#endif
return AnyCast<sqlite3*>(session.getProperty("handle"));
}
inline std::string Utility::lastError(const Session& session)
{
poco_assert_dbg ((0 == icompare(session.connector(), 0, 6, "sqlite")));
return lastError(dbHandle(session));
}
inline bool Utility::memoryToFile(const std::string& fileName, const Session& session)
{
poco_assert_dbg ((0 == icompare(session.connector(), 0, 6, "sqlite")));
return memoryToFile(fileName, dbHandle(session));
}
inline bool Utility::fileToMemory(const Session& session, const std::string& fileName)
{
poco_assert_dbg ((0 == icompare(session.connector(), 0, 6, "sqlite")));
return fileToMemory(dbHandle(session), fileName);
}
} } } // namespace Poco::Data::SQLite
#endif
#endif // SQLite_Utility_INCLUDED

Просмотреть файл

@ -44,12 +44,15 @@
#endif
const SQLiteConnectorRegistrator pocoSQLiteConnectorRegistrator;
namespace Poco {
namespace Data {
namespace SQLite {
const std::string Connector::KEY("sqlite");
const std::string Connector::KEY(POCO_DATA_SQLITE_CONNECTOR_NAME);
Connector::Connector()
@ -77,7 +80,7 @@ void Connector::registerConnector()
void Connector::unregisterConnector()
{
Poco::Data::SessionFactory::instance().remove(KEY);
Poco::Data::SessionFactory::instance().remove(POCO_DATA_SQLITE_CONNECTOR_NAME);
}

Просмотреть файл

@ -37,12 +37,12 @@
#include "Poco/Data/SQLite/SessionImpl.h"
#include "Poco/Data/SQLite/Utility.h"
#include "Poco/Data/SQLite/SQLiteStatementImpl.h"
#include "Poco/Data/SQLite/Connector.h"
#include "Poco/Data/SQLite/SQLiteException.h"
#include "Poco/Data/Session.h"
#include "Poco/ActiveMethod.h"
#include "Poco/ActiveResult.h"
#include "Poco/String.h"
#include "Poco/Mutex.h"
#include "Poco/Data/DataException.h"
#include "sqlite3.h"
#include <cstdlib>
@ -68,6 +68,9 @@ SessionImpl::SessionImpl(const std::string& fileName, std::size_t loginTimeout):
open();
setConnectionTimeout(CONNECTION_TIMEOUT_DEFAULT);
setProperty("handle", _pDB);
addFeature("autoCommit",
&SessionImpl::autoCommit,
&SessionImpl::isAutoCommit);
}
@ -86,6 +89,7 @@ Poco::Data::StatementImpl* SessionImpl::createStatementImpl()
void SessionImpl::begin()
{
Poco::Mutex::ScopedLock l(_mutex);
SQLiteStatementImpl tmp(*this, _pDB);
tmp.add(DEFERRED_BEGIN_TRANSACTION);
tmp.execute();
@ -95,6 +99,7 @@ void SessionImpl::begin()
void SessionImpl::commit()
{
Poco::Mutex::ScopedLock l(_mutex);
SQLiteStatementImpl tmp(*this, _pDB);
tmp.add(COMMIT_TRANSACTION);
tmp.execute();
@ -104,6 +109,7 @@ void SessionImpl::commit()
void SessionImpl::rollback()
{
Poco::Mutex::ScopedLock l(_mutex);
SQLiteStatementImpl tmp(*this, _pDB);
tmp.add(ABORT_TRANSACTION);
tmp.execute();
@ -234,4 +240,21 @@ void SessionImpl::setConnectionTimeout(std::size_t timeout)
}
void SessionImpl::autoCommit(const std::string&, bool)
{
// The problem here is to decide whether to call commit or rollback
// when autocommit is set to true. Hence, it is best not to implement
// this explicit call and only implicitly support autocommit setting.
throw NotImplementedException(
"SQLite autocommit is implicit with begin/commit/rollback.");
}
bool SessionImpl::isAutoCommit(const std::string&)
{
Poco::Mutex::ScopedLock l(_mutex);
return (0 != sqlite3_get_autocommit(_pDB));
}
} } } // namespace Poco::Data::SQLite

Просмотреть файл

@ -40,6 +40,7 @@
#include "Poco/Data/SQLite/SQLiteException.h"
#include "Poco/NumberFormatter.h"
#include "Poco/String.h"
#include "Poco/Any.h"
#include "Poco/Exception.h"
#if defined(POCO_UNBUNDLED)
#include <sqlite3.h>
@ -65,14 +66,18 @@ int Utility::_threadMode =
SQLITE_CONFIG_MULTITHREAD;
#endif
const int Utility::OPERATION_INSERT = SQLITE_INSERT;
const int Utility::OPERATION_DELETE = SQLITE_DELETE;
const int Utility::OPERATION_UPDATE = SQLITE_UPDATE;
const std::string Utility::SQLITE_DATE_FORMAT = "%Y-%m-%d";
const std::string Utility::SQLITE_TIME_FORMAT = "%H:%M:%S";
Utility::TypeMap Utility::_types;
Poco::Mutex Utility::_mutex;
Utility::Utility()
{
Poco::FastMutex::ScopedLock l(_mutex);
Poco::Mutex::ScopedLock l(_mutex);
if (_types.empty())
{
@ -129,7 +134,7 @@ Utility::Utility()
}
std::string Utility::lastError(sqlite3 *pDB)
std::string Utility::lastError(sqlite3* pDB)
{
return std::string(sqlite3_errmsg(pDB));
}
@ -216,7 +221,7 @@ void Utility::throwException(int rc, const std::string& addErrMsg)
case SQLITE_DONE:
break; // sqlite_step() has finished executing
default:
throw SQLiteException(std::string("Unkown error code: ") + Poco::NumberFormatter::format(rc), addErrMsg);
throw SQLiteException(std::string("Unknown error code: ") + Poco::NumberFormatter::format(rc), addErrMsg);
}
}
@ -299,4 +304,25 @@ bool Utility::setThreadMode(int mode)
}
void* Utility::eventHookRegister(sqlite3* pDB, UpdateCallbackType callbackFn, void* pParam)
{
typedef void(*pF)(void*, int, const char*, const char*, sqlite3_int64);
return sqlite3_update_hook(pDB, reinterpret_cast<pF>(callbackFn), pParam);
}
void* Utility::eventHookRegister(sqlite3* pDB, CommitCallbackType callbackFn, void* pParam)
{
return sqlite3_commit_hook(pDB, callbackFn, pParam);
}
void* Utility::eventHookRegister(sqlite3* pDB, RollbackCallbackType callbackFn, void* pParam)
{
return sqlite3_rollback_hook(pDB, callbackFn, pParam);
}
} } } // namespace Poco::Data::SQLite

Просмотреть файл

@ -45,6 +45,7 @@
#include "Poco/Dynamic/Var.h"
#include "Poco/Data/TypeHandler.h"
#include "Poco/Nullable.h"
#include "Poco/Data/Transaction.h"
#include "Poco/Data/DataException.h"
#include "Poco/Data/SQLite/SQLiteException.h"
#include "Poco/Tuple.h"
@ -73,6 +74,7 @@ using Poco::Data::LimitException;
using Poco::Data::CLOB;
using Poco::Data::Date;
using Poco::Data::Time;
using Poco::Data::Transaction;
using Poco::Data::AbstractExtractionVec;
using Poco::Data::AbstractExtractionVecVec;
using Poco::Data::AbstractBindingVec;
@ -87,15 +89,19 @@ using Poco::Logger;
using Poco::Message;
using Poco::AutoPtr;
using Poco::Thread;
using Poco::format;
using Poco::InvalidAccessException;
using Poco::RangeException;
using Poco::BadCastException;
using Poco::NotFoundException;
using Poco::NullPointerException;
using Poco::TimeoutException;
using Poco::NotImplementedException;
using Poco::Data::SQLite::ConstraintViolationException;
using Poco::Data::SQLite::ParameterCountMismatchException;
using Poco::Int32;
using Poco::Dynamic::Var;
using Poco::Data::SQLite::Utility;
class Person
@ -249,15 +255,18 @@ private:
} } // namespace Poco::Data
int SQLiteTest::_insertCounter;
int SQLiteTest::_updateCounter;
int SQLiteTest::_deleteCounter;
SQLiteTest::SQLiteTest(const std::string& name): CppUnit::TestCase(name)
{
Poco::Data::SQLite::Connector::registerConnector();
}
SQLiteTest::~SQLiteTest()
{
Poco::Data::SQLite::Connector::unregisterConnector();
}
@ -358,9 +367,7 @@ void SQLiteTest::testInMemory()
// load db from file to memory
Session mem (Poco::Data::SQLite::Connector::KEY, ":memory:");
sqlite3* p = 0; Any a = p; // ??? clang generated code fails to AnyCast without these
sqlite3* pMemHandle = AnyCast<sqlite3*>(mem.getProperty("handle"));
assert (Poco::Data::SQLite::Utility::fileToMemory(pMemHandle, "dummy.db"));
assert (Poco::Data::SQLite::Utility::fileToMemory(mem, "dummy.db"));
mem << "SELECT COUNT(*) FROM PERSON", into(count), now;
assert (count == 1);
@ -374,7 +381,7 @@ void SQLiteTest::testInMemory()
// save db from memory to file on the disk
Session dsk (Poco::Data::SQLite::Connector::KEY, "dsk.db");
assert (Poco::Data::SQLite::Utility::memoryToFile("dsk.db", pMemHandle));
assert (Poco::Data::SQLite::Utility::memoryToFile("dsk.db", mem));
dsk << "SELECT COUNT(*) FROM PERSON", into(count), now;
assert (count == 1);
@ -2657,6 +2664,551 @@ void SQLiteTest::testThreadModes()
}
void SQLiteTest::sqliteUpdateCallbackFn(void* pVal, int opCode, const char* pDB, const char* pTable, Poco::Int64 row)
{
poco_check_ptr(pVal);
Poco::Int64* pV = reinterpret_cast<Poco::Int64*>(pVal);
if (opCode == Utility::OPERATION_INSERT)
{
poco_assert (*pV == 2);
poco_assert (row == 1);
std::cout << "Inserted " << pDB << '.' << pTable << ", RowID=" << row << std::endl;
++_insertCounter;
}
else if (opCode == Utility::OPERATION_UPDATE)
{
poco_assert (*pV == 3);
poco_assert (row == 1);
std::cout << "Updated " << pDB << '.' << pTable << ", RowID=" << row << std::endl;
++_updateCounter;
}
else if (opCode == Utility::OPERATION_DELETE)
{
poco_assert (*pV == 4);
poco_assert (row == 1);
std::cout << "Deleted " << pDB << '.' << pTable << ", RowID=" << row << std::endl;
++_deleteCounter;
}
}
void SQLiteTest::testUpdateCallback()
{
// will be updated by callback
_insertCounter = 0;
_updateCounter = 0;
_deleteCounter = 0;
Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db");
assert (tmp.isConnected());
Poco::Int64 val = 1;
assert (Utility::registerUpdateHandler(tmp, &sqliteUpdateCallbackFn, &val));
std::string tableName("Person");
std::string lastName("lastname");
std::string firstName("firstname");
std::string address("Address");
int age = 133132;
int count = 0;
std::string result;
tmp << "DROP TABLE IF EXISTS Person", now;
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
tmp << "SELECT name FROM sqlite_master WHERE tbl_name=?", use(tableName), into(result), now;
assert (result == tableName);
// insert
val = 2;
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now;
tmp << "SELECT COUNT(*) FROM PERSON", into(count), now;
assert (count == 1);
assert (_insertCounter == 1);
tmp << "SELECT LastName FROM PERSON", into(result), now;
assert (lastName == result);
tmp << "SELECT Age FROM PERSON", into(count), now;
assert (count == age);
// update
val = 3;
tmp << "UPDATE PERSON SET Age = -1", now;
tmp << "SELECT Age FROM PERSON", into(age), now;
assert (-1 == age);
assert (_updateCounter == 1);
// delete
val =4;
tmp << "DELETE FROM Person WHERE Age = -1", now;
tmp << "SELECT COUNT(*) FROM PERSON", into(count), now;
assert (count == 0);
assert (_deleteCounter == 1);
// disarm callback and do the same drill
assert (Utility::registerUpdateHandler(tmp, (Utility::UpdateCallbackType) 0, &val));
tmp << "DROP TABLE IF EXISTS Person", now;
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
tmp << "SELECT name FROM sqlite_master WHERE tbl_name=?", use(tableName), into(result), now;
assert (result == tableName);
// must remain zero now
_insertCounter = 0;
_updateCounter = 0;
_deleteCounter = 0;
// insert
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now;
tmp << "SELECT COUNT(*) FROM PERSON", into(count), now;
assert (count == 1);
assert (_insertCounter == 0);
tmp << "SELECT LastName FROM PERSON", into(result), now;
assert (lastName == result);
tmp << "SELECT Age FROM PERSON", into(count), now;
assert (count == age);
// update
tmp << "UPDATE PERSON SET Age = -1", now;
tmp << "SELECT Age FROM PERSON", into(age), now;
assert (-1 == age);
assert (_updateCounter == 0);
// delete
tmp << "DELETE FROM Person WHERE Age = -1", now;
tmp << "SELECT COUNT(*) FROM PERSON", into(count), now;
assert (count == 0);
assert (_deleteCounter == 0);
tmp.close();
assert (!tmp.isConnected());
}
int SQLiteTest::sqliteCommitCallbackFn(void* pVal)
{
poco_check_ptr(pVal);
Poco::Int64* pV = reinterpret_cast<Poco::Int64*>(pVal);
poco_assert ((*pV) == 1);
++(*pV);
return 0;
}
void SQLiteTest::testCommitCallback()
{
Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db");
assert (tmp.isConnected());
Poco::Int64 val = 1;
assert (Utility::registerUpdateHandler(tmp, &sqliteCommitCallbackFn, &val));
std::string tableName("Person");
std::string lastName("lastname");
std::string firstName("firstname");
std::string address("Address");
int age = 133132;
std::string result;
tmp.begin();
tmp << "DROP TABLE IF EXISTS Person", now;
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now;
tmp.commit();
assert (val == 2);
assert (Utility::registerUpdateHandler(tmp, (Utility::CommitCallbackType) 0, &val));
val = 0;
tmp.begin();
tmp << "DROP TABLE IF EXISTS Person", now;
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now;
tmp.commit();
assert (val == 0);
}
void SQLiteTest::sqliteRollbackCallbackFn(void* pVal)
{
poco_check_ptr(pVal);
Poco::Int64* pV = reinterpret_cast<Poco::Int64*>(pVal);
poco_assert ((*pV) == 1);
++(*pV);
}
void SQLiteTest::testRollbackCallback()
{
Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db");
assert (tmp.isConnected());
Poco::Int64 val = 1;
assert (Utility::registerUpdateHandler(tmp, &sqliteRollbackCallbackFn, &val));
std::string tableName("Person");
std::string lastName("lastname");
std::string firstName("firstname");
std::string address("Address");
int age = 133132;
std::string result;
tmp.begin();
tmp << "DROP TABLE IF EXISTS Person", now;
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now;
tmp.rollback();
assert (val == 2);
assert (Utility::registerUpdateHandler(tmp, (Utility::RollbackCallbackType) 0, &val));
val = 0;
tmp.begin();
tmp << "DROP TABLE IF EXISTS Person", now;
tmp << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
tmp << "INSERT INTO PERSON VALUES(:ln, :fn, :ad, :age)", use(lastName), use(firstName), use(address), use(age), now;
tmp.rollback();
assert (val == 0);
}
void SQLiteTest::setTransactionIsolation(Session& session, Poco::UInt32 ti)
{
if (session.hasTransactionIsolation(ti))
{
std::string funct = "setTransactionIsolation()";
try
{
Transaction t(session, false);
t.setIsolation(ti);
assert (ti == t.getIsolation());
assert (t.isIsolation(ti));
assert (ti == session.getTransactionIsolation());
assert (session.isTransactionIsolation(ti));
}
catch(Poco::Exception& e){ std::cout << funct << ':' << e.displayText() << std::endl;}
}
else
{
std::cerr << '[' << name() << ']' << " Warning, transaction isolation not supported: ";
switch (ti)
{
case Session::TRANSACTION_READ_COMMITTED:
std::cerr << "READ COMMITTED"; break;
case Session::TRANSACTION_READ_UNCOMMITTED:
std::cerr << "READ UNCOMMITTED"; break;
case Session::TRANSACTION_REPEATABLE_READ:
std::cerr << "REPEATABLE READ"; break;
case Session::TRANSACTION_SERIALIZABLE:
std::cerr << "SERIALIZABLE"; break;
default:
std::cerr << "UNKNOWN"; break;
}
std::cerr << std::endl;
}
}
void SQLiteTest::testSessionTransaction()
{
Session session (Poco::Data::SQLite::Connector::KEY, "dummy.db");
assert (session.isConnected());
session << "DROP TABLE IF EXISTS Person", now;
session << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
if (!session.canTransact())
{
std::cout << "Session not capable of transactions." << std::endl;
return;
}
Session local (Poco::Data::SQLite::Connector::KEY, "dummy.db");
assert (local.isConnected());
try
{
local.setFeature("autoCommit", true);
fail ("Setting SQLite auto-commit explicitly must fail!");
}
catch (NotImplementedException&) { }
assert (local.getFeature("autoCommit"));
std::string funct = "transaction()";
std::vector<std::string> lastNames;
std::vector<std::string> firstNames;
std::vector<std::string> addresses;
std::vector<int> ages;
std::string tableName("Person");
lastNames.push_back("LN1");
lastNames.push_back("LN2");
firstNames.push_back("FN1");
firstNames.push_back("FN2");
addresses.push_back("ADDR1");
addresses.push_back("ADDR2");
ages.push_back(1);
ages.push_back(2);
int count = 0, locCount = 0;
std::string result;
setTransactionIsolation(session, Session::TRANSACTION_READ_COMMITTED);
session.begin();
assert (!session.getFeature("autoCommit"));
assert (session.isTransaction());
session << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now;
assert (session.isTransaction());
Statement stmt = (local << "SELECT COUNT(*) FROM Person", into(locCount), async, now);
session << "SELECT COUNT(*) FROM Person", into(count), now;
assert (2 == count);
assert (session.isTransaction());
session.rollback();
assert (!session.isTransaction());
assert (session.getFeature("autoCommit"));
stmt.wait();
assert (0 == locCount);
session << "SELECT count(*) FROM Person", into(count), now;
assert (0 == count);
assert (!session.isTransaction());
session.begin();
session << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now;
assert (session.isTransaction());
assert (!session.getFeature("autoCommit"));
Statement stmt1 = (local << "SELECT COUNT(*) FROM Person", into(locCount), now);
assert (0 == locCount);
session << "SELECT count(*) FROM Person", into(count), now;
assert (2 == count);
session.commit();
assert (!session.isTransaction());
assert (session.getFeature("autoCommit"));
session << "SELECT count(*) FROM Person", into(count), now;
assert (2 == count);
/* TODO: see http://www.sqlite.org/pragma.html#pragma_read_uncommitted
setTransactionIsolation(session, Session::TRANSACTION_READ_UNCOMMITTED);
*/
session.close();
assert (!session.isConnected());
local.close();
assert (!local.isConnected());
}
void SQLiteTest::testTransaction()
{
Session session (Poco::Data::SQLite::Connector::KEY, "dummy.db");
assert (session.isConnected());
session << "DROP TABLE IF EXISTS Person", now;
session << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
if (!session.canTransact())
{
std::cout << "Session not transaction-capable." << std::endl;
return;
}
Session local(Poco::Data::SQLite::Connector::KEY, "dummy.db");
setTransactionIsolation(session, Session::TRANSACTION_READ_COMMITTED);
std::string funct = "transaction()";
std::vector<std::string> lastNames;
std::vector<std::string> firstNames;
std::vector<std::string> addresses;
std::vector<int> ages;
std::string tableName("Person");
lastNames.push_back("LN1");
lastNames.push_back("LN2");
firstNames.push_back("FN1");
firstNames.push_back("FN2");
addresses.push_back("ADDR1");
addresses.push_back("ADDR2");
ages.push_back(1);
ages.push_back(2);
int count = 0, locCount = 0;
std::string result;
session.setTransactionIsolation(Session::TRANSACTION_READ_COMMITTED);
{
Transaction trans(session);
assert (trans.isActive());
assert (session.isTransaction());
session << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now;
assert (session.isTransaction());
assert (trans.isActive());
session << "SELECT COUNT(*) FROM Person", into(count), now;
assert (2 == count);
assert (session.isTransaction());
assert (trans.isActive());
// no explicit commit, so transaction RAII must roll back here
}
assert (!session.isTransaction());
session << "SELECT count(*) FROM Person", into(count), now;
assert (0 == count);
assert (!session.isTransaction());
{
Transaction trans(session);
session << "INSERT INTO Person VALUES (?,?,?,?)", use(lastNames), use(firstNames), use(addresses), use(ages), now;
Statement stmt1 = (local << "SELECT COUNT(*) FROM Person", into(locCount), now);
assert (session.isTransaction());
assert (trans.isActive());
trans.commit();
assert (!session.isTransaction());
assert (!trans.isActive());
assert (0 == locCount);
}
session << "SELECT count(*) FROM Person", into(count), now;
assert (2 == count);
local << "SELECT count(*) FROM Person", into(count), now;
assert (2 == count);
session << "DELETE FROM Person", now;
std::string sql1 = format("INSERT INTO Person VALUES ('%s','%s','%s',%d)", lastNames[0], firstNames[0], addresses[0], ages[0]);
std::string sql2 = format("INSERT INTO Person VALUES ('%s','%s','%s',%d)", lastNames[1], firstNames[1], addresses[1], ages[1]);
std::vector<std::string> sql;
sql.push_back(sql1);
sql.push_back(sql2);
Transaction trans(session);
trans.execute(sql1, false);
session << "SELECT count(*) FROM Person", into(count), now;
assert (1 == count);
trans.execute(sql2, false);
session << "SELECT count(*) FROM Person", into(count), now;
assert (2 == count);
Statement stmt2 = (local << "SELECT COUNT(*) FROM Person", into(locCount), now);
assert (0 == locCount);
trans.rollback();
session << "SELECT count(*) FROM Person", into(count), now;
assert (0 == count);
trans.execute(sql);
Statement stmt3 = (local << "SELECT COUNT(*) FROM Person", into(locCount), now);
assert (2 == locCount);
session << "SELECT count(*) FROM Person", into(count), now;
assert (2 == count);
session.close();
assert (!session.isConnected());
local.close();
assert (!local.isConnected());
}
struct TestCommitTransactor
{
void operator () (Session& session) const
{
session << "INSERT INTO Person VALUES ('lastName','firstName','address',10)", now;
}
};
struct TestRollbackTransactor
{
void operator () (Session& session) const
{
session << "INSERT INTO Person VALUES ('lastName','firstName','address',10)", now;
throw Poco::Exception("test");
}
};
void SQLiteTest::testTransactor()
{
Session session (Poco::Data::SQLite::Connector::KEY, "dummy.db");
assert (session.isConnected());
session << "DROP TABLE IF EXISTS Person", now;
session << "CREATE TABLE IF NOT EXISTS Person (LastName VARCHAR(30), FirstName VARCHAR, Address VARCHAR, Age INTEGER(3))", now;
std::string funct = "transaction()";
int count = 0;
assert (session.getFeature("autoCommit"));
session.setTransactionIsolation(Session::TRANSACTION_READ_COMMITTED);
TestCommitTransactor ct;
Transaction t1(session, ct);
session << "SELECT count(*) FROM Person", into(count), now;
assert (1 == count);
session << "DELETE FROM Person", now;
session << "SELECT count(*) FROM Person", into(count), now;
assert (0 == count);
try
{
TestRollbackTransactor rt;
Transaction t(session, rt);
fail ("must fail");
} catch (Poco::Exception&) { }
session << "SELECT count(*) FROM Person", into(count), now;
assert (0 == count);
try
{
TestRollbackTransactor rt;
Transaction t(session);
t.transact(rt);
fail ("must fail");
} catch (Poco::Exception&) { }
session << "SELECT count(*) FROM Person", into(count), now;
assert (0 == count);
try
{
TestRollbackTransactor rt;
Transaction t(session, false);
t.transact(rt);
fail ("must fail");
} catch (Poco::Exception&) { }
session << "SELECT count(*) FROM Person", into(count), now;
assert (0 == count);
try
{
TestRollbackTransactor rt;
Transaction t(session, true);
t.transact(rt);
fail ("must fail");
} catch (Poco::Exception&) { }
session << "SELECT count(*) FROM Person", into(count), now;
assert (0 == count);
session.close();
assert (!session.isConnected());
}
void SQLiteTest::setUp()
{
}
@ -2749,6 +3301,12 @@ CppUnit::Test* SQLiteTest::suite()
CppUnit_addTest(pSuite, SQLiteTest, testReconnect);
CppUnit_addTest(pSuite, SQLiteTest, testSystemTable);
CppUnit_addTest(pSuite, SQLiteTest, testThreadModes);
CppUnit_addTest(pSuite, SQLiteTest, testUpdateCallback);
CppUnit_addTest(pSuite, SQLiteTest, testCommitCallback);
CppUnit_addTest(pSuite, SQLiteTest, testRollbackCallback);
CppUnit_addTest(pSuite, SQLiteTest, testSessionTransaction);
CppUnit_addTest(pSuite, SQLiteTest, testTransaction);
CppUnit_addTest(pSuite, SQLiteTest, testTransactor);
return pSuite;
}

Просмотреть файл

@ -40,6 +40,14 @@
#include "CppUnit/TestCase.h"
namespace Poco {
namespace Data {
class Session;
} }
class SQLiteTest: public CppUnit::TestCase
{
public:
@ -136,12 +144,29 @@ public:
void testThreadModes();
void testUpdateCallback();
void testCommitCallback();
void testRollbackCallback();
void testSessionTransaction();
void testTransaction();
void testTransactor();
void setUp();
void tearDown();
static void sqliteUpdateCallbackFn(void*, int, const char*, const char*, Poco::Int64);
static int sqliteCommitCallbackFn(void*);
static void sqliteRollbackCallbackFn(void*);
static CppUnit::Test* suite();
private:
void setTransactionIsolation(Poco::Data::Session& session, Poco::UInt32 ti);
static int _insertCounter;
static int _updateCounter;
static int _deleteCounter;
};

Просмотреть файл

@ -225,9 +225,9 @@ public:
val = DateTimeFormatter::format(dt, "%Y/%m/%d");
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Poco::Data::Date& value() const

Просмотреть файл

@ -272,9 +272,9 @@ public:
val.assign(_val.begin(), _val.end());
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Poco::Data::BLOB& value() const
@ -310,9 +310,9 @@ public:
val.assign(_val.begin(), _val.end());
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Poco::Data::CLOB& value() const

Просмотреть файл

@ -81,14 +81,14 @@ public:
Poco::UInt32 getTransactionIsolation();
bool hasTransactionIsolation(Poco::UInt32);
bool isTransactionIsolation(Poco::UInt32);
const std::string& connectorName();
const std::string& connectorName() const;
void setFeature(const std::string& name, bool state);
bool getFeature(const std::string& name);
void setProperty(const std::string& name, const Poco::Any& value);
Poco::Any getProperty(const std::string& name);
protected:
SessionImpl* access();
SessionImpl* access() const;
/// Updates the last access timestamp,
/// verifies validity of the session
/// and returns the session if it is valid.
@ -96,18 +96,18 @@ protected:
/// Throws an SessionUnavailableException if the
/// session is no longer valid.
SessionImpl* impl();
SessionImpl* impl() const;
/// Returns a pointer to the SessionImpl.
private:
Poco::AutoPtr<PooledSessionHolder> _pHolder;
mutable Poco::AutoPtr<PooledSessionHolder> _pHolder;
};
//
// inlines
//
inline SessionImpl* PooledSessionImpl::impl()
inline SessionImpl* PooledSessionImpl::impl() const
{
return _pHolder->session();
}

Просмотреть файл

@ -274,10 +274,10 @@ public:
/// Returns true iff the transaction isolation level corresponds
/// to the supplied bitmask.
std::string connector();
std::string connector() const;
/// Returns the connector name for this session.
std::string uri();
std::string uri() const;
/// Returns the URI for this session.
static std::string uri(const std::string& connector,
@ -443,7 +443,7 @@ inline bool Session::isTransactionIsolation(Poco::UInt32 ti)
}
inline std::string Session::connector()
inline std::string Session::connector() const
{
return _pImpl->connectorName();
}
@ -456,7 +456,7 @@ inline std::string Session::uri(const std::string& connector,
}
inline std::string Session::uri()
inline std::string Session::uri() const
{
return _pImpl->uri();
}

Просмотреть файл

@ -139,16 +139,16 @@ public:
/// Returns true iff the transaction isolation level corresponds
/// to the supplied bitmask.
virtual const std::string& connectorName() = 0;
virtual const std::string& connectorName() const = 0;
/// Returns the name of the connector.
const std::string& connectionString();
const std::string& connectionString() const;
/// Returns the connection string.
static std::string uri(const std::string& connector, const std::string& connectionString);
/// Returns formatted URI.
std::string uri();
std::string uri() const;
/// Returns the URI for this session.
virtual void setFeature(const std::string& name, bool state) = 0;
@ -206,7 +206,7 @@ private:
//
// inlines
//
inline const std::string& SessionImpl::connectionString()
inline const std::string& SessionImpl::connectionString() const
{
return _connectionString;
}
@ -231,7 +231,7 @@ inline std::string SessionImpl::uri(const std::string& connector,
}
inline std::string SessionImpl::uri()
inline std::string SessionImpl::uri() const
{
return uri(connectorName(), connectionString());
}

Просмотреть файл

@ -229,9 +229,9 @@ public:
val = DateTimeFormatter::format(dt, "%H:%M:%S");
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Poco::Data::Time& value() const

Просмотреть файл

@ -52,9 +52,6 @@ struct Person
int main(int argc, char** argv)
{
// register SQLite connector
Poco::Data::SQLite::Connector::registerConnector();
// create a session
Session session("SQLite", "sample.db");

Просмотреть файл

@ -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,84 +32,84 @@
<RootNamespace>RecordSet</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>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</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>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</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>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</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>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</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;">bin\static_mt\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">bin\static_mt\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">false</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">bin\static_md\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">bin\static_md\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">false</LinkIncremental>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">RecordSetd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">RecordSetd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">RecordSetd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">RecordSet</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">RecordSet</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">RecordSet</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'">bin\static_mt\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">bin\static_mt\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">bin\static_md\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">bin\static_md\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">false</LinkIncremental>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">RecordSetd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">RecordSetd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">RecordSetd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">RecordSet</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">RecordSet</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">RecordSet</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;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Data\include;..\..\..\Data\SQLite\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -118,7 +118,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -135,7 +135,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>
@ -150,9 +150,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>
@ -167,7 +167,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;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Data\include;..\..\..\Data\SQLite\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -180,7 +180,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -197,7 +197,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</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>
@ -212,9 +212,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>
@ -229,7 +229,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</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;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Data\include;..\..\..\Data\SQLite\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -242,7 +242,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -259,7 +259,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</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>
@ -274,9 +274,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>
@ -292,8 +292,8 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\RecordSet.cpp"/>
<ClCompile Include="src\RecordSet.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/>
</Project>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

Просмотреть файл

@ -58,9 +58,6 @@ struct Person
int main(int argc, char** argv)
{
// register SQLite connector
Poco::Data::SQLite::Connector::registerConnector();
// create a session
Session session("SQLite", "sample.db");

Просмотреть файл

@ -103,9 +103,6 @@ public:
int main(int argc, char** argv)
{
// register SQLite connector
Poco::Data::SQLite::Connector::registerConnector();
// create a session
Session session("SQLite", "sample.db");

Просмотреть файл

@ -50,9 +50,6 @@ int main(int argc, char** argv)
typedef Poco::Tuple<std::string, std::string, int> Person;
typedef std::vector<Person> People;
// register SQLite connector
Poco::Data::SQLite::Connector::registerConnector();
// create a session
Session session("SQLite", "sample.db");

Просмотреть файл

@ -103,9 +103,6 @@ public:
int main(int argc, char** argv)
{
// register SQLite connector
Poco::Data::SQLite::Connector::registerConnector();
// create a session
Session session("SQLite", "sample.db");

Просмотреть файл

@ -142,15 +142,17 @@ using Poco::DateTime;
template <>
Var::operator Date () const
{
if (!_pHolder)
VarHolder* pHolder = content();
if (!pHolder)
throw InvalidAccessException("Can not convert empty value.");
if (typeid(Date) == _pHolder->type())
if (typeid(Date) == pHolder->type())
return extract<Date>();
else
{
Poco::DateTime result;
_pHolder->convert(result);
pHolder->convert(result);
return Date(result);
}
}

Просмотреть файл

@ -53,15 +53,17 @@ using Poco::Data::BLOB;
template <>
Var::operator CLOB () const
{
if (!_pHolder)
VarHolder* pHolder = content();
if (!pHolder)
throw InvalidAccessException("Can not convert empty value.");
if (typeid(CLOB) == _pHolder->type())
if (typeid(CLOB) == pHolder->type())
return extract<CLOB>();
else
{
std::string result;
_pHolder->convert(result);
pHolder->convert(result);
return CLOB(result);
}
}
@ -70,15 +72,17 @@ Var::operator CLOB () const
template <>
Var::operator BLOB () const
{
if (!_pHolder)
VarHolder* pHolder = content();
if (!pHolder)
throw InvalidAccessException("Can not convert empty value.");
if (typeid(BLOB) == _pHolder->type())
if (typeid(BLOB) == pHolder->type())
return extract<BLOB>();
else
{
std::string result;
_pHolder->convert(result);
pHolder->convert(result);
return BLOB(reinterpret_cast<const unsigned char*>(result.data()),
result.size());
}

Просмотреть файл

@ -163,7 +163,7 @@ void PooledSessionImpl::close()
}
const std::string& PooledSessionImpl::connectorName()
const std::string& PooledSessionImpl::connectorName() const
{
return access()->connectorName();
}
@ -193,7 +193,7 @@ Poco::Any PooledSessionImpl::getProperty(const std::string& name)
}
SessionImpl* PooledSessionImpl::access()
SessionImpl* PooledSessionImpl::access() const
{
if (_pHolder)
{

Просмотреть файл

@ -476,7 +476,8 @@ void StatementImpl::formatSQL(std::vector<Any>& arguments)
{
std::string sql;
Poco::format(sql, _ostr.str(), arguments);
_ostr.str(""); _ostr << sql;
_ostr.str("");
_ostr << sql;
}

Просмотреть файл

@ -139,15 +139,17 @@ using Poco::DateTime;
template <>
Var::operator Time () const
{
if (!_pHolder)
VarHolder* pHolder = content();
if (!pHolder)
throw InvalidAccessException("Can not convert empty value.");
if (typeid(Time) == _pHolder->type())
if (typeid(Time) == pHolder->type())
return extract<Time>();
else
{
Poco::DateTime result;
_pHolder->convert(result);
pHolder->convert(result);
return Time(result);
}
}

Просмотреть файл

@ -145,7 +145,7 @@ bool SessionImpl::isTransactionIsolation(Poco::UInt32)
}
const std::string& SessionImpl::connectorName()
const std::string& SessionImpl::connectorName() const
{
return Connector::KEY;
}

Просмотреть файл

@ -105,7 +105,7 @@ public:
/// Returns true iff the transaction isolation level corresponds
/// to the supplied bitmask.
const std::string& connectorName();
const std::string& connectorName() const;
/// Returns the name of the connector.
void setConnected(const std::string& name, bool value);

Просмотреть файл

@ -6689,6 +6689,10 @@
RelativePath=".\include\Poco\ObjectPool.h"
>
</File>
<File
RelativePath=".\include\Poco\Optional.h"
>
</File>
<File
RelativePath=".\include\Poco\Platform.h"
>
@ -6721,6 +6725,10 @@
RelativePath=".\include\Poco\SingletonHolder.h"
>
</File>
<File
RelativePath=".\include\Poco\SmallObjectAllocator.h"
>
</File>
<File
RelativePath=".\include\Poco\String.h"
>

Просмотреть файл

@ -1024,6 +1024,7 @@
<ClInclude Include="include\Poco\NumberParser.h" />
<ClInclude Include="include\Poco\NumericString.h" />
<ClInclude Include="include\Poco\ObjectPool.h" />
<ClInclude Include="include\Poco\Optional.h" />
<ClInclude Include="include\Poco\Platform.h" />
<ClInclude Include="include\Poco\Platform_POSIX.h" />
<ClInclude Include="include\Poco\Platform_VMS.h" />
@ -1033,6 +1034,7 @@
<ClInclude Include="include\Poco\RefCountedObject.h" />
<ClInclude Include="include\Poco\SharedPtr.h" />
<ClInclude Include="include\Poco\SingletonHolder.h" />
<ClInclude Include="include\Poco\SmallObjectAllocator.h" />
<ClInclude Include="include\Poco\String.h" />
<ClInclude Include="include\Poco\StringTokenizer.h" />
<ClInclude Include="include\Poco\Tuple.h" />

Просмотреть файл

@ -1853,6 +1853,12 @@
<ClInclude Include="include\Poco\Base32Encoder.h">
<Filter>Streams\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\SmallObjectAllocator.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Optional.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="src\pocomsg.rc">

Просмотреть файл

@ -1027,6 +1027,7 @@
<ClInclude Include="include\Poco\NumberParser.h" />
<ClInclude Include="include\Poco\NumericString.h" />
<ClInclude Include="include\Poco\ObjectPool.h" />
<ClInclude Include="include\Poco\Optional.h" />
<ClInclude Include="include\Poco\Platform.h" />
<ClInclude Include="include\Poco\Platform_POSIX.h" />
<ClInclude Include="include\Poco\Platform_VMS.h" />
@ -1036,6 +1037,7 @@
<ClInclude Include="include\Poco\RefCountedObject.h" />
<ClInclude Include="include\Poco\SharedPtr.h" />
<ClInclude Include="include\Poco\SingletonHolder.h" />
<ClInclude Include="include\Poco\SmallObjectAllocator.h" />
<ClInclude Include="include\Poco\String.h" />
<ClInclude Include="include\Poco\StringTokenizer.h" />
<ClInclude Include="include\Poco\Tuple.h" />

Просмотреть файл

@ -1037,6 +1037,9 @@
<ClInclude Include="include\Poco\SingletonHolder.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\SmallObjectAllocator.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\String.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
@ -1850,6 +1853,9 @@
<ClInclude Include="include\Poco\ObjectPool.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Optional.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="src\pocomsg.rc">

Просмотреть файл

@ -904,6 +904,12 @@
<File
RelativePath=".\include\Poco\NumericString.h">
</File>
<File
RelativePath=".\include\Poco\Optional.h">
</File>
<File
RelativePath=".\include\Poco\ObjectPool.h">
</File>
<File
RelativePath=".\include\Poco\Platform.h">
</File>
@ -928,6 +934,9 @@
<File
RelativePath=".\include\Poco\SingletonHolder.h">
</File>
<File
RelativePath=".\include\Poco\SmallObjectAllocator.h">
</File>
<File
RelativePath=".\include\Poco\String.h">
</File>

Просмотреть файл

@ -1207,6 +1207,14 @@
RelativePath=".\include\Poco\NumericString.h"
>
</File>
<File
RelativePath=".\include\Poco\ObjectPool.h"
>
</File>
<File
RelativePath=".\include\Poco\Optional.h"
>
</File>
<File
RelativePath=".\include\Poco\Platform.h"
>
@ -1239,6 +1247,10 @@
RelativePath=".\include\Poco\SingletonHolder.h"
>
</File>
<File
RelativePath=".\include\Poco\SmallObjectAllocator.h"
>
</File>
<File
RelativePath=".\include\Poco\String.h"
>

Просмотреть файл

@ -1204,6 +1204,14 @@
RelativePath=".\include\Poco\NumericString.h"
>
</File>
<File
RelativePath=".\include\Poco\ObjectPool.h"
>
</File>
<File
RelativePath=".\include\Poco\Optional.h"
>
</File>
<File
RelativePath=".\include\Poco\Platform.h"
>
@ -1236,6 +1244,10 @@
RelativePath=".\include\Poco\SingletonHolder.h"
>
</File>
<File
RelativePath=".\include\Poco\SmallObjectAllocator.h"
>
</File>
<File
RelativePath=".\include\Poco\String.h"
>

Просмотреть файл

@ -108,7 +108,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;Foundation_EXPORTS;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;_USRDLL;Foundation_EXPORTS;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -143,7 +143,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>.\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;Foundation_EXPORTS;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;_USRDLL;Foundation_EXPORTS;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
<PreprocessKeepComments>false</PreprocessKeepComments>
@ -183,7 +183,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>.\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;Foundation_EXPORTS;POCO_STATIC;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;Foundation_EXPORTS;POCO_STATIC;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
<PreprocessKeepComments>false</PreprocessKeepComments>
@ -211,7 +211,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;Foundation_EXPORTS;POCO_STATIC;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;Foundation_EXPORTS;POCO_STATIC;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -238,7 +238,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;Foundation_EXPORTS;POCO_STATIC;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;Foundation_EXPORTS;POCO_STATIC;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -269,7 +269,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>.\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;Foundation_EXPORTS;POCO_STATIC;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;Foundation_EXPORTS;POCO_STATIC;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
<PreprocessKeepComments>false</PreprocessKeepComments>
@ -1025,6 +1025,8 @@
<ClInclude Include="include\Poco\NumberFormatter.h" />
<ClInclude Include="include\Poco\NumberParser.h" />
<ClInclude Include="include\Poco\NumericString.h" />
<ClInclude Include="include\Poco\ObjectPool.h" />
<ClInclude Include="include\Poco\Optional.h" />
<ClInclude Include="include\Poco\Platform.h" />
<ClInclude Include="include\Poco\Platform_POSIX.h" />
<ClInclude Include="include\Poco\Platform_VMS.h" />
@ -1034,6 +1036,7 @@
<ClInclude Include="include\Poco\RefCountedObject.h" />
<ClInclude Include="include\Poco\SharedPtr.h" />
<ClInclude Include="include\Poco\SingletonHolder.h" />
<ClInclude Include="include\Poco\SmallObjectAllocator.h" />
<ClInclude Include="include\Poco\String.h" />
<ClInclude Include="include\Poco\StringTokenizer.h" />
<ClInclude Include="include\Poco\Tuple.h" />

Просмотреть файл

@ -1013,6 +1013,12 @@
<ClInclude Include="include\Poco\NumericString.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\ObjectPool.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Optional.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Platform.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
@ -1841,6 +1847,9 @@
<ClInclude Include="include\Poco\UTF32Encoding.h">
<Filter>Text\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\SmallObjectAllocator.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="src\pocomsg.rc">

Просмотреть файл

@ -1031,6 +1031,8 @@
<ClInclude Include="include\Poco\NumberFormatter.h" />
<ClInclude Include="include\Poco\NumberParser.h" />
<ClInclude Include="include\Poco\NumericString.h" />
<ClInclude Include="include\Poco\ObjectPool.h" />
<ClInclude Include="include\Poco\Optional.h" />
<ClInclude Include="include\Poco\Platform.h" />
<ClInclude Include="include\Poco\Platform_POSIX.h" />
<ClInclude Include="include\Poco\Platform_VMS.h" />
@ -1040,6 +1042,7 @@
<ClInclude Include="include\Poco\RefCountedObject.h" />
<ClInclude Include="include\Poco\SharedPtr.h" />
<ClInclude Include="include\Poco\SingletonHolder.h" />
<ClInclude Include="include\Poco\SmallObjectAllocator.h" />
<ClInclude Include="include\Poco\String.h" />
<ClInclude Include="include\Poco\StringTokenizer.h" />
<ClInclude Include="include\Poco\Tuple.h" />

Просмотреть файл

@ -1013,6 +1013,12 @@
<ClInclude Include="include\Poco\NumericString.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\ObjectPool.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Optional.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Platform.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
@ -1037,6 +1043,9 @@
<ClInclude Include="include\Poco\SingletonHolder.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\SmallObjectAllocator.h">
<Filter>Core\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\String.h">
<Filter>Core\Header Files</Filter>
</ClInclude>

Просмотреть файл

@ -1198,6 +1198,14 @@
RelativePath=".\include\Poco\NumberParser.h"
>
</File>
<File
RelativePath=".\include\Poco\ObjectPool.h"
>
</File>
<File
RelativePath=".\include\Poco\Optional.h"
>
</File>
<File
RelativePath=".\include\Poco\NumericString.h"
>
@ -1234,6 +1242,10 @@
RelativePath=".\include\Poco\SingletonHolder.h"
>
</File>
<File
RelativePath=".\include\Poco\SmallObjectAllocator.h"
>
</File>
<File
RelativePath=".\include\Poco\String.h"
>

Просмотреть файл

@ -5,7 +5,7 @@
//
// Library: Foundation
// Package: Core
// Module: Any
// Module: Any
//
// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved.
// Extracted from Boost 1.33.1 lib and adapted for poco: Peter Schojer/AppliedInformatics 2006-02-02
@ -39,30 +39,283 @@
#include "Poco/Exception.h"
#include "Poco/MetaProgramming.h"
#include <algorithm>
#include <typeinfo>
#include <cstring>
namespace Poco {
namespace Dynamic {
class Var;
class VarHolder;
template <class> class VarHolderImpl;
}
template <typename PlaceholderT, unsigned int SizeV = POCO_SMALL_OBJECT_SIZE>
union Placeholder
/// ValueHolder union (used by Poco::Any and Poco::Dynamic::Var for small
/// object optimization).
///
/// If Holder<Type> fits into POCO_SMALL_OBJECT_SIZE bytes of storage,
/// it will be placement-new-allocated into the local buffer
/// (i.e. there will be no heap-allocation). The local buffer size is one byte
/// larger - [POCO_SMALL_OBJECT_SIZE + 1], additional byte value indicating
/// where the object was allocated (0 => heap, 1 => local).
{
public:
struct Size
{
static const unsigned int value = SizeV;
};
Placeholder ()
{
erase();
}
void erase()
{
std::memset(holder, 0, sizeof(Placeholder));
}
bool isLocal() const
{
return holder[SizeV] != 0;
}
void setLocal(bool local) const
{
holder[SizeV] = local ? 1 : 0;
}
PlaceholderT* content() const
{
if(isLocal())
return reinterpret_cast<PlaceholderT*>(holder);
else
return pHolder;
}
private:
PlaceholderT* pHolder;
mutable unsigned char holder[SizeV + 1];
friend class Any;
friend class Dynamic::Var;
friend class Dynamic::VarHolder;
template <class> friend class Dynamic::VarHolderImpl;
};
class Any
/// An Any class represents a general type and is capable of storing any type, supporting type-safe extraction
/// of the internally stored data.
///
/// Code taken from the Boost 1.33.1 library. Original copyright by Kevlin Henney. Modified for Poco
/// by Applied Informatics.
///
/// Modified for small object optimization support (optionally supported through conditional compilation)
/// by Alex Fabijanic.
{
public:
Any():
_content(0)
#ifndef POCO_NO_SOO
Any()
/// Creates an empty any type.
{
}
template<typename ValueType>
Any(const ValueType & value)
/// Creates an any which stores the init parameter inside.
///
/// Example:
/// Any a(13);
/// Any a(string("12345"));
{
construct(value);
}
Any(const Any& other)
/// Copy constructor, works with both empty and initialized Any values.
{
if ((this != &other) && !other.empty())
construct(other);
}
~Any()
/// Destructor. If Any is locally held, calls ValueHolder destructor;
/// otherwise, deletes the placeholder from the heap.
{
if(!empty())
{
if(_valueHolder.isLocal())
content()->~ValueHolder();
else
delete content();
}
}
Any& swap(Any& other)
/// Swaps the content of the two Anys.
///
/// When small object optimizaton is enabled,
/// swap is only exception-safe when both (*this and
/// other) objects are allocated on the heap.
{
if (this == &other) return *this;
if (!_valueHolder.isLocal() && !other._valueHolder.isLocal())
{
std::swap(_valueHolder.pHolder, other._valueHolder.pHolder);
}
else
{
Any tmp(*this);
if (_valueHolder.isLocal()) this->~Any();
construct(other);
other = tmp;
}
return *this;
}
template<typename ValueType>
Any & operator = (const ValueType& rhs)
/// Assignment operator for all types != Any.
///
/// Example:
/// Any a = 13;
/// Any a = string("12345");
{
construct(rhs);
return *this;
}
Any& operator = (const Any& rhs)
/// Assignment operator for Any.
{
if ((this != &rhs) && !rhs.empty())
construct(rhs);
else if ((this != &rhs) && rhs.empty())
_valueHolder.erase();
return *this;
}
bool empty() const
/// Returns true if the Any is empty.
{
char buf[POCO_SMALL_OBJECT_SIZE] = { 0 };
return 0 == std::memcmp(_valueHolder.holder, buf, POCO_SMALL_OBJECT_SIZE);
}
const std::type_info & type() const
/// Returns the type information of the stored content.
/// If the Any is empty typeid(void) is returned.
/// It is recommended to always query an Any for its type info before
/// trying to extract data via an AnyCast/RefAnyCast.
{
return empty() ? typeid(void) : content()->type();
}
private:
class ValueHolder
{
public:
virtual ~ValueHolder()
{
}
virtual const std::type_info & type() const = 0;
virtual void clone(Placeholder<ValueHolder>*) const = 0;
};
template<typename ValueType>
class Holder : public ValueHolder
{
public:
Holder(const ValueType & value) : _held(value)
{
}
virtual const std::type_info & type() const
{
return typeid(ValueType);
}
virtual void clone(Placeholder<ValueHolder>* pPlaceholder) const
{
if ((sizeof(Holder<ValueType>) <= POCO_SMALL_OBJECT_SIZE))
{
new ((ValueHolder*) pPlaceholder->holder) Holder(_held);
pPlaceholder->setLocal(true);
}
else
{
pPlaceholder->pHolder = new Holder(_held);
pPlaceholder->setLocal(false);
}
}
ValueType _held;
private:
Holder & operator = (const Holder &);
};
ValueHolder* content() const
{
return _valueHolder.content();
}
template<typename ValueType>
void construct(const ValueType& value)
{
if (sizeof(Holder<ValueType>) <= Placeholder<ValueType>::Size::value)
{
new (reinterpret_cast<ValueHolder*>(_valueHolder.holder)) Holder<ValueType>(value);
_valueHolder.setLocal(true);
}
else
{
_valueHolder.pHolder = new Holder<ValueType>(value);
_valueHolder.setLocal(false);
}
}
void construct(const Any& other)
{
if(!other.empty())
other.content()->clone(&_valueHolder);
else
_valueHolder.erase();
}
Placeholder<ValueHolder> _valueHolder;
#else // if POCO_NO_SOO
Any(): _pHolder(0)
/// Creates an empty any type.
{
}
template <typename ValueType>
Any(const ValueType& value):
_content(new Holder<ValueType>(value))
_pHolder(new Holder<ValueType>(value))
/// Creates an any which stores the init parameter inside.
///
/// Example:
@ -72,20 +325,20 @@ public:
}
Any(const Any& other):
_content(other._content ? other._content->clone() : 0)
/// Copy constructor, works with empty Anys and initialized Any values.
_pHolder(other._pHolder ? other._pHolder->clone() : 0)
/// Copy constructor, works with both empty and initialized Any values.
{
}
~Any()
{
delete _content;
delete _pHolder;
}
Any& swap(Any& rhs)
/// Swaps the content of the two Anys.
{
std::swap(_content, rhs._content);
std::swap(_pHolder, rhs._pHolder);
return *this;
}
@ -94,8 +347,8 @@ public:
/// Assignment operator for all types != Any.
///
/// Example:
/// Any a = 13;
/// Any a = string("12345");
/// Any a = 13;
/// Any a = string("12345");
{
Any(rhs).swap(*this);
return *this;
@ -109,34 +362,34 @@ public:
}
bool empty() const
/// returns true if the Any is empty
/// Returns true if the Any is empty.
{
return !_content;
return !_pHolder;
}
const std::type_info& type() const
/// Returns the type information of the stored content.
/// If the Any is empty typeid(void) is returned.
/// It is suggested to always query an Any for its type info before trying to extract
/// data via an AnyCast/RefAnyCast.
/// It is recommended to always query an Any for its type info before
/// trying to extract data via an AnyCast/RefAnyCast.
{
return _content ? _content->type() : typeid(void);
return _pHolder ? _pHolder->type() : typeid(void);
}
private:
class Placeholder
class ValueHolder
{
public:
virtual ~Placeholder()
virtual ~ValueHolder()
{
}
virtual const std::type_info& type() const = 0;
virtual Placeholder* clone() const = 0;
virtual ValueHolder* clone() const = 0;
};
template <typename ValueType>
class Holder: public Placeholder
class Holder: public ValueHolder
{
public:
Holder(const ValueType& value):
@ -149,22 +402,33 @@ private:
return typeid(ValueType);
}
virtual Placeholder* clone() const
virtual ValueHolder* clone() const
{
return new Holder(_held);
}
ValueType _held;
private:
Holder & operator=(const Holder &);
};
ValueHolder* content() const
{
return _pHolder;
}
private:
ValueHolder* _pHolder;
#endif // POCO_NO_SOO
template <typename ValueType>
friend ValueType* AnyCast(Any*);
template <typename ValueType>
friend ValueType* UnsafeAnyCast(Any*);
Placeholder* _content;
};
@ -178,7 +442,7 @@ ValueType* AnyCast(Any* operand)
/// Will return NULL if the cast fails, i.e. types don't match.
{
return operand && operand->type() == typeid(ValueType)
? &static_cast<Any::Holder<ValueType>*>(operand->_content)->_held
? &static_cast<Any::Holder<ValueType>*>(operand->content())->_held
: 0;
}
@ -207,9 +471,9 @@ ValueType AnyCast(const Any& operand)
/// Some compilers will accept this code although a copy is returned. Use the RefAnyCast in
/// these cases.
{
ValueType* result = AnyCast<ValueType>(const_cast<Any*>(&operand));
if (!result) throw BadCastException("Failed to convert between const Any types");
return *result;
typedef typename TypeWrapper<ValueType>::TYPE NonRef;
return AnyCast<NonRef&>(const_cast<Any&>(operand));
}
@ -224,7 +488,9 @@ ValueType AnyCast(Any& operand)
/// Some compilers will accept this code although a copy is returned. Use the RefAnyCast in
/// these cases.
{
ValueType* result = AnyCast<ValueType>(&operand);
typedef typename TypeWrapper<ValueType>::TYPE NonRef;
NonRef* result = AnyCast<NonRef>(&operand);
if (!result) throw BadCastException("Failed to convert between Any types");
return *result;
}
@ -264,7 +530,7 @@ ValueType* UnsafeAnyCast(Any* operand)
/// use typeid() comparison, e.g., when our types may travel across
/// different shared libraries.
{
return &static_cast<Any::Holder<ValueType>*>(operand->_content)->_held;
return &static_cast<Any::Holder<ValueType>*>(operand->content())->_held;
}

Просмотреть файл

@ -51,6 +51,14 @@
// #define POCO_NO_AUTOMATIC_LIBS
// Define to disable automatic initialization
// Defining this will disable ALL automatic
// initialization framework-wide (e.g. Net
// on Windows, all Data back-ends, etc).
//
// #define POCO_NO_AUTOMATIC_LIB_INIT
// Define to disable FPEnvironment support
// #define POCO_NO_FPENVIRONMENT
@ -86,6 +94,23 @@
// #define POCO_THREAD_PRIORITY_MAX 31
// Define to disable small object optimization. If not
// defined, Any and Dynamic::Var (and similar optimization
// candidates) will be auto-allocated on the stack in
// cases when value holder fits into POCO_SMALL_OBJECT_SIZE
// (see Poco/Types.h for default values).
// #define POCO_NO_SOO
// Small object size in bytes. Where applicable (e.g.
// SmallObjectAllocator<char*> specialization, Any, Var, etc)
// objects longer than this value will be alocated on the heap.
// See Poco/SmallObjectAllocator.h for usage of this value.
#if !defined(POCO_SMALL_OBJECT_SIZE)
#define POCO_SMALL_OBJECT_SIZE 32
#endif
// Following are options to remove certain features
// to reduce library/executable size for smaller
// embedded platforms. By enabling these options,

Просмотреть файл

@ -229,9 +229,9 @@ public:
throw BadCastException("Pair -> Poco::Timestamp");
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Pair<std::string>& value() const
@ -378,9 +378,9 @@ public:
throw BadCastException("Pair -> Poco::Timestamp");
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Pair<int>& value() const

Просмотреть файл

@ -325,9 +325,9 @@ public:
throw BadCastException("Struct -> Poco::Timestamp");
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Struct<std::string>& value() const
@ -496,9 +496,9 @@ public:
throw BadCastException("Struct -> Poco::Timestamp");
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Struct<int>& value() const

Просмотреть файл

@ -53,6 +53,7 @@ namespace Dynamic {
template <typename T>
class Struct;
class Foundation_API Var
/// Var allows to store data of different types and to convert between these types transparently.
/// Var puts forth the best effort to provide intuitive and reasonable conversion semantics and prevent
@ -88,7 +89,7 @@ class Foundation_API Var
/// '+', '+=', '-', '-=', '*', '*=' , '/' and '/='
///
/// - for integral values, following operations are supported:
/// prefix and postfix increment (++) and decement (--)
/// prefix and postfix increment (++) and decrement (--)
///
/// - for all other types, InvalidArgumentException is thrown upon attempt of an arithmetic operation
///
@ -100,11 +101,15 @@ public:
/// Creates an empty Var.
template <typename T>
Var(const T& val):
_pHolder(new VarHolderImpl<T>(val))
Var(const T& val)
/// Creates the Var from the given value.
#ifdef POCO_NO_SOO
:_pHolder(new VarHolderImpl<T>(val)) { }
#else
{
construct(val);
}
#endif
Var(const char* pVal);
// Convenience constructor for const char* which gets mapped to a std::string internally, i.e. pVal is deep-copied.
@ -133,10 +138,12 @@ public:
/// not available for the given type.
/// Throws InvalidAccessException if Var is empty.
{
if (!_pHolder)
VarHolder* pHolder = content();
if (!pHolder)
throw InvalidAccessException("Can not convert empty value.");
_pHolder->convert(val);
pHolder->convert(val);
}
template <typename T>
@ -153,13 +160,15 @@ public:
/// not available for the given type.
/// Throws InvalidAccessException if Var is empty.
{
if (!_pHolder)
VarHolder* pHolder = content();
if (!pHolder)
throw InvalidAccessException("Can not convert empty value.");
if (typeid(T) == _pHolder->type()) return extract<T>();
if (typeid(T) == pHolder->type()) return extract<T>();
T result;
_pHolder->convert(result);
pHolder->convert(result);
return result;
}
@ -177,15 +186,17 @@ public:
/// not available for the given type.
/// Throws InvalidAccessException if Var is empty.
{
if (!_pHolder)
VarHolder* pHolder = content();
if (!pHolder)
throw InvalidAccessException("Can not convert empty value.");
if (typeid(T) == _pHolder->type())
if (typeid(T) == pHolder->type())
return extract<T>();
else
{
T result;
_pHolder->convert(result);
pHolder->convert(result);
return result;
}
}
@ -199,16 +210,18 @@ public:
/// is thrown.
/// Throws InvalidAccessException if Var is empty.
{
if (_pHolder && _pHolder->type() == typeid(T))
VarHolder* pHolder = content();
if (pHolder && pHolder->type() == typeid(T))
{
VarHolderImpl<T>* pHolderImpl = static_cast<VarHolderImpl<T>*>(_pHolder);
VarHolderImpl<T>* pHolderImpl = static_cast<VarHolderImpl<T>*>(pHolder);
return pHolderImpl->value();
}
else if (!_pHolder)
else if (!pHolder)
throw InvalidAccessException("Can not extract empty value.");
else
throw BadCastException(format("Can not convert %s to %s.",
_pHolder->type().name(),
pHolder->type().name(),
typeid(T).name()));
}
@ -216,8 +229,12 @@ public:
Var& operator = (const T& other)
/// Assignment operator for assigning POD to Var
{
#ifdef POCO_NO_SOO
Var tmp(other);
swap(tmp);
#else
construct(other);
#endif
return *this;
}
@ -536,9 +553,11 @@ private:
template <typename T, typename E>
VarHolderImpl<T>* holderImpl(const std::string errorMessage = "") const
{
if (_pHolder && _pHolder->type() == typeid(T))
return static_cast<VarHolderImpl<T>*>(_pHolder);
else if (!_pHolder)
VarHolder* pHolder = content();
if (pHolder && pHolder->type() == typeid(T))
return static_cast<VarHolderImpl<T>*>(pHolder);
else if (!pHolder)
throw InvalidAccessException("Can not access empty value.");
else
throw E(errorMessage);
@ -546,7 +565,64 @@ private:
Var& structIndexOperator(VarHolderImpl<Struct<int> >* pStr, int n) const;
#ifdef POCO_NO_SOO
VarHolder* content() const
{
return _pHolder;
}
VarHolder* _pHolder;
#else
VarHolder* content() const
{
return _placeholder.content();
}
template<typename ValueType>
void construct(const ValueType& value)
{
if (sizeof(VarHolderImpl<ValueType>) <= Placeholder<ValueType>::Size::value)
{
new (reinterpret_cast<VarHolder*>(_placeholder.holder)) VarHolderImpl<ValueType>(value);
_placeholder.setLocal(true);
}
else
{
_placeholder.pHolder = new VarHolderImpl<ValueType>(value);
_placeholder.setLocal(false);
}
}
void construct(const char* value)
{
std::string val(value);
if (sizeof(VarHolderImpl<std::string>) <= Placeholder<std::string>::Size::value)
{
new (reinterpret_cast<VarHolder*>(_placeholder.holder)) VarHolderImpl<std::string>(val);
_placeholder.setLocal(true);
}
else
{
_placeholder.pHolder = new VarHolderImpl<std::string>(val);
_placeholder.setLocal(false);
}
}
void construct(const Var& other)
{
if(!other.isEmpty())
other.content()->clone(&_placeholder);
else
_placeholder.erase();
}
Placeholder<VarHolder> _placeholder;
#endif // POCO_NO_SOO
};
@ -559,15 +635,36 @@ private:
/// Var members
///
inline void Var::swap(Var& ptr)
inline void Var::swap(Var& other)
{
std::swap(_pHolder, ptr._pHolder);
#ifdef POCO_NO_SOO
std::swap(_pHolder, other._pHolder);
#else
if (this == &other) return;
if (!_placeholder.isLocal() && !other._placeholder.isLocal())
{
std::swap(_placeholder.pHolder, other._placeholder.pHolder);
}
else
{
Var tmp(*this);
if (_placeholder.isLocal()) this->~Var();
construct(other);
other = tmp;
}
#endif
}
inline const std::type_info& Var::type() const
{
return _pHolder ? _pHolder->type() : typeid(void);
VarHolder* pHolder = content();
return pHolder ? pHolder->type() : typeid(void);
}
@ -603,49 +700,56 @@ inline bool Var::operator ! () const
inline bool Var::isEmpty() const
{
return 0 == _pHolder;
return 0 == content();
}
inline bool Var::isArray() const
{
return _pHolder ? _pHolder->isArray() : false;
VarHolder* pHolder = content();
return pHolder ? pHolder->isArray() : false;
}
inline bool Var::isStruct() const
{
return _pHolder ? _pHolder->isStruct() : false;
VarHolder* pHolder = content();
return pHolder ? pHolder->isStruct() : false;
}
inline bool Var::isInteger() const
{
return _pHolder ? _pHolder->isInteger() : false;
VarHolder* pHolder = content();
return pHolder ? pHolder->isInteger() : false;
}
inline bool Var::isSigned() const
{
return _pHolder ? _pHolder->isSigned() : false;
VarHolder* pHolder = content();
return pHolder ? pHolder->isSigned() : false;
}
inline bool Var::isNumeric() const
{
return _pHolder ? _pHolder->isNumeric() : false;
VarHolder* pHolder = content();
return pHolder ? pHolder->isNumeric() : false;
}
inline bool Var::isString() const
{
return _pHolder ? _pHolder->isString() : false;
VarHolder* pHolder = content();
return pHolder ? pHolder->isString() : false;
}
///
/// Var non-member functions
///
inline const Var operator + (const char* other, const Var& da)
/// Addition operator for adding Var to const char*
{

Просмотреть файл

@ -50,6 +50,7 @@
#include "Poco/DateTimeFormatter.h"
#include "Poco/DateTimeParser.h"
#include "Poco/String.h"
#include "Poco/Any.h"
#include "Poco/Exception.h"
#include <vector>
#include <typeinfo>
@ -68,6 +69,7 @@ class Var;
bool Foundation_API isJSONString(const Var& any);
/// Returns true for values that should be JSON-formatted as string.
void Foundation_API appendJSONString(std::string& val, const Var& any);
/// Converts the any to a JSON value and adds it to val
@ -92,13 +94,17 @@ public:
virtual ~VarHolder();
/// Destroys the VarHolder.
virtual VarHolder* clone() const;
/// Throws NotImplementedException. Implementation should
virtual VarHolder* clone(Placeholder<VarHolder>* pHolder = 0) const = 0;
/// Implementation must implement this function to
/// deep-copy the VarHolder.
virtual const std::type_info& type() const;
/// Throws NotImplementedException. Implementation should
/// return the type information for the stored content.
/// If small object optimization is enabled (i.e. if
/// POCO_NO_SOO is not defined), VarHolder will be
/// instantiated in-place if it's size is smaller
/// than POCO_SMALL_OBJECT_SIZE.
virtual const std::type_info& type() const = 0;
/// Implementation must return the type information
/// (typeid) for the stored content.
virtual void convert(Int8& val) const;
/// Throws BadCastException. Must be overriden in a type
@ -145,12 +151,15 @@ public:
/// specialization in order to suport the conversion.
#ifndef POCO_LONG_IS_64_BIT
void convert(long& val) const;
/// Calls convert(Int32).
void convert(unsigned long& val) const;
/// Calls convert(UInt32).
#endif
virtual void convert(bool& val) const;
/// Throws BadCastException. Must be overriden in a type
/// specialization in order to suport the conversion.
@ -199,6 +208,35 @@ protected:
VarHolder();
/// Creates the VarHolder.
template <typename T>
VarHolder* cloneHolder(Placeholder<VarHolder>* pVarHolder, const T& val) const
/// Instantiates value holder wrapper. If size of the wrapper is
/// larger than POCO_SMALL_OBJECT_SIZE, holder is instantiated on
/// the heap, otherwise it is instantiated in-place (in the
/// pre-allocated buffer inside the holder).
///
/// Called from clone() member function of the implementation when
/// smal object optimization is enabled.
{
#ifdef POCO_NO_SOO
return new VarHolderImpl<T>(val);
#else
poco_check_ptr (pVarHolder);
if ((sizeof(VarHolderImpl<T>) <= Placeholder<T>::Size::value))
{
new ((VarHolder*) pVarHolder->holder) VarHolderImpl<T>(val);
pVarHolder->setLocal(true);
return (VarHolder*) pVarHolder->holder;
}
else
{
pVarHolder->pHolder = new VarHolderImpl<T>(val);
pVarHolder->setLocal(false);
return pVarHolder->pHolder;
}
#endif
}
template <typename F, typename T>
void convertToSmaller(const F& from, T& to) const
/// This function is meant to convert signed numeric values from
@ -338,16 +376,6 @@ private:
// inlines
//
inline VarHolder* VarHolder::clone() const
{
throw NotImplementedException("Not implemented: VarHolder::clone()");
}
inline const std::type_info& VarHolder::type() const
{
throw NotImplementedException("Not implemented: VarHolder::type()");
}
inline void VarHolder::convert(Int8& /*val*/) const
{
@ -414,8 +442,8 @@ inline void VarHolder::convert(Timestamp& /*val*/) const
throw BadCastException("Can not convert to Timestamp");
}
#ifndef POCO_LONG_IS_64_BIT
inline void VarHolder::convert(long& val) const
{
Int32 tmp;
@ -430,8 +458,8 @@ inline void VarHolder::convert(unsigned long& val) const
convert(tmp);
val = tmp;
}
#endif
#endif
inline void VarHolder::convert(bool& /*val*/) const
{
@ -533,9 +561,9 @@ public:
return typeid(T);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const T& value() const
@ -634,9 +662,9 @@ public:
val = NumberFormatter::format(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Int8& value() const
@ -767,9 +795,9 @@ public:
val = NumberFormatter::format(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Int16& value() const
@ -900,9 +928,9 @@ public:
val = NumberFormatter::format(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Int32& value() const
@ -1048,9 +1076,9 @@ public:
val = Timestamp(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Int64& value() const
@ -1181,9 +1209,9 @@ public:
val = NumberFormatter::format(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const UInt8& value() const
@ -1314,9 +1342,9 @@ public:
val = NumberFormatter::format(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const UInt16& value() const
@ -1447,9 +1475,9 @@ public:
val = NumberFormatter::format(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const UInt32& value() const
@ -1601,9 +1629,9 @@ public:
val = Timestamp(tmp);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const UInt64& value() const
@ -1732,9 +1760,9 @@ public:
val = (_val ? "true" : "false");
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const bool& value() const
@ -1866,9 +1894,9 @@ public:
val = NumberFormatter::format(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const float& value() const
@ -2006,9 +2034,9 @@ public:
val = NumberFormatter::format(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const double& value() const
@ -2137,9 +2165,9 @@ public:
val = std::string(1, _val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const char& value() const
@ -2316,9 +2344,9 @@ public:
ts = tmp.timestamp();
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const std::string& value() const
@ -2452,9 +2480,9 @@ public:
val = NumberFormatter::format(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const long& value() const
@ -2585,9 +2613,9 @@ public:
val = NumberFormatter::format(_val);
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const unsigned long& value() const
@ -2678,9 +2706,9 @@ public:
val.append(" ]");
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const std::vector<T>& value() const
@ -2799,9 +2827,9 @@ public:
ts = _val.timestamp();
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const DateTime& value() const
@ -2895,9 +2923,9 @@ public:
ts = _val.timestamp();
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const LocalDateTime& value() const
@ -2991,9 +3019,9 @@ public:
ts = _val;
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const Timestamp& value() const

Просмотреть файл

@ -0,0 +1,251 @@
//
// SmallObjectAllocator.h
//
// $Id: //poco/1.4/Foundation/include/Poco/SmallObjectAllocator.h#1 $
//
// Library: Foundation
// Package: Core
// Module: SmallObjectAllocator
//
// Definition of the SmallObjectAllocator template.
//
// Copyright (c) 2004-2006, 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 Foundation_SmallObjectAllocator_INCLUDED
#define Foundation_SmallObjectAllocator_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Types.h"
namespace Poco {
template <typename T, std::size_t S = sizeof(T)>
class SmallObjectAllocator
/// SmallObjectAllocator template is a lightweight wrapper implementing
/// small object allocation optimization idiom. Class is statically
/// parameterized on type created and the size threshold, which defaults
/// to the created object size; it follows that the default behavior is
/// use of automatically allocated memory (i.e. the value wrapped is
/// stored in the pre-allocated buffer). To enforce heap allocation,
/// specify S parameter to a value smaller than the size of the type
/// being instantiated.
///
/// The SmallObjectAllocator trade-off is the runtime check for memory
/// location where the value resides. The runtime check occurs at
/// construction/destruction as well as every value access. Value
/// access check can be alleviated by caching the value reference.
///
/// Usage example:
///
/// SmallObjectAllocator<int> s; // on the stack
/// SmallObjectAllocator<int, 1> h; // force heap alloc
/// int& i = s.get(); // no runtime performance penalty after this point
/// i = 5;
///
{
public:
SmallObjectAllocator()
{
if (isOnHeap()) _memory.ptr = new T();
else new (_memory.buf) T;
}
SmallObjectAllocator(const T& val)
{
if (isOnHeap()) _memory.ptr = new T(val);
else new (_memory.buf) T(val);
}
SmallObjectAllocator(const SmallObjectAllocator& other)
{
if (this != &other)
{
if (isOnHeap())
_memory.ptr = new T(*other._memory.ptr);
else
new (_memory.buf) T(*reinterpret_cast<const T*>(other._memory.buf));
}
}
~SmallObjectAllocator()
{
if (isOnHeap()) delete _memory.ptr;
else reinterpret_cast<T*>(_memory.buf)->~T();
}
SmallObjectAllocator& operator =(const SmallObjectAllocator& other)
{
if (this != &other)
{
if (isOnHeap())
_memory.ptr = new T(*other._memory.ptr);
else
new (_memory.buf) T(*reinterpret_cast<const T*>(other._memory.buf));
}
return *this;
}
T& get()
{
if (isOnHeap())
return *_memory.ptr;
else
return reinterpret_cast<T&>(*(_memory.buf));
}
const T& get() const
{
if (isOnHeap())
return *_memory.ptr;
else
return reinterpret_cast<const T&>(*_memory.buf);
}
bool isOnHeap() const
{
return sizeof(T) > S;
}
private:
union
{
unsigned char buf[S];
T* ptr;
} _memory;
};
template <>
class SmallObjectAllocator <char*>
/// SmallObjectAllocator char* specialization.
///
/// The treshold between auto and heap allocation
/// is controlled through POCO_SMALL_OBJECT_SIZE compile
/// time constant, which on 32 or 64-bit systems defaults
/// to 31 or 63 bytes respectively. This specialization
/// adds an extra byte to indicate the allocation strategy.
///
/// To summarize, e.g. POCO_SMALL_OBJECT_SIZE value of 7 will
/// take up at least 8 bytes of storage (for auto allocation)
/// with 6 bytes as the effective string length:
///
/// +---+---+---+---+---+---+---+---+
/// | c | c | c | c | c | c | 0 | f |
/// +---+---+---+---+---+---+---+---+
///
/// Legend:
/// c - character
/// 0 - terminating zero
/// f - allocation flag
///
{
public:
static const std::size_t Size = POCO_SMALL_OBJECT_SIZE;
SmallObjectAllocator(std::size_t sz)
{
_memory.buf[Size] = (sz > Size) ? 1 : 0;
if (_memory.buf[Size]) _memory.ptr = new char[sz + 1];
}
SmallObjectAllocator(const char* pCh, std::size_t sz)
{
allocateAndAssign(pCh, sz);
}
SmallObjectAllocator(const char* pCh)
{
allocateAndAssign(pCh, strlen(pCh));
}
~SmallObjectAllocator()
{
if (_memory.buf[Size]) delete _memory.ptr;
}
SmallObjectAllocator <char*>& operator = (const char* pCh)
{
allocateAndAssign(pCh, strlen(pCh));
return *this;
}
char* get()
{
if (_memory.buf[Size]) return _memory.ptr;
else return _memory.buf;
}
const char* get() const
{
if (_memory.buf[Size]) return _memory.ptr;
else return _memory.buf;
}
bool isOnHeap() const
{
return _memory.buf[Size] != 0;
}
private:
SmallObjectAllocator();
void allocateAndAssign(const char* pCh, std::size_t sz)
{
_memory.buf[Size] = (sz > Size) ? 1 : 0;
if (_memory.buf[Size])
{
_memory.ptr = new char[sz + 1];
_memory.ptr[sz] = '\0';
std::memcpy(_memory.ptr, pCh, sz);
}
else
{
_memory.buf[sz] = '\0';
std::memcpy(_memory.buf, pCh, sz);
}
}
union
{
char buf[Size + 1];
char* ptr;
} _memory;
};
typedef SmallObjectAllocator<char*> SmallStringAllocator;
} // namespace Poco
#endif // Foundation_SmallObjectAllocator_INCLUDED

Просмотреть файл

@ -95,14 +95,14 @@ FIFOBufferStreamBuf::~FIFOBufferStreamBuf()
int FIFOBufferStreamBuf::readFromDevice(char* buffer, std::streamsize length)
{
poco_assert (length > 0);
return _fifoBuffer.read(buffer, static_cast<std::size_t>(length));
return static_cast<int>(_fifoBuffer.read(buffer, static_cast<std::size_t>(length)));
}
int FIFOBufferStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
{
poco_assert (length > 0);
return _fifoBuffer.write(buffer, static_cast<std::size_t>(length));
return static_cast<int>(_fifoBuffer.write(buffer, static_cast<std::size_t>(length)));
}

Просмотреть файл

@ -44,35 +44,64 @@ namespace Poco {
namespace Dynamic {
Var::Var(): _pHolder(0)
Var::Var()
#ifdef POCO_NO_SOO
: _pHolder(0)
#endif
{
}
Var::Var(const char* pVal):
_pHolder(new VarHolderImpl<std::string>(pVal))
Var::Var(const char* pVal)
#ifdef POCO_NO_SOO
: _pHolder(new VarHolderImpl<std::string>(pVal)) { }
#else
{
construct(std::string(pVal));
}
#endif
Var::Var(const Var& other):
_pHolder(0)
Var::Var(const Var& other)
#ifdef POCO_NO_SOO
: _pHolder(0)
{
if (other._pHolder)
_pHolder = other._pHolder->clone();
}
#else
{
if ((this != &other) && !other.isEmpty())
construct(other);
}
#endif
Var::~Var()
{
delete _pHolder;
if(!isEmpty())
{
#ifndef POCO_NO_SOO
if(_placeholder.isLocal())
content()->~VarHolder();
else
#endif
delete content();
}
}
Var& Var::operator = (const Var& other)
Var& Var::operator = (const Var& rhs)
{
Var tmp(other);
#ifdef POCO_NO_SOO
Var tmp(rhs);
swap(tmp);
#else
if ((this != &rhs) && !rhs.isEmpty())
construct(rhs);
else if ((this != &rhs) && rhs.isEmpty())
_placeholder.erase();
#endif
return *this;
}
@ -320,8 +349,14 @@ bool Var::operator && (const Var& other) const
void Var::empty()
{
#ifdef POCO_NO_SOO
delete _pHolder;
_pHolder = 0;
#else
if (_placeholder.isLocal()) this->~Var();
else delete content();
_placeholder.erase();
#endif
}

Просмотреть файл

@ -122,7 +122,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -152,7 +152,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
@ -185,7 +185,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
@ -214,7 +214,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -240,7 +240,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -270,7 +270,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>

Просмотреть файл

@ -51,7 +51,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -85,7 +85,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>

Просмотреть файл

@ -115,7 +115,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;WINVER=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -146,7 +146,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;WINVER=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;WINVER=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
@ -180,7 +180,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@ -211,7 +211,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -238,7 +238,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_DEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -270,7 +270,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;WINVER=0x0600;POCO_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>

Просмотреть файл

@ -70,8 +70,170 @@ AnyTest::~AnyTest()
}
void AnyTest::testDefaultCtor()
{
const Any value;
assert (value.empty());
assert (0 == AnyCast<int>(&value));
assert (value.type() == typeid(void));
}
void AnyTest::testConvertingCtor()
{
std::string text = "test message";
Any value = text;
assert (!value.empty());
assert (value.type() == typeid(std::string));
assert (0 == AnyCast<int>(&value));
assert (0 != AnyCast<std::string>(&value));
assert (AnyCast<std::string>(value) == text);
assert (AnyCast<std::string>(&value) != &text);
}
void AnyTest::testCopyCtor()
{
std::string text = "test message";
Any original = text, copy = original;
assert (!copy.empty());
assert (original.type() == copy.type());
assert (AnyCast<std::string>(original) == AnyCast<std::string>(copy));
assert (text == AnyCast<std::string>(copy));
assert (AnyCast<std::string>(&original) != AnyCast<std::string>(&copy));
}
void AnyTest::testCopyAssign()
{
std::string text = "test message";
Any original = text, copy;
Any* assignResult = &(copy = original);
assert (!copy.empty());
assert (original.type() == copy.type());
assert (AnyCast<std::string>(original) == AnyCast<std::string>(copy));
assert (text == AnyCast<std::string>(copy));
assert (AnyCast<std::string>(&original) != AnyCast<std::string>(&copy));
assert (assignResult == &copy);
// test self assignment
Any& ref = original;
original = ref;
assert (AnyCast<std::string>(original) == AnyCast<std::string>(copy));
original = original;
assert (AnyCast<std::string>(original) == AnyCast<std::string>(copy));
}
void AnyTest::testConvertingAssign()
{
std::string text = "test message";
Any value;
Any* assignResult = &(value = text);
assert (!value.empty());
assert (value.type() == typeid(std::string));
assert (0 == AnyCast<int>(&value));
assert (0 != AnyCast<std::string>(&value));
assert (AnyCast<std::string>(value) == text);
assert (AnyCast<std::string>(&value) != &text);
assert (assignResult == &value);
}
void AnyTest::testCastToReference()
{
Any a(137);
const Any b(a);
int& ra = AnyCast<int &>(a);
int const& ra_c = AnyCast<int const &>(a);
int volatile& ra_v = AnyCast<int volatile &>(a);
int const volatile& ra_cv = AnyCast<int const volatile&>(a);
// cv references to same obj
assert (&ra == &ra_c && &ra == &ra_v && &ra == &ra_cv);
int const & rb_c = AnyCast<int const &>(b);
int const volatile & rb_cv = AnyCast<int const volatile &>(b);
assert (&rb_c == &rb_cv); // cv references to copied const obj
assert (&ra != &rb_c); // copies hold different objects
++ra;
int incremented = AnyCast<int>(a);
assert (incremented == 138); // increment by reference changes value
try
{
AnyCast<char &>(a);
failmsg ("AnyCast to incorrect reference type");
}
catch (BadCastException&) { }
try
{
AnyCast<const char &>(b),
failmsg ("AnyCast to incorrect const reference type");
}
catch (BadCastException&) { }
}
void AnyTest::testBadCast()
{
std::string text = "test message";
Any value = text;
try
{
AnyCast<const char *>(value);
fail ("must throw");
}
catch (BadCastException&) { }
}
void AnyTest::testSwap()
{
std::string text = "test message";
Any original = text, swapped;
std::string* originalPtr = AnyCast<std::string>(&original);
Any* swapResult = &original.swap(swapped);
assert (original.empty());
assert (!swapped.empty());
assert (swapped.type() == typeid(std::string));
assert (text == AnyCast<std::string>(swapped));
assert (0 != originalPtr);
#ifdef POCO_NO_SOO // pointers only match when heap-allocated
assert (originalPtr == AnyCast<std::string>(&swapped));
#endif
assert (swapResult == &original);
}
void AnyTest::testEmptyCopy()
{
const Any null;
Any copied = null, assigned;
assigned = null;
assert (null.empty());
assert (copied.empty());
assert (assigned.empty());
}
void AnyTest::testInt()
{
Any e;
assert (e.empty());
Any a = 13;
assert (a.type() == typeid(int));
int* i = AnyCast<int>(&a);
@ -116,8 +278,13 @@ void AnyTest::testVector()
Any a = tmp;
assert (a.type() == typeid(std::vector<int>));
std::vector<int> tmp2 = AnyCast<std::vector<int> >(a);
assert (tmp2.size() == 3);
const std::vector<int>& vecCRef = RefAnyCast<std::vector<int> >(a);
std::vector<int>& vecRef = RefAnyCast<std::vector<int> >(a);
assert (vecRef[0] == 1);
assert (vecRef[1] == 2);
assert (vecRef[2] == 3);
vecRef[0] = 0;
assert (vecRef[0] == vecCRef[0]);
}
@ -137,6 +304,15 @@ CppUnit::Test* AnyTest::suite()
{
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("AnyTest");
CppUnit_addTest(pSuite, AnyTest, testConvertingCtor);
CppUnit_addTest(pSuite, AnyTest, testDefaultCtor);
CppUnit_addTest(pSuite, AnyTest, testCopyCtor);
CppUnit_addTest(pSuite, AnyTest, testCopyAssign);
CppUnit_addTest(pSuite, AnyTest, testConvertingAssign);
CppUnit_addTest(pSuite, AnyTest, testBadCast);
CppUnit_addTest(pSuite, AnyTest, testSwap);
CppUnit_addTest(pSuite, AnyTest, testEmptyCopy);
CppUnit_addTest(pSuite, AnyTest, testCastToReference);
CppUnit_addTest(pSuite, AnyTest, testInt);
CppUnit_addTest(pSuite, AnyTest, testComplexType);
CppUnit_addTest(pSuite, AnyTest, testVector);

Просмотреть файл

@ -45,6 +45,16 @@ public:
AnyTest(const std::string& name);
~AnyTest();
void testConvertingCtor();
void testDefaultCtor();
void testCopyCtor();
void testCopyAssign();
void testConvertingAssign();
void testBadCast();
void testSwap();
void testEmptyCopy();
void testCastToReference();
void testInt();
void testComplexType();
void testVector();

Просмотреть файл

@ -45,6 +45,7 @@
#include "Poco/Ascii.h"
#include "Poco/BasicEvent.h"
#include "Poco/Delegate.h"
#include "Poco/SmallObjectAllocator.h"
#include "Poco/Exception.h"
#include <iostream>
#include <sstream>
@ -64,6 +65,7 @@ using Poco::AtomicCounter;
using Poco::Nullable;
using Poco::Ascii;
using Poco::BasicEvent;
using Poco::SmallObjectAllocator;
using Poco::delegate;
using Poco::NullType;
using Poco::InvalidAccessException;
@ -96,6 +98,37 @@ namespace
}
class Small
{
};
struct Parent
{
Parent() { i = -1; }
virtual ~Parent() { i= -2; }
static int i;
};
int Parent::i = 0;
struct Medium : public Parent
{
};
struct Large
{
Large() : i(1), j(2), k(3), l(4) { }
long i,j,k;
const long l;
};
//
// The bugcheck test is normally disabled, as it
// causes a break into the debugger.
@ -1031,6 +1064,137 @@ void CoreTest::testAscii()
}
void CoreTest::testSmallObjectAllocator()
{
{
SmallObjectAllocator<int> soa1;
assert (!soa1.isOnHeap());
int& i = soa1.get();
i = 42;
int j = i;
assert (j == 42);
int* pi = &i;
assert (*pi == 42);
*pi = 24;
assert (i == 24);
SmallObjectAllocator<int> soa2(soa1);
assert (soa1.get() == soa2.get());
assert (soa2.get() == 24);
SmallObjectAllocator<int> soa3;
soa3 = soa2;
assert (soa3.get() == soa2.get());
assert (soa3.get() == 24);
}
{
// force heap alloc
SmallObjectAllocator<int, 1> soa1;
assert (soa1.isOnHeap());
int& i = soa1.get();
i = 42;
int j = i;
assert (j == 42);
int* pi = &i;
assert (*pi == 42);
*pi = 24;
assert (i == 24);
SmallObjectAllocator<int, 1> soa2(soa1);
assert (soa1.get() == soa2.get());
assert (soa2.get() == 24);
SmallObjectAllocator<int, 1> soa3;
soa3 = soa2;
assert (soa3.get() == soa2.get());
assert (soa3.get() == 24);
}
SmallObjectAllocator<Small> soa2;
assert (!soa2.isOnHeap());
{
assert (Parent::i == 0);
SmallObjectAllocator<Medium> soa3;
assert (!soa3.isOnHeap());
assert (Parent::i == -1);
}
assert (Parent::i == -2);
{
typedef SmallObjectAllocator<Large, 4> LargeType;
LargeType soa4;
assert (soa4.isOnHeap());
Large large = soa4.get();
assert (large.i == 1);
assert (large.j == 2);
assert (large.k == 3);
const LargeType soa5;
assert (soa5.get().l == 4);
}
Parent::i = 0; // only to make sure subsequent runs don't fail
SmallObjectAllocator<char*> soa6(2);
assert (!soa6.isOnHeap());
char* pC2 = soa6.get();
pC2[0] = 'x';
pC2[1] = '\0';
std::string str2(pC2);
assert (str2 == "x");
std::size_t sz = POCO_SMALL_OBJECT_SIZE + 1;
Poco::SmallStringAllocator soa7(sz);
assert (soa7.isOnHeap());
char* pC = soa7.get();
char c = '0';
int i = 0;
// test this only for default values
if (POCO_SMALL_OBJECT_SIZE == 15)
{
for (i = 0; i < sz - 1; ++i)
pC[i] = c++;
pC[i] = '\0';
std::string str(pC);
assert (str == "0123456789:;<=>");
Poco::SmallStringAllocator soa7("0123456789:;<=>");
assert (str == soa7.get());
soa7 = "";
assert (soa7.get()[0] == '\0');
soa7 = "0123456789:;<=>";
assert (str == soa7.get());
}
else if (POCO_SMALL_OBJECT_SIZE == 7)
{
for (i = 0; i < sz - 1; ++i)
pC[i] = c++;
pC[i] = '\0';
std::string str(pC);
assert (str == "0123456");
Poco::SmallStringAllocator soa7("0123456");
assert (str == soa7.get());
soa7 = "";
assert (soa7.get()[0] == '\0');
soa7 = "0123456";
assert (str == soa7.get());
}
std::string str("0123456789");
Poco::SmallObjectAllocator<std::string> soa8(str);
assert (!soa8.isOnHeap());
assert(soa8.get() == str);
Poco::SmallObjectAllocator<std::string, 1> soa9;
assert (soa9.isOnHeap());
soa9 = str;
assert(soa9.get() == str);
}
void CoreTest::onReadable(bool& b)
{
if (b) ++_notToReadable;
@ -1074,6 +1238,7 @@ CppUnit::Test* CoreTest::suite()
CppUnit_addTest(pSuite, CoreTest, testAtomicCounter);
CppUnit_addTest(pSuite, CoreTest, testNullable);
CppUnit_addTest(pSuite, CoreTest, testAscii);
CppUnit_addTest(pSuite, CoreTest, testSmallObjectAllocator);
return pSuite;
}

Просмотреть файл

@ -58,6 +58,7 @@ public:
void testAtomicCounter();
void testNullable();
void testAscii();
void testSmallObjectAllocator();
void setUp();
void tearDown();

Просмотреть файл

@ -279,22 +279,22 @@ public:
void convert(DateTime& /*val*/) const
{
throw BadCastException();
throw BadCastException("Cannot convert Array to DateTime");
}
void convert(LocalDateTime& /*ldt*/) const
{
throw BadCastException();
throw BadCastException("Cannot convert Array to LocalDateTime");
}
void convert(Timestamp& /*ts*/) const
{
throw BadCastException();
throw BadCastException("Cannot convert Array to Timestamp");
}
VarHolder* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const JSON::Array::Ptr& value() const

Просмотреть файл

@ -291,21 +291,24 @@ public:
void convert(DateTime& /*val*/) const
{
//TODO: val = _val;
throw NotImplementedException("Conversion not implemented: JSON:Object => DateTime");
}
void convert(LocalDateTime& /*ldt*/) const
{
//TODO: ldt = _val.timestamp();
throw NotImplementedException("Conversion not implemented: JSON:Object => LocalDateTime");
}
void convert(Timestamp& /*ts*/) const
{
//TODO: ts = _val.timestamp();
throw NotImplementedException("Conversion not implemented: JSON:Object => Timestamp");
}
VarHolderImpl* clone() const
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
{
return new VarHolderImpl(_val);
return cloneHolder(pVarHolder, _val);
}
const JSON::Object::Ptr& value() const

Просмотреть файл

@ -12,7 +12,7 @@ SHAREDOPT_CXX += -DNet_EXPORTS
objects = \
DNS HTTPResponse HostEntry Socket \
DatagramSocket HTTPServer IPAddress SocketAddress \
DatagramSocket HTTPServer IPAddress IPAddressImpl SocketAddress \
HTTPBasicCredentials HTTPCookie HTMLForm MediaType DialogSocket \
DatagramSocketImpl FilePartSource HTTPServerConnection MessageHeader \
HTTPChunkedStream HTTPServerConnectionFactory MulticastSocket SocketStream \

Просмотреть файл

@ -438,6 +438,8 @@
RelativePath=".\include\Poco\Net\HostEntry.h"/>
<File
RelativePath=".\include\Poco\Net\IPAddress.h"/>
<File
RelativePath=".\include\Poco\Net\IPAddressImpl.h"/>
<File
RelativePath=".\include\Poco\Net\Net.h"/>
<File
@ -457,6 +459,8 @@
RelativePath=".\src\HostEntry.cpp"/>
<File
RelativePath=".\src\IPAddress.cpp"/>
<File
RelativePath=".\src\IPAddressImpl.cpp"/>
<File
RelativePath=".\src\Net.cpp"/>
<File

Просмотреть файл

@ -270,6 +270,7 @@
<ClInclude Include="include\Poco\Net\DNS.h" />
<ClInclude Include="include\Poco\Net\HostEntry.h" />
<ClInclude Include="include\Poco\Net\IPAddress.h" />
<ClInclude Include="include\Poco\Net\IPAddressImpl.h" />
<ClInclude Include="include\Poco\Net\Net.h" />
<ClInclude Include="include\Poco\Net\NetException.h" />
<ClInclude Include="include\Poco\Net\NetworkInterface.h" />
@ -369,6 +370,7 @@
<ClCompile Include="src\DNS.cpp" />
<ClCompile Include="src\HostEntry.cpp" />
<ClCompile Include="src\IPAddress.cpp" />
<ClCompile Include="src\IPAddressImpl.cpp" />
<ClCompile Include="src\Net.cpp" />
<ClCompile Include="src\NetException.cpp" />
<ClCompile Include="src\NetworkInterface.cpp" />

Просмотреть файл

@ -420,6 +420,9 @@
<ClInclude Include="include\Poco\Net\ParallelSocketReactor.h">
<Filter>Reactor\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Net\IPAddressImpl.h">
<Filter>NetCore\Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\DNS.cpp">
@ -695,6 +698,9 @@
<ClCompile Include="src\Net.cpp">
<Filter>NetCore\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\IPAddressImpl.cpp">
<Filter>NetCore\Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\DLLVersion.rc" />

Просмотреть файл

@ -276,6 +276,7 @@
<ClInclude Include="include\Poco\Net\DNS.h"/>
<ClInclude Include="include\Poco\Net\HostEntry.h"/>
<ClInclude Include="include\Poco\Net\IPAddress.h"/>
<ClInclude Include="include\Poco\Net\IPAddressImpl.h"/>
<ClInclude Include="include\Poco\Net\Net.h"/>
<ClInclude Include="include\Poco\Net\NetException.h"/>
<ClInclude Include="include\Poco\Net\NetworkInterface.h"/>
@ -375,6 +376,7 @@
<ClCompile Include="src\DNS.cpp"/>
<ClCompile Include="src\HostEntry.cpp"/>
<ClCompile Include="src\IPAddress.cpp"/>
<ClCompile Include="src\IPAddressImpl.cpp"/>
<ClCompile Include="src\Net.cpp"/>
<ClCompile Include="src\NetException.cpp"/>
<ClCompile Include="src\NetworkInterface.cpp"/>

Просмотреть файл

@ -138,6 +138,9 @@
<ClInclude Include="include\Poco\Net\IPAddress.h">
<Filter>NetCore\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Net\IPAddressImpl.h">
<Filter>NetCore\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Net\Net.h">
<Filter>NetCore\Header Files</Filter>
</ClInclude>
@ -431,6 +434,9 @@
<ClCompile Include="src\IPAddress.cpp">
<Filter>NetCore\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\IPAddressimpl.cpp">
<Filter>NetCore\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Net.cpp">
<Filter>NetCore\Source Files</Filter>
</ClCompile>

Просмотреть файл

@ -370,6 +370,8 @@
RelativePath=".\include\Poco\Net\HostEntry.h"/>
<File
RelativePath=".\include\Poco\Net\IPAddress.h"/>
<File
RelativePath=".\include\Poco\Net\IPAddressImpl.h"/>
<File
RelativePath=".\include\Poco\Net\Net.h"/>
<File
@ -389,6 +391,8 @@
RelativePath=".\src\HostEntry.cpp"/>
<File
RelativePath=".\src\IPAddress.cpp"/>
<File
RelativePath=".\src\IPAddressImpl.cpp"/>
<File
RelativePath=".\src\Net.cpp"/>
<File

Просмотреть файл

@ -391,6 +391,8 @@
RelativePath=".\include\Poco\Net\HostEntry.h"/>
<File
RelativePath=".\include\Poco\Net\IPAddress.h"/>
<File
RelativePath=".\include\Poco\Net\IPAddressImpl.h"/>
<File
RelativePath=".\include\Poco\Net\Net.h"/>
<File
@ -410,6 +412,8 @@
RelativePath=".\src\HostEntry.cpp"/>
<File
RelativePath=".\src\IPAddress.cpp"/>
<File
RelativePath=".\src\IPAddressImpl.cpp"/>
<File
RelativePath=".\src\Net.cpp"/>
<File

Просмотреть файл

@ -390,6 +390,8 @@
RelativePath=".\include\Poco\Net\HostEntry.h"/>
<File
RelativePath=".\include\Poco\Net\IPAddress.h"/>
<File
RelativePath=".\include\Poco\Net\IPAddressImpl.h"/>
<File
RelativePath=".\include\Poco\Net\Net.h"/>
<File
@ -409,6 +411,8 @@
RelativePath=".\src\HostEntry.cpp"/>
<File
RelativePath=".\src\IPAddress.cpp"/>
<File
RelativePath=".\src\IPAddressImpl.cpp"/>
<File
RelativePath=".\src\Net.cpp"/>
<File

Просмотреть файл

@ -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|x64">
@ -32,76 +32,76 @@
<RootNamespace>Net</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;" Label="Configuration">
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ImportGroup Label="ExtensionSettings"/>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&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|x64'" 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|x64&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|x64'" 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|x64&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|x64'" 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|x64&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|x64'" 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|x64&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|x64'" 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|x64&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|x64'" 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|x64&apos;">..\bin64\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">..\bin64\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">false</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;">..\lib64\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;">obj64\$(Configuration)\</IntDir>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;">..\lib64\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;">obj64\$(Configuration)\</IntDir>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;">..\lib64\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;">obj64\$(Configuration)\</IntDir>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;">..\lib64\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;">obj64\$(Configuration)\</IntDir>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">PocoNet64d</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;">PocoNetmdd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;">PocoNetmtd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">PocoNet64</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;">PocoNetmd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;">PocoNetmt</TargetName>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">..\bin64\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">..\bin64\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">obj64\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'">..\lib64\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'">obj64\$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'">..\lib64\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'">obj64\$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'">..\lib64\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'">obj64\$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'">..\lib64\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'">obj64\$(Configuration)\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">PocoNet64d</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'">PocoNetmdd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'">PocoNetmtd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">PocoNet64</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'">PocoNetmd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'">PocoNetmt</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -114,7 +114,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -132,7 +132,7 @@
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -147,9 +147,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>
@ -166,7 +166,7 @@
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -179,7 +179,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\lib64\PocoNetmtd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -190,7 +190,7 @@
<OutputFile>..\lib64\PocoNetmtd.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -205,9 +205,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>
@ -215,7 +215,7 @@
<OutputFile>..\lib64\PocoNetmt.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -228,7 +228,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\lib64\PocoNetmdd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -239,7 +239,7 @@
<OutputFile>..\lib64\PocoNetmdd.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -254,9 +254,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>
@ -265,207 +265,209 @@
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="include\Poco\Net\DNS.h"/>
<ClInclude Include="include\Poco\Net\HostEntry.h"/>
<ClInclude Include="include\Poco\Net\IPAddress.h"/>
<ClInclude Include="include\Poco\Net\Net.h"/>
<ClInclude Include="include\Poco\Net\NetException.h"/>
<ClInclude Include="include\Poco\Net\NetworkInterface.h"/>
<ClInclude Include="include\Poco\Net\SocketAddress.h"/>
<ClInclude Include="include\Poco\Net\SocketDefs.h"/>
<ClInclude Include="include\Poco\Net\DatagramSocket.h"/>
<ClInclude Include="include\Poco\Net\DatagramSocketImpl.h"/>
<ClInclude Include="include\Poco\Net\DialogSocket.h"/>
<ClInclude Include="include\Poco\Net\MulticastSocket.h"/>
<ClInclude Include="include\Poco\Net\RawSocket.h"/>
<ClInclude Include="include\Poco\Net\RawSocketImpl.h"/>
<ClInclude Include="include\Poco\Net\ServerSocket.h"/>
<ClInclude Include="include\Poco\Net\ServerSocketImpl.h"/>
<ClInclude Include="include\Poco\Net\Socket.h"/>
<ClInclude Include="include\Poco\Net\SocketImpl.h"/>
<ClInclude Include="include\Poco\Net\SocketStream.h"/>
<ClInclude Include="include\Poco\Net\StreamSocket.h"/>
<ClInclude Include="include\Poco\Net\StreamSocketImpl.h"/>
<ClInclude Include="include\Poco\Net\FilePartSource.h"/>
<ClInclude Include="include\Poco\Net\MediaType.h"/>
<ClInclude Include="include\Poco\Net\MessageHeader.h"/>
<ClInclude Include="include\Poco\Net\MultipartReader.h"/>
<ClInclude Include="include\Poco\Net\MultipartWriter.h"/>
<ClInclude Include="include\Poco\Net\NameValueCollection.h"/>
<ClInclude Include="include\Poco\Net\NullPartHandler.h"/>
<ClInclude Include="include\Poco\Net\PartHandler.h"/>
<ClInclude Include="include\Poco\Net\PartSource.h"/>
<ClInclude Include="include\Poco\Net\QuotedPrintableDecoder.h"/>
<ClInclude Include="include\Poco\Net\QuotedPrintableEncoder.h"/>
<ClInclude Include="include\Poco\Net\StringPartSource.h"/>
<ClInclude Include="include\Poco\Net\HTTPAuthenticationParams.h"/>
<ClInclude Include="include\Poco\Net\HTTPBasicCredentials.h"/>
<ClInclude Include="include\Poco\Net\HTTPBasicStreamBuf.h"/>
<ClInclude Include="include\Poco\Net\HTTPBufferAllocator.h"/>
<ClInclude Include="include\Poco\Net\HTTPChunkedStream.h"/>
<ClInclude Include="include\Poco\Net\HTTPCookie.h"/>
<ClInclude Include="include\Poco\Net\HTTPCredentials.h"/>
<ClInclude Include="include\Poco\Net\HTTPDigestCredentials.h"/>
<ClInclude Include="include\Poco\Net\HTTPFixedLengthStream.h"/>
<ClInclude Include="include\Poco\Net\HTTPHeaderStream.h"/>
<ClInclude Include="include\Poco\Net\HTTPMessage.h"/>
<ClInclude Include="include\Poco\Net\HTTPRequest.h"/>
<ClInclude Include="include\Poco\Net\HTTPResponse.h"/>
<ClInclude Include="include\Poco\Net\HTTPSession.h"/>
<ClInclude Include="include\Poco\Net\HTTPStream.h"/>
<ClInclude Include="include\Poco\Net\TCPServer.h"/>
<ClInclude Include="include\Poco\Net\TCPServerConnection.h"/>
<ClInclude Include="include\Poco\Net\TCPServerConnectionFactory.h"/>
<ClInclude Include="include\Poco\Net\TCPServerDispatcher.h"/>
<ClInclude Include="include\Poco\Net\TCPServerParams.h"/>
<ClInclude Include="include\Poco\Net\AbstractHTTPRequestHandler.h"/>
<ClInclude Include="include\Poco\Net\HTTPRequestHandler.h"/>
<ClInclude Include="include\Poco\Net\HTTPRequestHandlerFactory.h"/>
<ClInclude Include="include\Poco\Net\HTTPServer.h"/>
<ClInclude Include="include\Poco\Net\HTTPServerConnection.h"/>
<ClInclude Include="include\Poco\Net\HTTPServerConnectionFactory.h"/>
<ClInclude Include="include\Poco\Net\HTTPServerParams.h"/>
<ClInclude Include="include\Poco\Net\HTTPServerRequest.h"/>
<ClInclude Include="include\Poco\Net\HTTPServerRequestImpl.h"/>
<ClInclude Include="include\Poco\Net\HTTPServerResponse.h"/>
<ClInclude Include="include\Poco\Net\HTTPServerResponseImpl.h"/>
<ClInclude Include="include\Poco\Net\HTTPServerSession.h"/>
<ClInclude Include="include\Poco\Net\HTTPClientSession.h"/>
<ClInclude Include="include\Poco\Net\HTTPIOStream.h"/>
<ClInclude Include="include\Poco\Net\HTTPSessionFactory.h"/>
<ClInclude Include="include\Poco\Net\HTTPSessionInstantiator.h"/>
<ClInclude Include="include\Poco\Net\HTTPStreamFactory.h"/>
<ClInclude Include="include\Poco\Net\HTMLForm.h"/>
<ClInclude Include="include\Poco\Net\FTPClientSession.h"/>
<ClInclude Include="include\Poco\Net\FTPStreamFactory.h"/>
<ClInclude Include="include\Poco\Net\SocketAcceptor.h"/>
<ClInclude Include="include\Poco\Net\ParallelSocketAcceptor.h"/>
<ClInclude Include="include\Poco\Net\SocketConnector.h"/>
<ClInclude Include="include\Poco\Net\SocketNotification.h"/>
<ClInclude Include="include\Poco\Net\SocketNotifier.h"/>
<ClInclude Include="include\Poco\Net\SocketReactor.h"/>
<ClInclude Include="include\Poco\Net\ParallelSocketReactor.h"/>
<ClInclude Include="include\Poco\Net\MailMessage.h"/>
<ClInclude Include="include\Poco\Net\MailRecipient.h"/>
<ClInclude Include="include\Poco\Net\MailStream.h"/>
<ClInclude Include="include\Poco\Net\POP3ClientSession.h"/>
<ClInclude Include="include\Poco\Net\SMTPClientSession.h"/>
<ClInclude Include="include\Poco\Net\ICMPClient.h"/>
<ClInclude Include="include\Poco\Net\ICMPEventArgs.h"/>
<ClInclude Include="include\Poco\Net\ICMPPacket.h"/>
<ClInclude Include="include\Poco\Net\ICMPPacketImpl.h"/>
<ClInclude Include="include\Poco\Net\ICMPSocket.h"/>
<ClInclude Include="include\Poco\Net\ICMPSocketImpl.h"/>
<ClInclude Include="include\Poco\Net\ICMPv4PacketImpl.h"/>
<ClInclude Include="include\Poco\Net\RemoteSyslogChannel.h"/>
<ClInclude Include="include\Poco\Net\RemoteSyslogListener.h"/>
<ClInclude Include="include\Poco\Net\SMTPChannel.h"/>
<ClInclude Include="include\Poco\Net\WebSocket.h"/>
<ClInclude Include="include\Poco\Net\WebSocketImpl.h"/>
<ClInclude Include="include\Poco\Net\DNS.h" />
<ClInclude Include="include\Poco\Net\HostEntry.h" />
<ClInclude Include="include\Poco\Net\IPAddress.h" />
<ClInclude Include="include\Poco\Net\IPAddressImpl.h" />
<ClInclude Include="include\Poco\Net\Net.h" />
<ClInclude Include="include\Poco\Net\NetException.h" />
<ClInclude Include="include\Poco\Net\NetworkInterface.h" />
<ClInclude Include="include\Poco\Net\SocketAddress.h" />
<ClInclude Include="include\Poco\Net\SocketDefs.h" />
<ClInclude Include="include\Poco\Net\DatagramSocket.h" />
<ClInclude Include="include\Poco\Net\DatagramSocketImpl.h" />
<ClInclude Include="include\Poco\Net\DialogSocket.h" />
<ClInclude Include="include\Poco\Net\MulticastSocket.h" />
<ClInclude Include="include\Poco\Net\RawSocket.h" />
<ClInclude Include="include\Poco\Net\RawSocketImpl.h" />
<ClInclude Include="include\Poco\Net\ServerSocket.h" />
<ClInclude Include="include\Poco\Net\ServerSocketImpl.h" />
<ClInclude Include="include\Poco\Net\Socket.h" />
<ClInclude Include="include\Poco\Net\SocketImpl.h" />
<ClInclude Include="include\Poco\Net\SocketStream.h" />
<ClInclude Include="include\Poco\Net\StreamSocket.h" />
<ClInclude Include="include\Poco\Net\StreamSocketImpl.h" />
<ClInclude Include="include\Poco\Net\FilePartSource.h" />
<ClInclude Include="include\Poco\Net\MediaType.h" />
<ClInclude Include="include\Poco\Net\MessageHeader.h" />
<ClInclude Include="include\Poco\Net\MultipartReader.h" />
<ClInclude Include="include\Poco\Net\MultipartWriter.h" />
<ClInclude Include="include\Poco\Net\NameValueCollection.h" />
<ClInclude Include="include\Poco\Net\NullPartHandler.h" />
<ClInclude Include="include\Poco\Net\PartHandler.h" />
<ClInclude Include="include\Poco\Net\PartSource.h" />
<ClInclude Include="include\Poco\Net\QuotedPrintableDecoder.h" />
<ClInclude Include="include\Poco\Net\QuotedPrintableEncoder.h" />
<ClInclude Include="include\Poco\Net\StringPartSource.h" />
<ClInclude Include="include\Poco\Net\HTTPAuthenticationParams.h" />
<ClInclude Include="include\Poco\Net\HTTPBasicCredentials.h" />
<ClInclude Include="include\Poco\Net\HTTPBasicStreamBuf.h" />
<ClInclude Include="include\Poco\Net\HTTPBufferAllocator.h" />
<ClInclude Include="include\Poco\Net\HTTPChunkedStream.h" />
<ClInclude Include="include\Poco\Net\HTTPCookie.h" />
<ClInclude Include="include\Poco\Net\HTTPCredentials.h" />
<ClInclude Include="include\Poco\Net\HTTPDigestCredentials.h" />
<ClInclude Include="include\Poco\Net\HTTPFixedLengthStream.h" />
<ClInclude Include="include\Poco\Net\HTTPHeaderStream.h" />
<ClInclude Include="include\Poco\Net\HTTPMessage.h" />
<ClInclude Include="include\Poco\Net\HTTPRequest.h" />
<ClInclude Include="include\Poco\Net\HTTPResponse.h" />
<ClInclude Include="include\Poco\Net\HTTPSession.h" />
<ClInclude Include="include\Poco\Net\HTTPStream.h" />
<ClInclude Include="include\Poco\Net\TCPServer.h" />
<ClInclude Include="include\Poco\Net\TCPServerConnection.h" />
<ClInclude Include="include\Poco\Net\TCPServerConnectionFactory.h" />
<ClInclude Include="include\Poco\Net\TCPServerDispatcher.h" />
<ClInclude Include="include\Poco\Net\TCPServerParams.h" />
<ClInclude Include="include\Poco\Net\AbstractHTTPRequestHandler.h" />
<ClInclude Include="include\Poco\Net\HTTPRequestHandler.h" />
<ClInclude Include="include\Poco\Net\HTTPRequestHandlerFactory.h" />
<ClInclude Include="include\Poco\Net\HTTPServer.h" />
<ClInclude Include="include\Poco\Net\HTTPServerConnection.h" />
<ClInclude Include="include\Poco\Net\HTTPServerConnectionFactory.h" />
<ClInclude Include="include\Poco\Net\HTTPServerParams.h" />
<ClInclude Include="include\Poco\Net\HTTPServerRequest.h" />
<ClInclude Include="include\Poco\Net\HTTPServerRequestImpl.h" />
<ClInclude Include="include\Poco\Net\HTTPServerResponse.h" />
<ClInclude Include="include\Poco\Net\HTTPServerResponseImpl.h" />
<ClInclude Include="include\Poco\Net\HTTPServerSession.h" />
<ClInclude Include="include\Poco\Net\HTTPClientSession.h" />
<ClInclude Include="include\Poco\Net\HTTPIOStream.h" />
<ClInclude Include="include\Poco\Net\HTTPSessionFactory.h" />
<ClInclude Include="include\Poco\Net\HTTPSessionInstantiator.h" />
<ClInclude Include="include\Poco\Net\HTTPStreamFactory.h" />
<ClInclude Include="include\Poco\Net\HTMLForm.h" />
<ClInclude Include="include\Poco\Net\FTPClientSession.h" />
<ClInclude Include="include\Poco\Net\FTPStreamFactory.h" />
<ClInclude Include="include\Poco\Net\SocketAcceptor.h" />
<ClInclude Include="include\Poco\Net\ParallelSocketAcceptor.h" />
<ClInclude Include="include\Poco\Net\SocketConnector.h" />
<ClInclude Include="include\Poco\Net\SocketNotification.h" />
<ClInclude Include="include\Poco\Net\SocketNotifier.h" />
<ClInclude Include="include\Poco\Net\SocketReactor.h" />
<ClInclude Include="include\Poco\Net\ParallelSocketReactor.h" />
<ClInclude Include="include\Poco\Net\MailMessage.h" />
<ClInclude Include="include\Poco\Net\MailRecipient.h" />
<ClInclude Include="include\Poco\Net\MailStream.h" />
<ClInclude Include="include\Poco\Net\POP3ClientSession.h" />
<ClInclude Include="include\Poco\Net\SMTPClientSession.h" />
<ClInclude Include="include\Poco\Net\ICMPClient.h" />
<ClInclude Include="include\Poco\Net\ICMPEventArgs.h" />
<ClInclude Include="include\Poco\Net\ICMPPacket.h" />
<ClInclude Include="include\Poco\Net\ICMPPacketImpl.h" />
<ClInclude Include="include\Poco\Net\ICMPSocket.h" />
<ClInclude Include="include\Poco\Net\ICMPSocketImpl.h" />
<ClInclude Include="include\Poco\Net\ICMPv4PacketImpl.h" />
<ClInclude Include="include\Poco\Net\RemoteSyslogChannel.h" />
<ClInclude Include="include\Poco\Net\RemoteSyslogListener.h" />
<ClInclude Include="include\Poco\Net\SMTPChannel.h" />
<ClInclude Include="include\Poco\Net\WebSocket.h" />
<ClInclude Include="include\Poco\Net\WebSocketImpl.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\DNS.cpp"/>
<ClCompile Include="src\HostEntry.cpp"/>
<ClCompile Include="src\IPAddress.cpp"/>
<ClCompile Include="src\Net.cpp"/>
<ClCompile Include="src\NetException.cpp"/>
<ClCompile Include="src\NetworkInterface.cpp"/>
<ClCompile Include="src\SocketAddress.cpp"/>
<ClCompile Include="src\DatagramSocket.cpp"/>
<ClCompile Include="src\DatagramSocketImpl.cpp"/>
<ClCompile Include="src\DialogSocket.cpp"/>
<ClCompile Include="src\MulticastSocket.cpp"/>
<ClCompile Include="src\RawSocket.cpp"/>
<ClCompile Include="src\RawSocketImpl.cpp"/>
<ClCompile Include="src\ServerSocket.cpp"/>
<ClCompile Include="src\ServerSocketImpl.cpp"/>
<ClCompile Include="src\Socket.cpp"/>
<ClCompile Include="src\SocketImpl.cpp"/>
<ClCompile Include="src\SocketStream.cpp"/>
<ClCompile Include="src\StreamSocket.cpp"/>
<ClCompile Include="src\StreamSocketImpl.cpp"/>
<ClCompile Include="src\FilePartSource.cpp"/>
<ClCompile Include="src\MediaType.cpp"/>
<ClCompile Include="src\MessageHeader.cpp"/>
<ClCompile Include="src\MultipartReader.cpp"/>
<ClCompile Include="src\MultipartWriter.cpp"/>
<ClCompile Include="src\NameValueCollection.cpp"/>
<ClCompile Include="src\NullPartHandler.cpp"/>
<ClCompile Include="src\PartHandler.cpp"/>
<ClCompile Include="src\PartSource.cpp"/>
<ClCompile Include="src\QuotedPrintableDecoder.cpp"/>
<ClCompile Include="src\QuotedPrintableEncoder.cpp"/>
<ClCompile Include="src\StringPartSource.cpp"/>
<ClCompile Include="src\HTTPAuthenticationParams.cpp"/>
<ClCompile Include="src\HTTPBasicCredentials.cpp"/>
<ClCompile Include="src\HTTPBufferAllocator.cpp"/>
<ClCompile Include="src\HTTPChunkedStream.cpp"/>
<ClCompile Include="src\HTTPCookie.cpp"/>
<ClCompile Include="src\HTTPCredentials.cpp"/>
<ClCompile Include="src\HTTPDigestCredentials.cpp"/>
<ClCompile Include="src\HTTPFixedLengthStream.cpp"/>
<ClCompile Include="src\HTTPHeaderStream.cpp"/>
<ClCompile Include="src\HTTPMessage.cpp"/>
<ClCompile Include="src\HTTPRequest.cpp"/>
<ClCompile Include="src\HTTPResponse.cpp"/>
<ClCompile Include="src\HTTPSession.cpp"/>
<ClCompile Include="src\HTTPStream.cpp"/>
<ClCompile Include="src\TCPServer.cpp"/>
<ClCompile Include="src\TCPServerConnection.cpp"/>
<ClCompile Include="src\TCPServerConnectionFactory.cpp"/>
<ClCompile Include="src\TCPServerDispatcher.cpp"/>
<ClCompile Include="src\TCPServerParams.cpp"/>
<ClCompile Include="src\AbstractHTTPRequestHandler.cpp"/>
<ClCompile Include="src\HTTPRequestHandler.cpp"/>
<ClCompile Include="src\HTTPRequestHandlerFactory.cpp"/>
<ClCompile Include="src\HTTPServer.cpp"/>
<ClCompile Include="src\HTTPServerConnection.cpp"/>
<ClCompile Include="src\HTTPServerConnectionFactory.cpp"/>
<ClCompile Include="src\HTTPServerParams.cpp"/>
<ClCompile Include="src\HTTPServerRequest.cpp"/>
<ClCompile Include="src\HTTPServerRequestImpl.cpp"/>
<ClCompile Include="src\HTTPServerResponse.cpp"/>
<ClCompile Include="src\HTTPServerResponseImpl.cpp"/>
<ClCompile Include="src\HTTPServerSession.cpp"/>
<ClCompile Include="src\HTTPClientSession.cpp"/>
<ClCompile Include="src\HTTPIOStream.cpp"/>
<ClCompile Include="src\HTTPSessionFactory.cpp"/>
<ClCompile Include="src\HTTPSessionInstantiator.cpp"/>
<ClCompile Include="src\HTTPStreamFactory.cpp"/>
<ClCompile Include="src\HTMLForm.cpp"/>
<ClCompile Include="src\FTPClientSession.cpp"/>
<ClCompile Include="src\FTPStreamFactory.cpp"/>
<ClCompile Include="src\SocketNotification.cpp"/>
<ClCompile Include="src\SocketNotifier.cpp"/>
<ClCompile Include="src\SocketReactor.cpp"/>
<ClCompile Include="src\MailMessage.cpp"/>
<ClCompile Include="src\MailRecipient.cpp"/>
<ClCompile Include="src\MailStream.cpp"/>
<ClCompile Include="src\POP3ClientSession.cpp"/>
<ClCompile Include="src\SMTPClientSession.cpp"/>
<ClCompile Include="src\ICMPClient.cpp"/>
<ClCompile Include="src\ICMPEventArgs.cpp"/>
<ClCompile Include="src\ICMPPacket.cpp"/>
<ClCompile Include="src\ICMPPacketImpl.cpp"/>
<ClCompile Include="src\ICMPSocket.cpp"/>
<ClCompile Include="src\ICMPSocketImpl.cpp"/>
<ClCompile Include="src\ICMPv4PacketImpl.cpp"/>
<ClCompile Include="src\RemoteSyslogChannel.cpp"/>
<ClCompile Include="src\RemoteSyslogListener.cpp"/>
<ClCompile Include="src\SMTPChannel.cpp"/>
<ClCompile Include="src\WebSocket.cpp"/>
<ClCompile Include="src\WebSocketImpl.cpp"/>
<ClCompile Include="src\DNS.cpp" />
<ClCompile Include="src\HostEntry.cpp" />
<ClCompile Include="src\IPAddress.cpp" />
<ClCompile Include="src\IPAddressImpl.cpp" />
<ClCompile Include="src\Net.cpp" />
<ClCompile Include="src\NetException.cpp" />
<ClCompile Include="src\NetworkInterface.cpp" />
<ClCompile Include="src\SocketAddress.cpp" />
<ClCompile Include="src\DatagramSocket.cpp" />
<ClCompile Include="src\DatagramSocketImpl.cpp" />
<ClCompile Include="src\DialogSocket.cpp" />
<ClCompile Include="src\MulticastSocket.cpp" />
<ClCompile Include="src\RawSocket.cpp" />
<ClCompile Include="src\RawSocketImpl.cpp" />
<ClCompile Include="src\ServerSocket.cpp" />
<ClCompile Include="src\ServerSocketImpl.cpp" />
<ClCompile Include="src\Socket.cpp" />
<ClCompile Include="src\SocketImpl.cpp" />
<ClCompile Include="src\SocketStream.cpp" />
<ClCompile Include="src\StreamSocket.cpp" />
<ClCompile Include="src\StreamSocketImpl.cpp" />
<ClCompile Include="src\FilePartSource.cpp" />
<ClCompile Include="src\MediaType.cpp" />
<ClCompile Include="src\MessageHeader.cpp" />
<ClCompile Include="src\MultipartReader.cpp" />
<ClCompile Include="src\MultipartWriter.cpp" />
<ClCompile Include="src\NameValueCollection.cpp" />
<ClCompile Include="src\NullPartHandler.cpp" />
<ClCompile Include="src\PartHandler.cpp" />
<ClCompile Include="src\PartSource.cpp" />
<ClCompile Include="src\QuotedPrintableDecoder.cpp" />
<ClCompile Include="src\QuotedPrintableEncoder.cpp" />
<ClCompile Include="src\StringPartSource.cpp" />
<ClCompile Include="src\HTTPAuthenticationParams.cpp" />
<ClCompile Include="src\HTTPBasicCredentials.cpp" />
<ClCompile Include="src\HTTPBufferAllocator.cpp" />
<ClCompile Include="src\HTTPChunkedStream.cpp" />
<ClCompile Include="src\HTTPCookie.cpp" />
<ClCompile Include="src\HTTPCredentials.cpp" />
<ClCompile Include="src\HTTPDigestCredentials.cpp" />
<ClCompile Include="src\HTTPFixedLengthStream.cpp" />
<ClCompile Include="src\HTTPHeaderStream.cpp" />
<ClCompile Include="src\HTTPMessage.cpp" />
<ClCompile Include="src\HTTPRequest.cpp" />
<ClCompile Include="src\HTTPResponse.cpp" />
<ClCompile Include="src\HTTPSession.cpp" />
<ClCompile Include="src\HTTPStream.cpp" />
<ClCompile Include="src\TCPServer.cpp" />
<ClCompile Include="src\TCPServerConnection.cpp" />
<ClCompile Include="src\TCPServerConnectionFactory.cpp" />
<ClCompile Include="src\TCPServerDispatcher.cpp" />
<ClCompile Include="src\TCPServerParams.cpp" />
<ClCompile Include="src\AbstractHTTPRequestHandler.cpp" />
<ClCompile Include="src\HTTPRequestHandler.cpp" />
<ClCompile Include="src\HTTPRequestHandlerFactory.cpp" />
<ClCompile Include="src\HTTPServer.cpp" />
<ClCompile Include="src\HTTPServerConnection.cpp" />
<ClCompile Include="src\HTTPServerConnectionFactory.cpp" />
<ClCompile Include="src\HTTPServerParams.cpp" />
<ClCompile Include="src\HTTPServerRequest.cpp" />
<ClCompile Include="src\HTTPServerRequestImpl.cpp" />
<ClCompile Include="src\HTTPServerResponse.cpp" />
<ClCompile Include="src\HTTPServerResponseImpl.cpp" />
<ClCompile Include="src\HTTPServerSession.cpp" />
<ClCompile Include="src\HTTPClientSession.cpp" />
<ClCompile Include="src\HTTPIOStream.cpp" />
<ClCompile Include="src\HTTPSessionFactory.cpp" />
<ClCompile Include="src\HTTPSessionInstantiator.cpp" />
<ClCompile Include="src\HTTPStreamFactory.cpp" />
<ClCompile Include="src\HTMLForm.cpp" />
<ClCompile Include="src\FTPClientSession.cpp" />
<ClCompile Include="src\FTPStreamFactory.cpp" />
<ClCompile Include="src\SocketNotification.cpp" />
<ClCompile Include="src\SocketNotifier.cpp" />
<ClCompile Include="src\SocketReactor.cpp" />
<ClCompile Include="src\MailMessage.cpp" />
<ClCompile Include="src\MailRecipient.cpp" />
<ClCompile Include="src\MailStream.cpp" />
<ClCompile Include="src\POP3ClientSession.cpp" />
<ClCompile Include="src\SMTPClientSession.cpp" />
<ClCompile Include="src\ICMPClient.cpp" />
<ClCompile Include="src\ICMPEventArgs.cpp" />
<ClCompile Include="src\ICMPPacket.cpp" />
<ClCompile Include="src\ICMPPacketImpl.cpp" />
<ClCompile Include="src\ICMPSocket.cpp" />
<ClCompile Include="src\ICMPSocketImpl.cpp" />
<ClCompile Include="src\ICMPv4PacketImpl.cpp" />
<ClCompile Include="src\RemoteSyslogChannel.cpp" />
<ClCompile Include="src\RemoteSyslogListener.cpp" />
<ClCompile Include="src\SMTPChannel.cpp" />
<ClCompile Include="src\WebSocket.cpp" />
<ClCompile Include="src\WebSocketImpl.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\DLLVersion.rc">
<ExcludedFromBuild Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|x64&apos;">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|x64&apos;">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|x64&apos;">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|x64&apos;">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|x64&apos;">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|x64&apos;">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'">true</ExcludedFromBuild>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/>
</Project>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

Просмотреть файл

@ -420,6 +420,9 @@
<ClInclude Include="include\Poco\Net\WebSocketImpl.h">
<Filter>WebSocket\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Net\IPAddressImpl.h">
<Filter>NetCore\Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\DNS.cpp">
@ -695,6 +698,9 @@
<ClCompile Include="src\WebSocketImpl.cpp">
<Filter>WebSocket\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\IPAddressImpl.cpp">
<Filter>NetCore\Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\DLLVersion.rc" />

Просмотреть файл

@ -274,6 +274,7 @@
<ClInclude Include="include\Poco\Net\DNS.h"/>
<ClInclude Include="include\Poco\Net\HostEntry.h"/>
<ClInclude Include="include\Poco\Net\IPAddress.h"/>
<ClInclude Include="include\Poco\Net\IPAddressImpl.h"/>
<ClInclude Include="include\Poco\Net\Net.h"/>
<ClInclude Include="include\Poco\Net\NetException.h"/>
<ClInclude Include="include\Poco\Net\NetworkInterface.h"/>
@ -373,6 +374,7 @@
<ClCompile Include="src\DNS.cpp"/>
<ClCompile Include="src\HostEntry.cpp"/>
<ClCompile Include="src\IPAddress.cpp"/>
<ClCompile Include="src\IPAddressImpl.cpp"/>
<ClCompile Include="src\Net.cpp"/>
<ClCompile Include="src\NetException.cpp"/>
<ClCompile Include="src\NetworkInterface.cpp"/>

Просмотреть файл

@ -138,6 +138,9 @@
<ClInclude Include="include\Poco\Net\IPAddress.h">
<Filter>NetCore\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Net\IPAddressImpl.h">
<Filter>NetCore\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Net\Net.h">
<Filter>NetCore\Header Files</Filter>
</ClInclude>
@ -431,6 +434,9 @@
<ClCompile Include="src\IPAddress.cpp">
<Filter>NetCore\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\IPAddressImpl.cpp">
<Filter>NetCore\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Net.cpp">
<Filter>NetCore\Source Files</Filter>
</ClCompile>

Просмотреть файл

@ -395,6 +395,8 @@
RelativePath=".\include\Poco\Net\HostEntry.h"/>
<File
RelativePath=".\include\Poco\Net\IPAddress.h"/>
<File
RelativePath=".\include\Poco\Net\IPAddressImpl.h"/>
<File
RelativePath=".\include\Poco\Net\Net.h"/>
<File
@ -414,6 +416,8 @@
RelativePath=".\src\HostEntry.cpp"/>
<File
RelativePath=".\src\IPAddress.cpp"/>
<File
RelativePath=".\src\IPAddressImpl.cpp"/>
<File
RelativePath=".\src\Net.cpp"/>
<File

Просмотреть файл

@ -42,6 +42,7 @@
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketDefs.h"
#include "Poco/Net/IPAddressImpl.h"
#include <vector>
@ -53,9 +54,6 @@ class BinaryWriter;
namespace Net {
class IPAddressImpl;
class Net_API IPAddress
/// This class represents an internet (IP) host
/// address. The address can belong either to the
@ -80,9 +78,9 @@ public:
enum Family
/// Possible address families for IP addresses.
{
IPv4
IPv4 = Poco::Net::Impl::IPAddressImpl::IPv4
#ifdef POCO_HAVE_IPv6
,IPv6
,IPv6 = Poco::Net::Impl::IPAddressImpl::IPv6
#endif
};
@ -143,7 +141,7 @@ public:
IPAddress& operator = (const IPAddress& addr);
/// Assigns an IPAddress.
void swap(IPAddress& address);
//void swap(IPAddress& address);
/// Swaps the IPAddress with another one.
Family family() const;
@ -387,26 +385,29 @@ public:
/// Maximum length in bytes of a socket address.
};
protected:
void init(IPAddressImpl* pImpl);
private:
IPAddressImpl* _pImpl;
typedef Poco::Net::Impl::IPAddressImpl Impl;
typedef Impl* Ptr;
Ptr pImpl() const;
char _memory[sizeof(Poco::Net::Impl::IPv6AddressImpl)];
friend class Poco::Net::Impl::IPv4AddressImpl;
friend class Poco::Net::Impl::IPv6AddressImpl;
};
//
// inlines
//
inline void swap(IPAddress& addr1, IPAddress& addr2)
inline IPAddress::Ptr IPAddress::pImpl() const
{
addr1.swap(addr2);
return reinterpret_cast<Ptr>(const_cast<char *>(_memory));
}
BinaryWriter& operator << (BinaryWriter& writer, const IPAddress& value);
BinaryReader& operator >> (BinaryReader& reader, IPAddress& value);
} } // namespace Poco::Net

Просмотреть файл

@ -0,0 +1,201 @@
//
// IPAddressImpl.h
//
// $Id: //poco/1.4/Net/include/Poco/Net/IPAddressImpl.h#2 $
//
// Library: Net
// Package: NetCore
// Module: IPAddressImpl
//
// Definition of the IPAddressImpl class.
//
// Copyright (c) 2005-2011, 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 Net_IPAddressImpl_INCLUDED
#define Net_IPAddressImpl_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/SocketDefs.h"
#include <vector>
namespace Poco {
namespace Net {
namespace Impl {
class IPAddressImpl
{
public:
enum Family
/// Possible address families for IP addresses.
{
IPv4
#ifdef POCO_HAVE_IPv6
,IPv6
#endif
};
virtual std::string toString() const = 0;
virtual poco_socklen_t length() const = 0;
virtual const void* addr() const = 0;
virtual Family family() const = 0;
virtual int af() const = 0;
virtual Poco::UInt32 scope() const = 0;
virtual bool isWildcard() const = 0;
virtual bool isBroadcast() const = 0;
virtual bool isLoopback() const = 0;
virtual bool isMulticast() const = 0;
virtual bool isLinkLocal() const = 0;
virtual bool isSiteLocal() const = 0;
virtual bool isIPv4Mapped() const = 0;
virtual bool isIPv4Compatible() const = 0;
virtual bool isWellKnownMC() const = 0;
virtual bool isNodeLocalMC() const = 0;
virtual bool isLinkLocalMC() const = 0;
virtual bool isSiteLocalMC() const = 0;
virtual bool isOrgLocalMC() const = 0;
virtual bool isGlobalMC() const = 0;
virtual void mask(const IPAddressImpl* pMask, const IPAddressImpl* pSet) = 0;
virtual unsigned prefixLength() const = 0;
virtual IPAddressImpl* clone() const = 0;
virtual ~IPAddressImpl();
protected:
IPAddressImpl();
private:
IPAddressImpl(const IPAddressImpl&);
IPAddressImpl& operator = (const IPAddressImpl&);
};
//
// IPv4AddressImpl
//
class IPv4AddressImpl: public IPAddressImpl
{
public:
IPv4AddressImpl();
IPv4AddressImpl(const void* addr);
IPv4AddressImpl(unsigned prefix);
IPv4AddressImpl(const IPv4AddressImpl& addr);
IPv4AddressImpl& operator = (const IPv4AddressImpl&);
std::string toString() const;
poco_socklen_t length() const;
const void* addr() const;
Family family() const;
int af() const;
unsigned prefixLength() const;
Poco::UInt32 scope() const;
bool isWildcard() const;
bool isBroadcast() const;
bool isLoopback() const;
bool isMulticast() const;
bool isLinkLocal() const;
bool isSiteLocal() const;
bool isIPv4Compatible() const;
bool isIPv4Mapped() const;
bool isWellKnownMC() const;
bool isNodeLocalMC() const;
bool isLinkLocalMC() const;
bool isSiteLocalMC() const;
bool isOrgLocalMC() const;
bool isGlobalMC() const;
static IPv4AddressImpl parse(const std::string& addr);
void mask(const IPAddressImpl* pMask, const IPAddressImpl* pSet);
IPAddressImpl* clone() const;
IPv4AddressImpl operator & (const IPv4AddressImpl& addr) const;
IPv4AddressImpl operator | (const IPv4AddressImpl& addr) const;
IPv4AddressImpl operator ^ (const IPv4AddressImpl& addr) const;
IPv4AddressImpl operator ~ () const;
bool operator == (const IPv4AddressImpl& addr) const;
bool operator != (const IPv4AddressImpl& addr) const;
private:
struct in_addr _addr;
};
//
// IPv6AddressImpl
//
class IPv6AddressImpl: public IPAddressImpl
{
public:
IPv6AddressImpl();
IPv6AddressImpl(const void* addr);
IPv6AddressImpl(const void* addr, Poco::UInt32 scope);
IPv6AddressImpl(unsigned prefix);
std::string toString() const;
poco_socklen_t length() const;
const void* addr() const;
Family family() const;
int af() const;
unsigned prefixLength() const;
Poco::UInt32 scope() const;
bool isWildcard() const;
bool isBroadcast() const;
bool isLoopback() const;
bool isMulticast() const;
bool isLinkLocal() const;
bool isSiteLocal() const;
bool isIPv4Compatible() const;
bool isIPv4Mapped() const;
bool isWellKnownMC() const;
bool isNodeLocalMC() const;
bool isLinkLocalMC() const;
bool isSiteLocalMC() const;
bool isOrgLocalMC() const;
bool isGlobalMC() const;
static IPv6AddressImpl parse(const std::string& addr);
void mask(const IPAddressImpl* pMask, const IPAddressImpl* pSet);
IPAddressImpl* clone() const;
IPv6AddressImpl operator & (const IPv6AddressImpl& addr) const;
IPv6AddressImpl operator | (const IPv6AddressImpl& addr) const;
IPv6AddressImpl operator ^ (const IPv6AddressImpl& addr) const;
IPv6AddressImpl operator ~ () const;
bool operator == (const IPv6AddressImpl& addr) const;
bool operator != (const IPv6AddressImpl& addr) const;
IPv6AddressImpl(const IPv6AddressImpl& addr);
IPv6AddressImpl& operator = (const IPv6AddressImpl&);
private:
struct in6_addr _addr;
unsigned int _scope;
};
} } } // namespace Poco::Net::Impl
#endif // Net_IPAddressImpl_INCLUDED

Просмотреть файл

@ -89,54 +89,48 @@
#endif // POCO_NET_NO_IPv6, POCO_HAVE_IPv6
#if !defined(s6_addr16)
#if defined(POCO_OS_FAMILY_WINDOWS)
#define s6_addr16 u.Word
#else
#define s6_addr16 __u6_addr.__u6_addr16
#endif
#endif
#if !defined(s6_addr32)
#if defined(POCO_OS_FAMILY_UNIX)
#if (POCO_OS == POCO_OS_SOLARIS)
#define s6_addr32 _S6_un._S6_u32
#else
#define s6_addr32 __u6_addr.__u6_addr32
#endif
#endif
#endif
namespace Poco {
namespace Net {
inline void Net_API initializeNetwork();
/// Initialize the network subsystem.
/// (Windows only, no-op elsewhere)
inline void Net_API uninitializeNetwork();
/// Uninitialize the network subsystem.
/// (Windows only, no-op elsewhere)
}} // namespace Poco::Net
//
// Automate network initialization on Windows.
// Automate network initialization (only relevant on Windows).
//
#if defined(POCO_OS_FAMILY_WINDOWS) && !defined(POCO_NET_NO_WINDOWS_INIT)
#if defined(POCO_STATIC)
extern "C" const struct NetworkInitializer pocoNetworkInitializer;
#ifdef _WIN64
#pragma comment(linker, "/include:pocoNetworkInitializer")
#else
#pragma comment(linker, "/include:_pocoNetworkInitializer")
#endif
#endif // POCO_STATIC
#endif // POCO_NET_NO_WINDOWS_INIT
#if defined(POCO_OS_FAMILY_WINDOWS) && !defined(POCO_NO_AUTOMATIC_LIB_INIT)
extern "C" const struct Net_API NetworkInitializer pocoNetworkInitializer;
#if defined(Net_EXPORTS)
#if defined(_WIN64)
#define POCO_NET_FORCE_SYMBOL(s) __pragma(comment (linker, "/export:"#s))
#elif defined(_WIN32)
#define POCO_NET_FORCE_SYMBOL(s) __pragma(comment (linker, "/export:_"#s))
#endif
#else // !Net_EXPORTS
#if defined(_WIN64)
#define POCO_NET_FORCE_SYMBOL(s) __pragma(comment (linker, "/include:"#s))
#elif defined(_WIN32)
#define POCO_NET_FORCE_SYMBOL(s) __pragma(comment (linker, "/include:_"#s))
#endif
#endif // Net_EXPORTS
POCO_NET_FORCE_SYMBOL(pocoNetworkInitializer)
#endif // POCO_OS_FAMILY_WINDOWS
//

Просмотреть файл

@ -331,4 +331,25 @@
#define poco_hton_16(x) poco_ntoh_16(x)
#define poco_hton_32(x) poco_ntoh_32(x)
#if !defined(s6_addr16)
#if defined(POCO_OS_FAMILY_WINDOWS)
#define s6_addr16 u.Word
#else
#define s6_addr16 __u6_addr.__u6_addr16
#endif
#endif
#if !defined(s6_addr32)
#if defined(POCO_OS_FAMILY_UNIX)
#if (POCO_OS == POCO_OS_SOLARIS)
#define s6_addr32 _S6_un._S6_u32
#else
#define s6_addr32 __u6_addr.__u6_addr32
#endif
#endif
#endif
#endif // Net_SocketDefs_INCLUDED

Просмотреть файл

@ -84,18 +84,18 @@ protected:
loadConfiguration(); // load default configuration files, if present
Application::initialize(self);
_icmpClient.pingBegin += Delegate<Ping, ICMPEventArgs>(this, &Ping::onBegin);
_icmpClient.pingReply += Delegate<Ping, ICMPEventArgs>(this, &Ping::onReply);
_icmpClient.pingError += Delegate<Ping, ICMPEventArgs>(this, &Ping::onError);
_icmpClient.pingEnd += Delegate<Ping, ICMPEventArgs>(this, &Ping::onEnd);
_icmpClient.pingBegin += delegate(this, &Ping::onBegin);
_icmpClient.pingReply += delegate(this, &Ping::onReply);
_icmpClient.pingError += delegate(this, &Ping::onError);
_icmpClient.pingEnd += delegate(this, &Ping::onEnd);
}
void uninitialize()
{
_icmpClient.pingBegin -= Delegate<Ping, ICMPEventArgs>(this, &Ping::onBegin);
_icmpClient.pingReply -= Delegate<Ping, ICMPEventArgs>(this, &Ping::onReply);
_icmpClient.pingError -= Delegate<Ping, ICMPEventArgs>(this, &Ping::onError);
_icmpClient.pingEnd -= Delegate<Ping, ICMPEventArgs>(this, &Ping::onEnd);
_icmpClient.pingBegin -= delegate(this, &Ping::onBegin);
_icmpClient.pingReply -= delegate(this, &Ping::onReply);
_icmpClient.pingError -= delegate(this, &Ping::onError);
_icmpClient.pingEnd -= delegate(this, &Ping::onEnd);
Application::uninitialize();
}

Просмотреть файл

@ -271,23 +271,4 @@ void DNS::aierror(int code, const std::string& arg)
}
void initializeNetwork()
{
#if defined(_WIN32)
WORD version = MAKEWORD(2, 2);
WSADATA data;
if (WSAStartup(version, &data) != 0)
throw NetException("Failed to initialize network subsystem");
#endif // _WIN32
}
void uninitializeNetwork()
{
#if defined(_WIN32)
WSACleanup();
#endif // _WIN32
}
} } // namespace Poco::Net

Разница между файлами не показана из-за своего большого размера Загрузить разницу

770
Net/src/IPAddressImpl.cpp Normal file
Просмотреть файл

@ -0,0 +1,770 @@
//
// IPAddress.cpp
//
// $Id: //poco/1.4/Net/src/IPAddress.cpp#5 $
//
// Library: Net
// Package: NetCore
// Module: IPAddress
//
// Copyright (c) 2005-2011, 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.
//
#include "Poco/Net/IPAddressImpl.h"
#include "Poco/Net/NetException.h"
#include "Poco/RefCountedObject.h"
#include "Poco/NumberFormatter.h"
#include "Poco/String.h"
#include "Poco/Types.h"
using Poco::RefCountedObject;
using Poco::NumberFormatter;
using Poco::toLower;
using Poco::UInt8;
using Poco::UInt16;
using Poco::UInt32;
namespace {
template <typename T>
unsigned maskBits(T val, unsigned size)
/// Returns the length of the mask (number of bits set in val).
/// The val should be either all zeros or two contiguos areas of 1s and 0s.
/// The algorithm ignores invalid non-contiguous series of 1s and treats val
/// as if all bits between MSb and last non-zero bit are set to 1.
{
unsigned count = 0;
if (val)
{
val = (val ^ (val - 1)) >> 1;
for (count = 0; val; ++count) val >>= 1;
}
else count = size;
return size - count;
}
} // namespace
namespace Poco {
namespace Net {
namespace Impl {
//
// IPAddressImpl
//
IPAddressImpl::IPAddressImpl()
{
}
IPAddressImpl::~IPAddressImpl()
{
}
//
// IPv4AddressImpl
//
IPv4AddressImpl::IPv4AddressImpl()
{
std::memset(&_addr, 0, sizeof(_addr));
}
IPv4AddressImpl::IPv4AddressImpl(const void* addr)
{
std::memcpy(&_addr, addr, sizeof(_addr));
}
IPv4AddressImpl::IPv4AddressImpl(unsigned prefix)
{
UInt32 addr = (prefix == 32) ? 0xffffffff : ~(0xffffffff >> prefix);
_addr.s_addr = htonl(addr);
}
IPv4AddressImpl::IPv4AddressImpl(const IPv4AddressImpl& addr)
{
std::memcpy(&_addr, &addr._addr, sizeof(_addr));
}
IPv4AddressImpl& IPv4AddressImpl::operator = (const IPv4AddressImpl& addr)
{
std::memcpy(&_addr, &addr._addr, sizeof(_addr));
return *this;
}
std::string IPv4AddressImpl::toString() const
{
const UInt8* bytes = reinterpret_cast<const UInt8*>(&_addr);
std::string result;
result.reserve(16);
NumberFormatter::append(result, bytes[0]);
result.append(".");
NumberFormatter::append(result, bytes[1]);
result.append(".");
NumberFormatter::append(result, bytes[2]);
result.append(".");
NumberFormatter::append(result, bytes[3]);
return result;
}
poco_socklen_t IPv4AddressImpl::length() const
{
return sizeof(_addr);
}
const void* IPv4AddressImpl::addr() const
{
return &_addr;
}
IPAddressImpl::Family IPv4AddressImpl::family() const
{
return IPAddressImpl::IPv4;
}
int IPv4AddressImpl::af() const
{
return AF_INET;
}
unsigned IPv4AddressImpl::prefixLength() const
{
return maskBits(ntohl(_addr.s_addr), 32);
}
Poco::UInt32 IPv4AddressImpl::scope() const
{
return 0;
}
bool IPv4AddressImpl::isWildcard() const
{
return _addr.s_addr == INADDR_ANY;
}
bool IPv4AddressImpl::isBroadcast() const
{
return _addr.s_addr == INADDR_NONE;
}
bool IPv4AddressImpl::isLoopback() const
{
return (ntohl(_addr.s_addr) & 0xFF000000) == 0x7F000000; // 127.0.0.1 to 127.255.255.255
}
bool IPv4AddressImpl::isMulticast() const
{
return (ntohl(_addr.s_addr) & 0xF0000000) == 0xE0000000; // 224.0.0.0/24 to 239.0.0.0/24
}
bool IPv4AddressImpl::isLinkLocal() const
{
return (ntohl(_addr.s_addr) & 0xFFFF0000) == 0xA9FE0000; // 169.254.0.0/16
}
bool IPv4AddressImpl::isSiteLocal() const
{
UInt32 addr = ntohl(_addr.s_addr);
return (addr & 0xFF000000) == 0x0A000000 || // 10.0.0.0/24
(addr & 0xFFFF0000) == 0xC0A80000 || // 192.68.0.0/16
(addr >= 0xAC100000 && addr <= 0xAC1FFFFF); // 172.16.0.0 to 172.31.255.255
}
bool IPv4AddressImpl::isIPv4Compatible() const
{
return true;
}
bool IPv4AddressImpl::isIPv4Mapped() const
{
return true;
}
bool IPv4AddressImpl::isWellKnownMC() const
{
return (ntohl(_addr.s_addr) & 0xFFFFFF00) == 0xE0000000; // 224.0.0.0/8
}
bool IPv4AddressImpl::isNodeLocalMC() const
{
return false;
}
bool IPv4AddressImpl::isLinkLocalMC() const
{
return (ntohl(_addr.s_addr) & 0xFF000000) == 0xE0000000; // 244.0.0.0/24
}
bool IPv4AddressImpl::isSiteLocalMC() const
{
return (ntohl(_addr.s_addr) & 0xFFFF0000) == 0xEFFF0000; // 239.255.0.0/16
}
bool IPv4AddressImpl::isOrgLocalMC() const
{
return (ntohl(_addr.s_addr) & 0xFFFF0000) == 0xEFC00000; // 239.192.0.0/16
}
bool IPv4AddressImpl::isGlobalMC() const
{
UInt32 addr = ntohl(_addr.s_addr);
return addr >= 0xE0000100 && addr <= 0xEE000000; // 224.0.1.0 to 238.255.255.255
}
IPv4AddressImpl IPv4AddressImpl::parse(const std::string& addr)
{
if (addr.empty()) return IPv4AddressImpl();
#if defined(_WIN32)
struct in_addr ia;
ia.s_addr = inet_addr(addr.c_str());
if (ia.s_addr == INADDR_NONE && addr != "255.255.255.255")
return IPv4AddressImpl();
else
return IPv4AddressImpl(&ia);
#else
#if __GNUC__ < 3 || defined(POCO_VXWORKS)
struct in_addr ia;
ia.s_addr = inet_addr(const_cast<char*>(addr.c_str()));
if (ia.s_addr == INADDR_NONE && addr != "255.255.255.255")
return IPv4AddressImpl();
else
return IPv4AddressImpl(&ia);
#else
struct in_addr ia;
if (inet_aton(addr.c_str(), &ia))
return IPv4AddressImpl(&ia);
else
return IPv4AddressImpl();
#endif
#endif
}
void IPv4AddressImpl::mask(const IPAddressImpl* pMask, const IPAddressImpl* pSet)
{
poco_assert (pMask->af() == AF_INET && pSet->af() == AF_INET);
_addr.s_addr &= static_cast<const IPv4AddressImpl*>(pMask)->_addr.s_addr;
_addr.s_addr |= static_cast<const IPv4AddressImpl*>(pSet)->_addr.s_addr & ~static_cast<const IPv4AddressImpl*>(pMask)->_addr.s_addr;
}
IPAddressImpl* IPv4AddressImpl::clone() const
{
return new IPv4AddressImpl(&_addr);
}
IPv4AddressImpl IPv4AddressImpl::operator & (const IPv4AddressImpl& addr) const
{
IPv4AddressImpl result(&_addr);
result._addr.s_addr &= addr._addr.s_addr;
return result;
}
IPv4AddressImpl IPv4AddressImpl::operator | (const IPv4AddressImpl& addr) const
{
IPv4AddressImpl result(&_addr);
result._addr.s_addr |= addr._addr.s_addr;
return result;
}
IPv4AddressImpl IPv4AddressImpl::operator ^ (const IPv4AddressImpl& addr) const
{
IPv4AddressImpl result(&_addr);
result._addr.s_addr ^= addr._addr.s_addr;
return result;
}
IPv4AddressImpl IPv4AddressImpl::operator ~ () const
{
IPv4AddressImpl result(&_addr);
result._addr.s_addr ^= 0xffffffff;
return result;
}
bool IPv4AddressImpl::operator == (const IPv4AddressImpl& addr) const
{
return 0 == std::memcmp(&addr._addr, &_addr, sizeof(_addr));
}
bool IPv4AddressImpl::operator != (const IPv4AddressImpl& addr) const
{
return !(*this == addr);
}
#if defined(POCO_HAVE_IPv6)
//
// IPv6AddressImpl
//
IPv6AddressImpl::IPv6AddressImpl(): _scope(0)
{
std::memset(&_addr, 0, sizeof(_addr));
}
IPv6AddressImpl::IPv6AddressImpl(const void* addr): _scope(0)
{
std::memcpy(&_addr, addr, sizeof(_addr));
}
IPv6AddressImpl::IPv6AddressImpl(const void* addr, Poco::UInt32 scope): _scope(scope)
{
std::memcpy(&_addr, addr, sizeof(_addr));
}
IPv6AddressImpl::IPv6AddressImpl(const IPv6AddressImpl& addr): _scope(addr._scope)
{
std::memcpy((void*) &_addr, (void*) &addr._addr, sizeof(_addr));
}
IPv6AddressImpl& IPv6AddressImpl::operator = (const IPv6AddressImpl& addr)
{
_scope = addr._scope;
std::memcpy(&_addr, &addr._addr, sizeof(_addr));
return *this;
}
IPv6AddressImpl::IPv6AddressImpl(unsigned prefix):
_scope(0)
{
unsigned i = 0;
#ifdef POCO_OS_FAMILY_WINDOWS
for (; prefix >= 16; ++i, prefix -= 16) {
_addr.s6_addr16[i] = 0xffff;
}
if (prefix > 0)
_addr.s6_addr16[i++] = htons(~(0xffff >> prefix));
while (i < 8)
_addr.s6_addr16[i++] = 0;
#else
for (; prefix >= 32; ++i, prefix -= 32) {
_addr.s6_addr32[i] = 0xffffffff;
}
if (prefix > 0)
_addr.s6_addr32[i++] = htonl(~(0xffffffffU >> prefix));
while (i < 4)
_addr.s6_addr32[i++] = 0;
#endif
}
std::string IPv6AddressImpl::toString() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
if (isIPv4Compatible() || isIPv4Mapped())
{
std::string result;
result.reserve(24);
if (words[5] == 0)
result.append("::");
else
result.append("::ffff:");
const UInt8* bytes = reinterpret_cast<const UInt8*>(&_addr);
NumberFormatter::append(result, bytes[12]);
result.append(".");
NumberFormatter::append(result, bytes[13]);
result.append(".");
NumberFormatter::append(result, bytes[14]);
result.append(".");
NumberFormatter::append(result, bytes[15]);
return result;
}
else
{
std::string result;
result.reserve(64);
bool zeroSequence = false;
int i = 0;
while (i < 8)
{
if (!zeroSequence && words[i] == 0)
{
int zi = i;
while (zi < 8 && words[zi] == 0) ++zi;
if (zi > i + 1)
{
i = zi;
result.append(":");
zeroSequence = true;
}
}
if (i > 0) result.append(":");
if (i < 8) NumberFormatter::appendHex(result, ntohs(words[i++]));
}
if (_scope > 0)
{
result.append("%");
#if defined(_WIN32)
NumberFormatter::append(result, _scope);
#else
char buffer[IFNAMSIZ];
if (if_indextoname(_scope, buffer))
{
result.append(buffer);
}
else
{
NumberFormatter::append(result, _scope);
}
#endif
}
return toLower(result);
}
}
poco_socklen_t IPv6AddressImpl::length() const
{
return sizeof(_addr);
}
const void* IPv6AddressImpl::addr() const
{
return &_addr;
}
IPAddressImpl::Family IPv6AddressImpl::family() const
{
return IPAddressImpl::IPv6;
}
int IPv6AddressImpl::af() const
{
return AF_INET6;
}
unsigned IPv6AddressImpl::prefixLength() const
{
unsigned bits = 0;
unsigned bitPos = 128;
#if defined(POCO_OS_FAMILY_UNIX)
for (int i = 3; i >= 0; --i)
{
unsigned addr = ntohl(_addr.s6_addr32[i]);
if ((bits = maskBits(addr, 32))) return (bitPos - (32 - bits));
bitPos -= 32;
}
return 0;
#elif defined(POCO_OS_FAMILY_WINDOWS)
for (int i = 7; i >= 0; --i)
{
unsigned short addr = ntohs(_addr.s6_addr16[i]);
if ((bits = maskBits(addr, 16))) return (bitPos - (16 - bits));
bitPos -= 16;
}
return 0;
#else
#warning prefixLength() not implemented
throw NotImplementedException("prefixLength() not implemented");
#endif
}
Poco::UInt32 IPv6AddressImpl::scope() const
{
return _scope;
}
bool IPv6AddressImpl::isWildcard() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return words[0] == 0 && words[1] == 0 && words[2] == 0 && words[3] == 0 &&
words[4] == 0 && words[5] == 0 && words[6] == 0 && words[7] == 0;
}
bool IPv6AddressImpl::isBroadcast() const
{
return false;
}
bool IPv6AddressImpl::isLoopback() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return words[0] == 0 && words[1] == 0 && words[2] == 0 && words[3] == 0 &&
words[4] == 0 && words[5] == 0 && words[6] == 0 && ntohs(words[7]) == 0x0001;
}
bool IPv6AddressImpl::isMulticast() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return (ntohs(words[0]) & 0xFFE0) == 0xFF00;
}
bool IPv6AddressImpl::isLinkLocal() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return (ntohs(words[0]) & 0xFFE0) == 0xFE80;
}
bool IPv6AddressImpl::isSiteLocal() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return ((ntohs(words[0]) & 0xFFE0) == 0xFEC0) || ((ntohs(words[0]) & 0xFF00) == 0xFC00);
}
bool IPv6AddressImpl::isIPv4Compatible() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return words[0] == 0 && words[1] == 0 && words[2] == 0 && words[3] == 0 && words[4] == 0 && words[5] == 0;
}
bool IPv6AddressImpl::isIPv4Mapped() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return words[0] == 0 && words[1] == 0 && words[2] == 0 && words[3] == 0 && words[4] == 0 && ntohs(words[5]) == 0xFFFF;
}
bool IPv6AddressImpl::isWellKnownMC() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return (ntohs(words[0]) & 0xFFF0) == 0xFF00;
}
bool IPv6AddressImpl::isNodeLocalMC() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return (ntohs(words[0]) & 0xFFEF) == 0xFF01;
}
bool IPv6AddressImpl::isLinkLocalMC() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return (ntohs(words[0]) & 0xFFEF) == 0xFF02;
}
bool IPv6AddressImpl::isSiteLocalMC() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return (ntohs(words[0]) & 0xFFEF) == 0xFF05;
}
bool IPv6AddressImpl::isOrgLocalMC() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return (ntohs(words[0]) & 0xFFEF) == 0xFF08;
}
bool IPv6AddressImpl::isGlobalMC() const
{
const UInt16* words = reinterpret_cast<const UInt16*>(&_addr);
return (ntohs(words[0]) & 0xFFEF) == 0xFF0F;
}
IPv6AddressImpl IPv6AddressImpl::parse(const std::string& addr)
{
if (addr.empty()) return IPv6AddressImpl();
#if defined(_WIN32)
struct addrinfo* pAI;
struct addrinfo hints;
std::memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
int rc = getaddrinfo(addr.c_str(), NULL, &hints, &pAI);
if (rc == 0)
{
IPv6AddressImpl result = IPv6AddressImpl(&reinterpret_cast<struct sockaddr_in6*>(pAI->ai_addr)->sin6_addr, static_cast<int>(reinterpret_cast<struct sockaddr_in6*>(pAI->ai_addr)->sin6_scope_id));
freeaddrinfo(pAI);
return result;
}
else return IPv6AddressImpl();
#else
struct in6_addr ia;
std::string::size_type pos = addr.find('%');
if (std::string::npos != pos)
{
std::string::size_type start = ('[' == addr[0]) ? 1 : 0;
std::string unscopedAddr(addr, start, pos - start);
std::string scope(addr, pos + 1, addr.size() - start - pos);
Poco::UInt32 scopeId(0);
if (!(scopeId = if_nametoindex(scope.c_str())))
return IPv6AddressImpl();
if (inet_pton(AF_INET6, unscopedAddr.c_str(), &ia) == 1)
return IPv6AddressImpl(&ia, scopeId);
else
return IPv6AddressImpl();
}
else
{
if (inet_pton(AF_INET6, addr.c_str(), &ia) == 1)
return IPv6AddressImpl(&ia);
else
return IPv6AddressImpl();
}
#endif
}
void IPv6AddressImpl::mask(const IPAddressImpl* pMask, const IPAddressImpl* pSet)
{
throw Poco::NotImplementedException("mask() is only supported for IPv4 addresses");
}
IPAddressImpl* IPv6AddressImpl::clone() const
{
return new IPv6AddressImpl(&_addr, _scope);
}
IPv6AddressImpl IPv6AddressImpl::operator & (const IPv6AddressImpl& addr) const
{
IPv6AddressImpl result(&_addr);
#ifdef POCO_OS_FAMILY_WINDOWS
result._addr.s6_addr16[0] &= addr._addr.s6_addr16[0];
result._addr.s6_addr16[1] &= addr._addr.s6_addr16[1];
result._addr.s6_addr16[2] &= addr._addr.s6_addr16[2];
result._addr.s6_addr16[3] &= addr._addr.s6_addr16[3];
result._addr.s6_addr16[4] &= addr._addr.s6_addr16[4];
result._addr.s6_addr16[5] &= addr._addr.s6_addr16[5];
result._addr.s6_addr16[6] &= addr._addr.s6_addr16[6];
result._addr.s6_addr16[7] &= addr._addr.s6_addr16[7];
#else
result._addr.s6_addr32[0] &= addr._addr.s6_addr32[0];
result._addr.s6_addr32[1] &= addr._addr.s6_addr32[1];
result._addr.s6_addr32[2] &= addr._addr.s6_addr32[2];
result._addr.s6_addr32[3] &= addr._addr.s6_addr32[3];
#endif
return result;
}
IPv6AddressImpl IPv6AddressImpl::operator | (const IPv6AddressImpl& addr) const
{
IPv6AddressImpl result(&_addr);
#ifdef POCO_OS_FAMILY_WINDOWS
result._addr.s6_addr16[0] |= addr._addr.s6_addr16[0];
result._addr.s6_addr16[1] |= addr._addr.s6_addr16[1];
result._addr.s6_addr16[2] |= addr._addr.s6_addr16[2];
result._addr.s6_addr16[3] |= addr._addr.s6_addr16[3];
result._addr.s6_addr16[4] |= addr._addr.s6_addr16[4];
result._addr.s6_addr16[5] |= addr._addr.s6_addr16[5];
result._addr.s6_addr16[6] |= addr._addr.s6_addr16[6];
result._addr.s6_addr16[7] |= addr._addr.s6_addr16[7];
#else
result._addr.s6_addr32[0] |= addr._addr.s6_addr32[0];
result._addr.s6_addr32[1] |= addr._addr.s6_addr32[1];
result._addr.s6_addr32[2] |= addr._addr.s6_addr32[2];
result._addr.s6_addr32[3] |= addr._addr.s6_addr32[3];
#endif
return result;
}
IPv6AddressImpl IPv6AddressImpl::operator ^ (const IPv6AddressImpl& addr) const
{
IPv6AddressImpl result(&_addr);
#ifdef POCO_OS_FAMILY_WINDOWS
result._addr.s6_addr16[0] ^= addr._addr.s6_addr16[0];
result._addr.s6_addr16[1] ^= addr._addr.s6_addr16[1];
result._addr.s6_addr16[2] ^= addr._addr.s6_addr16[2];
result._addr.s6_addr16[3] ^= addr._addr.s6_addr16[3];
result._addr.s6_addr16[4] ^= addr._addr.s6_addr16[4];
result._addr.s6_addr16[5] ^= addr._addr.s6_addr16[5];
result._addr.s6_addr16[6] ^= addr._addr.s6_addr16[6];
result._addr.s6_addr16[7] ^= addr._addr.s6_addr16[7];
#else
result._addr.s6_addr32[0] ^= addr._addr.s6_addr32[0];
result._addr.s6_addr32[1] ^= addr._addr.s6_addr32[1];
result._addr.s6_addr32[2] ^= addr._addr.s6_addr32[2];
result._addr.s6_addr32[3] ^= addr._addr.s6_addr32[3];
#endif
return result;
}
IPv6AddressImpl IPv6AddressImpl::operator ~ () const
{
IPv6AddressImpl result(&_addr);
#ifdef POCO_OS_FAMILY_WINDOWS
result._addr.s6_addr16[0] ^= 0xffff;
result._addr.s6_addr16[1] ^= 0xffff;
result._addr.s6_addr16[2] ^= 0xffff;
result._addr.s6_addr16[3] ^= 0xffff;
result._addr.s6_addr16[4] ^= 0xffff;
result._addr.s6_addr16[5] ^= 0xffff;
result._addr.s6_addr16[6] ^= 0xffff;
result._addr.s6_addr16[7] ^= 0xffff;
#else
result._addr.s6_addr32[0] ^= 0xffffffff;
result._addr.s6_addr32[1] ^= 0xffffffff;
result._addr.s6_addr32[2] ^= 0xffffffff;
result._addr.s6_addr32[3] ^= 0xffffffff;
#endif
return result;
}
bool IPv6AddressImpl::operator == (const IPv6AddressImpl& addr) const
{
return 0 == std::memcmp(&addr._addr, &_addr, sizeof(_addr));
}
bool IPv6AddressImpl::operator != (const IPv6AddressImpl& addr) const
{
return !(*this == addr);
}
#endif // POCO_HAVE_IPv6
} } } // namespace Poco::Net::Impl

Просмотреть файл

@ -37,9 +37,6 @@
#include "Poco/Net/Net.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
#include "Poco/Net/SocketDefs.h"
#include "Poco/Net/NetException.h"
@ -50,68 +47,45 @@ namespace Net {
void Net_API initializeNetwork()
{
#if defined(POCO_OS_FAMILY_WINDOWS)
WORD version = MAKEWORD(2, 2);
WSADATA data;
if (WSAStartup(version, &data) != 0)
throw NetException("Failed to initialize network subsystem");
#endif
}
void Net_API uninitializeNetwork()
{
#if defined(POCO_OS_FAMILY_WINDOWS)
WSACleanup();
#endif
}
} } // namespace Poco::Net
#if !defined(POCO_NET_NO_WINDOWS_INIT)
#if defined (POCO_DLL)
BOOL APIENTRY DllMain(HANDLE, DWORD reasonForCall, LPVOID)
#if defined(POCO_OS_FAMILY_WINDOWS) && !defined(POCO_NO_AUTOMATIC_LIB_INIT)
struct NetworkInitializer
/// Network initializer for windows statically
/// linked library.
{
NetworkInitializer()
/// Calls Poco::Net::initializeNetwork();
{
switch(reasonForCall)
{
case DLL_PROCESS_ATTACH:
Poco::Net::initializeNetwork();
break;
case DLL_PROCESS_DETACH:
Poco::Net::uninitializeNetwork();
}
return TRUE;
Poco::Net::initializeNetwork();
}
#else // POCO_STATIC
struct NetworkInitializer
/// Network initializer for windows statically
/// linked library.
~NetworkInitializer()
/// Calls Poco::Net::uninitializeNetwork();
{
NetworkInitializer()
/// Calls Poco::Net::initializeNetwork();
{
Poco::Net::initializeNetwork();
}
Poco::Net::uninitializeNetwork();
}
};
~NetworkInitializer()
/// Calls Poco::Net::uninitializeNetwork();
{
Poco::Net::uninitializeNetwork();
}
};
const NetworkInitializer pocoNetworkInitializer;
const NetworkInitializer pocoNetworkInitializer;
#endif // POCO_DLL/POCO_STATIC
#endif // POCO_NET_NO_WINDOWS_INIT
#else // POCO_OS_FAMILY_WINDOWS
void Net_API initializeNetwork()
{
}
void Net_API uninitializeNetwork()
{
}
#endif // POCO_OS_FAMILY_WINDOWS
#endif

Просмотреть файл

@ -136,7 +136,7 @@ int StreamSocket::sendBytes(const void* buffer, int length, int flags)
int StreamSocket::sendBytes(FIFOBuffer& fifoBuf)
{
int ret = impl()->sendBytes(&fifoBuf.buffer()[0], fifoBuf.used());
int ret = impl()->sendBytes(&fifoBuf.buffer()[0], (int) fifoBuf.used());
if (ret > 0) fifoBuf.drain(ret);
return ret;
}
@ -150,7 +150,7 @@ int StreamSocket::receiveBytes(void* buffer, int length, int flags)
int StreamSocket::receiveBytes(FIFOBuffer& fifoBuf)
{
int ret = impl()->receiveBytes(fifoBuf.next(), fifoBuf.available());
int ret = impl()->receiveBytes(fifoBuf.next(), (int) fifoBuf.available());
if (ret > 0) fifoBuf.advance(ret);
return ret;
}

Просмотреть файл

@ -129,7 +129,7 @@ void WebSocketTest::testWebSocket()
WebSocket ws(cs, request, response);
std::string payload("x");
ws.sendFrame(payload.data(), payload.size());
ws.sendFrame(payload.data(), (int) payload.size());
char buffer[1024];
int flags;
int n = ws.receiveFrame(buffer, sizeof(buffer), flags);
@ -140,7 +140,7 @@ void WebSocketTest::testWebSocket()
for (int i = 2; i < 20; i++)
{
payload.assign(i, 'x');
ws.sendFrame(payload.data(), payload.size());
ws.sendFrame(payload.data(), (int) payload.size());
n = ws.receiveFrame(buffer, sizeof(buffer), flags);
assert (n == payload.size());
assert (payload.compare(0, payload.size(), buffer, 0, n) == 0);
@ -150,7 +150,7 @@ void WebSocketTest::testWebSocket()
for (int i = 125; i < 129; i++)
{
payload.assign(i, 'x');
ws.sendFrame(payload.data(), payload.size());
ws.sendFrame(payload.data(), (int) payload.size());
n = ws.receiveFrame(buffer, sizeof(buffer), flags);
assert (n == payload.size());
assert (payload.compare(0, payload.size(), buffer, 0, n) == 0);
@ -158,14 +158,14 @@ void WebSocketTest::testWebSocket()
}
payload = "Hello, world!";
ws.sendFrame(payload.data(), payload.size());
ws.sendFrame(payload.data(), (int) payload.size());
n = ws.receiveFrame(buffer, sizeof(buffer), flags);
assert (n == payload.size());
assert (payload.compare(0, payload.size(), buffer, 0, n) == 0);
assert (flags == WebSocket::FRAME_TEXT);
payload = "Hello, universe!";
ws.sendFrame(payload.data(), payload.size(), WebSocket::FRAME_BINARY);
ws.sendFrame(payload.data(), (int) payload.size(), WebSocket::FRAME_BINARY);
n = ws.receiveFrame(buffer, sizeof(buffer), flags);
assert (n == payload.size());
assert (payload.compare(0, payload.size(), buffer, 0, n) == 0);

Просмотреть файл

@ -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,76 +32,76 @@
<RootNamespace>Util</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>
</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>
</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>
</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>
</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>
</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>
</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;">PocoUtild</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">PocoUtilmdd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">PocoUtilmtd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">PocoUtil</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">PocoUtilmd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">PocoUtilmt</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'">PocoUtild</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">PocoUtilmdd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">PocoUtilmtd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">PocoUtil</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">PocoUtilmd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">PocoUtilmt</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;..\XML\include;..\JSON\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -114,7 +114,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -132,7 +132,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>
@ -147,9 +147,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>
@ -166,7 +166,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;..\XML\include;..\JSON\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -179,7 +179,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\lib\PocoUtilmtd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
@ -190,7 +190,7 @@
<OutputFile>..\lib\PocoUtilmtd.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>
@ -205,9 +205,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>
@ -215,7 +215,7 @@
<OutputFile>..\lib\PocoUtilmt.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;..\XML\include;..\JSON\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -228,7 +228,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\lib\PocoUtilmdd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
@ -239,7 +239,7 @@
<OutputFile>..\lib\PocoUtilmdd.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>
@ -254,10 +254,10 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\lib\PocoUtilmd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -267,79 +267,80 @@
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="include\Poco\Util\Application.h"/>
<ClInclude Include="include\Poco\Util\LoggingSubsystem.h"/>
<ClInclude Include="include\Poco\Util\ServerApplication.h"/>
<ClInclude Include="include\Poco\Util\Subsystem.h"/>
<ClInclude Include="include\Poco\Util\AbstractConfiguration.h"/>
<ClInclude Include="include\Poco\Util\ConfigurationMapper.h"/>
<ClInclude Include="include\Poco\Util\ConfigurationView.h"/>
<ClInclude Include="include\Poco\Util\FilesystemConfiguration.h"/>
<ClInclude Include="include\Poco\Util\IniFileConfiguration.h"/>
<ClInclude Include="include\Poco\Util\JSONConfiguration.h"/>
<ClInclude Include="include\Poco\Util\LayeredConfiguration.h"/>
<ClInclude Include="include\Poco\Util\LoggingConfigurator.h"/>
<ClInclude Include="include\Poco\Util\MapConfiguration.h"/>
<ClInclude Include="include\Poco\Util\PropertyFileConfiguration.h"/>
<ClInclude Include="include\Poco\Util\SystemConfiguration.h"/>
<ClInclude Include="include\Poco\Util\XMLConfiguration.h"/>
<ClInclude Include="include\Poco\Util\HelpFormatter.h"/>
<ClInclude Include="include\Poco\Util\IntValidator.h"/>
<ClInclude Include="include\Poco\Util\Option.h"/>
<ClInclude Include="include\Poco\Util\OptionCallback.h"/>
<ClInclude Include="include\Poco\Util\OptionException.h"/>
<ClInclude Include="include\Poco\Util\OptionProcessor.h"/>
<ClInclude Include="include\Poco\Util\OptionSet.h"/>
<ClInclude Include="include\Poco\Util\RegExpValidator.h"/>
<ClInclude Include="include\Poco\Util\Validator.h"/>
<ClInclude Include="include\Poco\Util\WinRegistryConfiguration.h"/>
<ClInclude Include="include\Poco\Util\WinRegistryKey.h"/>
<ClInclude Include="include\Poco\Util\WinService.h"/>
<ClInclude Include="include\Poco\Util\Util.h"/>
<ClInclude Include="include\Poco\Util\Timer.h"/>
<ClInclude Include="include\Poco\Util\TimerTask.h"/>
<ClInclude Include="include\Poco\Util\TimerTaskAdapter.h"/>
<ClInclude Include="include\Poco\Util\Application.h" />
<ClInclude Include="include\Poco\Util\LoggingSubsystem.h" />
<ClInclude Include="include\Poco\Util\ServerApplication.h" />
<ClInclude Include="include\Poco\Util\Subsystem.h" />
<ClInclude Include="include\Poco\Util\AbstractConfiguration.h" />
<ClInclude Include="include\Poco\Util\ConfigurationMapper.h" />
<ClInclude Include="include\Poco\Util\ConfigurationView.h" />
<ClInclude Include="include\Poco\Util\FilesystemConfiguration.h" />
<ClInclude Include="include\Poco\Util\IniFileConfiguration.h" />
<ClInclude Include="include\Poco\Util\JSONConfiguration.h" />
<ClInclude Include="include\Poco\Util\LayeredConfiguration.h" />
<ClInclude Include="include\Poco\Util\LoggingConfigurator.h" />
<ClInclude Include="include\Poco\Util\MapConfiguration.h" />
<ClInclude Include="include\Poco\Util\PropertyFileConfiguration.h" />
<ClInclude Include="include\Poco\Util\SystemConfiguration.h" />
<ClInclude Include="include\Poco\Util\Units.h" />
<ClInclude Include="include\Poco\Util\XMLConfiguration.h" />
<ClInclude Include="include\Poco\Util\HelpFormatter.h" />
<ClInclude Include="include\Poco\Util\IntValidator.h" />
<ClInclude Include="include\Poco\Util\Option.h" />
<ClInclude Include="include\Poco\Util\OptionCallback.h" />
<ClInclude Include="include\Poco\Util\OptionException.h" />
<ClInclude Include="include\Poco\Util\OptionProcessor.h" />
<ClInclude Include="include\Poco\Util\OptionSet.h" />
<ClInclude Include="include\Poco\Util\RegExpValidator.h" />
<ClInclude Include="include\Poco\Util\Validator.h" />
<ClInclude Include="include\Poco\Util\WinRegistryConfiguration.h" />
<ClInclude Include="include\Poco\Util\WinRegistryKey.h" />
<ClInclude Include="include\Poco\Util\WinService.h" />
<ClInclude Include="include\Poco\Util\Util.h" />
<ClInclude Include="include\Poco\Util\Timer.h" />
<ClInclude Include="include\Poco\Util\TimerTask.h" />
<ClInclude Include="include\Poco\Util\TimerTaskAdapter.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Application.cpp"/>
<ClCompile Include="src\LoggingSubsystem.cpp"/>
<ClCompile Include="src\ServerApplication.cpp"/>
<ClCompile Include="src\Subsystem.cpp"/>
<ClCompile Include="src\AbstractConfiguration.cpp"/>
<ClCompile Include="src\ConfigurationMapper.cpp"/>
<ClCompile Include="src\ConfigurationView.cpp"/>
<ClCompile Include="src\FilesystemConfiguration.cpp"/>
<ClCompile Include="src\IniFileConfiguration.cpp"/>
<ClCompile Include="src\JSONConfiguration.cpp"/>
<ClCompile Include="src\LayeredConfiguration.cpp"/>
<ClCompile Include="src\LoggingConfigurator.cpp"/>
<ClCompile Include="src\MapConfiguration.cpp"/>
<ClCompile Include="src\PropertyFileConfiguration.cpp"/>
<ClCompile Include="src\SystemConfiguration.cpp"/>
<ClCompile Include="src\XMLConfiguration.cpp"/>
<ClCompile Include="src\HelpFormatter.cpp"/>
<ClCompile Include="src\IntValidator.cpp"/>
<ClCompile Include="src\Option.cpp"/>
<ClCompile Include="src\OptionCallback.cpp"/>
<ClCompile Include="src\OptionException.cpp"/>
<ClCompile Include="src\OptionProcessor.cpp"/>
<ClCompile Include="src\OptionSet.cpp"/>
<ClCompile Include="src\RegExpValidator.cpp"/>
<ClCompile Include="src\Validator.cpp"/>
<ClCompile Include="src\WinRegistryConfiguration.cpp"/>
<ClCompile Include="src\WinRegistryKey.cpp"/>
<ClCompile Include="src\WinService.cpp"/>
<ClCompile Include="src\Timer.cpp"/>
<ClCompile Include="src\TimerTask.cpp"/>
<ClCompile Include="src\Application.cpp" />
<ClCompile Include="src\LoggingSubsystem.cpp" />
<ClCompile Include="src\ServerApplication.cpp" />
<ClCompile Include="src\Subsystem.cpp" />
<ClCompile Include="src\AbstractConfiguration.cpp" />
<ClCompile Include="src\ConfigurationMapper.cpp" />
<ClCompile Include="src\ConfigurationView.cpp" />
<ClCompile Include="src\FilesystemConfiguration.cpp" />
<ClCompile Include="src\IniFileConfiguration.cpp" />
<ClCompile Include="src\JSONConfiguration.cpp" />
<ClCompile Include="src\LayeredConfiguration.cpp" />
<ClCompile Include="src\LoggingConfigurator.cpp" />
<ClCompile Include="src\MapConfiguration.cpp" />
<ClCompile Include="src\PropertyFileConfiguration.cpp" />
<ClCompile Include="src\SystemConfiguration.cpp" />
<ClCompile Include="src\XMLConfiguration.cpp" />
<ClCompile Include="src\HelpFormatter.cpp" />
<ClCompile Include="src\IntValidator.cpp" />
<ClCompile Include="src\Option.cpp" />
<ClCompile Include="src\OptionCallback.cpp" />
<ClCompile Include="src\OptionException.cpp" />
<ClCompile Include="src\OptionProcessor.cpp" />
<ClCompile Include="src\OptionSet.cpp" />
<ClCompile Include="src\RegExpValidator.cpp" />
<ClCompile Include="src\Validator.cpp" />
<ClCompile Include="src\WinRegistryConfiguration.cpp" />
<ClCompile Include="src\WinRegistryKey.cpp" />
<ClCompile Include="src\WinService.cpp" />
<ClCompile Include="src\Timer.cpp" />
<ClCompile Include="src\TimerTask.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\DLLVersion.rc">
<ExcludedFromBuild Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">true</ExcludedFromBuild>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/>
</Project>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

Просмотреть файл

@ -153,6 +153,9 @@
<ClInclude Include="include\Poco\Util\TimerTaskAdapter.h">
<Filter>Timer\Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Poco\Util\Units.h">
<Filter>Util\Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Application.cpp">