diff --git a/Util/Makefile b/Util/Makefile index b5f75d4f6..e46d80779 100644 --- a/Util/Makefile +++ b/Util/Makefile @@ -17,8 +17,8 @@ objects = AbstractConfiguration Application ConfigurationMapper \ Validator IntValidator RegExpValidator OptionCallback \ Timer TimerTask -ifeq ($(POCO_CONFIG),MinGW) - objects += WinService +ifeq ($(findstring MinGW, $(POCO_CONFIG)), MinGW) + objects += WinService WinRegistryKey WinRegistryConfiguration endif target = PocoUtil diff --git a/Util/Util_vs100.sln b/Util/Util_vs100.sln new file mode 100644 index 000000000..2cc064fe6 --- /dev/null +++ b/Util/Util_vs100.sln @@ -0,0 +1,60 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Util", "Util_vs100.vcxproj", "{6FF56CDB-787A-4714-A28C-919003F9FA6C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_vs100.vcxproj", "{E40E738C-447B-40F4-A878-EBA9A2459270}" + ProjectSection(ProjectDependencies) = postProject + {6FF56CDB-787A-4714-A28C-919003F9FA6C} = {6FF56CDB-787A-4714-A28C-919003F9FA6C} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_shared|Win32.Build.0 = release_shared|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_shared|Win32.Build.0 = release_shared|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Util/Util_vs100.vcxproj b/Util/Util_vs100.vcxproj new file mode 100644 index 000000000..2cc06c9ba --- /dev/null +++ b/Util/Util_vs100.vcxproj @@ -0,0 +1,335 @@ + + + + + debug_shared + Win32 + + + debug_static_md + Win32 + + + debug_static_mt + Win32 + + + release_shared + Win32 + + + release_static_md + Win32 + + + release_static_mt + Win32 + + + + Util + {6FF56CDB-787A-4714-A28C-919003F9FA6C} + Util + Win32Proj + + + + StaticLibrary + MultiByte + + + StaticLibrary + MultiByte + + + StaticLibrary + MultiByte + + + StaticLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + ..\bin\ + obj\$(Configuration)\ + true + ..\bin\ + obj\$(Configuration)\ + false + ..\lib\ + obj\$(Configuration)\ + ..\lib\ + obj\$(Configuration)\ + ..\lib\ + obj\$(Configuration)\ + ..\lib\ + obj\$(Configuration)\ + PocoUtild + PocoUtilmdd + PocoUtilmtd + PocoUtil + PocoUtilmd + PocoUtilmt + + + + Disabled + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;Util_EXPORTS;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + %(AdditionalDependencies) + ..\bin\PocoUtild.dll + true + true + ..\bin\PocoUtild.pdb + ..\lib;%(AdditionalLibraryDirectories) + Console + ..\lib\PocoUtild.lib + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;Util_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + %(AdditionalDependencies) + ..\bin\PocoUtil.dll + true + false + ..\lib;%(AdditionalLibraryDirectories) + Console + true + true + ..\lib\PocoUtil.lib + MachineX86 + + + + + Disabled + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + ..\lib\PocoUtilmtd.pdb + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + ..\lib\PocoUtilmtd.lib + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + ..\lib\PocoUtilmt.lib + + + + + Disabled + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + ..\lib\PocoUtilmdd.pdb + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + ..\lib\PocoUtilmdd.lib + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + ..\lib\PocoUtilmd.pdb + Level3 + + Default + %(DisableSpecificWarnings) + + + %(AdditionalDependencies) + ..\lib\PocoUtilmd.lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Util/Util_vs100.vcxproj.filters b/Util/Util_vs100.vcxproj.filters new file mode 100644 index 000000000..abed39147 --- /dev/null +++ b/Util/Util_vs100.vcxproj.filters @@ -0,0 +1,243 @@ + + + + + {954c077e-8502-46bc-9e5d-6a0a04b06ae5} + + + {62047649-cff2-455b-832b-4f24c8450686} + + + {7a61e44e-9f52-4d61-8a20-7801be6c418f} + + + {afe05a99-2fc5-4870-a9d6-bccc952c7941} + + + {f5216668-e437-405a-8173-76516ff92e2b} + + + {35479b58-5124-40d5-80ff-90a664723f4e} + + + {59c95c1c-32d1-4264-ae14-4ab7b401c7ca} + + + {e8e524a5-d5ad-4ab8-903d-3b63152654c5} + + + {9f526871-5507-4700-b8d2-89302cecba8c} + + + {99c33ea8-8190-4440-9dc8-0c52fc4a6ee6} + + + {98fcbd8b-b279-45db-aede-fbb752275716} + + + {065cc1cd-a7b9-4073-a10c-e72c1d4019a7} + + + {c291d0f9-0e77-4639-a339-b20f1ebc107a} + + + {bd042ee0-2586-412b-9307-d8adfb09aefe} + + + {57e16b61-e11c-4971-bbe0-9f24eca4cf03} + + + {65ff9757-304a-4e14-9398-ebd3c06df99f} + + + {351d998a-b239-4b6d-b413-94d75131df19} + + + {0aab477c-db25-4299-8948-3bda4732f00e} + + + + + Application\Header Files + + + Application\Header Files + + + Application\Header Files + + + Application\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Windows\Header Files + + + Windows\Header Files + + + Windows\Header Files + + + Util\Header Files + + + Timer\Header Files + + + Timer\Header Files + + + Timer\Header Files + + + + + Application\Source Files + + + Application\Source Files + + + Application\Source Files + + + Application\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Windows\Source Files + + + Windows\Source Files + + + Windows\Source Files + + + Timer\Source Files + + + Timer\Source Files + + + \ No newline at end of file diff --git a/Util/Util_vs100.vcxproj.user b/Util/Util_vs100.vcxproj.user new file mode 100644 index 000000000..ace9a86ac --- /dev/null +++ b/Util/Util_vs100.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Util/Util_x64_vs100.sln b/Util/Util_x64_vs100.sln new file mode 100644 index 000000000..8a40d5397 --- /dev/null +++ b/Util/Util_x64_vs100.sln @@ -0,0 +1,60 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Util", "Util_x64_vs100.vcxproj", "{6FF56CDB-787A-4714-A28C-919003F9FA6C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_x64_vs100.vcxproj", "{E40E738C-447B-40F4-A878-EBA9A2459270}" + ProjectSection(ProjectDependencies) = postProject + {6FF56CDB-787A-4714-A28C-919003F9FA6C} = {6FF56CDB-787A-4714-A28C-919003F9FA6C} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_shared|x64.Build.0 = debug_shared|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_shared|x64.ActiveCfg = release_shared|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_shared|x64.Build.0 = release_shared|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_shared|x64.Deploy.0 = release_shared|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_md|x64.Build.0 = release_static_md|x64 + {6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static_md|x64.Deploy.0 = release_static_md|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_shared|x64.Build.0 = debug_shared|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_shared|x64.ActiveCfg = release_shared|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_shared|x64.Build.0 = release_shared|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_shared|x64.Deploy.0 = release_shared|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_md|x64.Build.0 = release_static_md|x64 + {E40E738C-447B-40F4-A878-EBA9A2459270}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Util/Util_x64_vs100.vcxproj b/Util/Util_x64_vs100.vcxproj new file mode 100644 index 000000000..a5798e923 --- /dev/null +++ b/Util/Util_x64_vs100.vcxproj @@ -0,0 +1,333 @@ + + + + + debug_shared + x64 + + + debug_static_md + x64 + + + debug_static_mt + x64 + + + release_shared + x64 + + + release_static_md + x64 + + + release_static_mt + x64 + + + + Util + {6FF56CDB-787A-4714-A28C-919003F9FA6C} + Util + Win32Proj + + + + StaticLibrary + MultiByte + + + StaticLibrary + MultiByte + + + StaticLibrary + MultiByte + + + StaticLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + ..\bin64\ + obj64\$(Configuration)\ + true + ..\bin64\ + obj64\$(Configuration)\ + false + ..\lib64\ + obj64\$(Configuration)\ + ..\lib64\ + obj64\$(Configuration)\ + ..\lib64\ + obj64\$(Configuration)\ + ..\lib64\ + obj64\$(Configuration)\ + PocoUtil64d + PocoUtilmdd + PocoUtilmtd + PocoUtil64 + PocoUtilmd + PocoUtilmt + + + + Disabled + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;Util_EXPORTS;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + %(AdditionalDependencies) + ..\bin64\PocoUtil64d.dll + true + true + ..\bin64\PocoUtil64d.pdb + ..\lib64;%(AdditionalLibraryDirectories) + Console + ..\lib64\PocoUtild.lib + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;Util_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + %(AdditionalDependencies) + ..\bin64\PocoUtil64.dll + true + false + ..\lib64;%(AdditionalLibraryDirectories) + Console + true + true + ..\lib64\PocoUtil.lib + MachineX64 + + + + + Disabled + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + ..\lib64\PocoUtilmtd.pdb + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + ..\lib64\PocoUtilmtd.lib + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + ..\lib64\PocoUtilmt.lib + + + + + Disabled + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + ..\lib64\PocoUtilmdd.pdb + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + ..\lib64\PocoUtilmdd.lib + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + ..\lib64\PocoUtilmd.lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Util/Util_x64_vs100.vcxproj.filters b/Util/Util_x64_vs100.vcxproj.filters new file mode 100644 index 000000000..c3575e433 --- /dev/null +++ b/Util/Util_x64_vs100.vcxproj.filters @@ -0,0 +1,243 @@ + + + + + {4b1ae9ef-1937-4b46-9f96-2e680732f8e7} + + + {10f72031-30dc-4d3e-8e95-0d89612a7597} + + + {24db6433-79cb-4dd7-be53-b4d8aeb81625} + + + {87fead74-6fcc-41a8-89f8-d47c9039c018} + + + {e2713bf4-89fd-442b-85c5-a43235aff8dc} + + + {842b8021-15a5-4d42-9c35-8ef63597dfc5} + + + {d8ae43e4-a6fd-4a35-8d6f-d7c7cf919504} + + + {79618ac5-b0d3-46ea-9fb1-ba6e7277bfbc} + + + {63fb0221-97a3-459a-9749-ae2e241652b2} + + + {a0b24249-ef36-4d7f-89f1-173834d41c04} + + + {b6b42389-24c9-43cb-be8b-48d81133de9e} + + + {bab0b542-c36a-4342-b29e-ca1b252fcdad} + + + {fbecdba3-e98d-4593-926e-7b6e2fc652bb} + + + {1363bf91-a15c-482e-bebb-19421b0d6125} + + + {957c8e7c-6f31-4ea6-9004-0d0b1b81bee8} + + + {f60b93b6-662c-49d6-8d9d-f3658d226a66} + + + {bc802df3-5da3-4228-9430-dc3a4a2a1487} + + + {12fe7d5c-dfac-40e2-8832-c9f3af7f1b2a} + + + + + Application\Header Files + + + Application\Header Files + + + Application\Header Files + + + Application\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Windows\Header Files + + + Windows\Header Files + + + Windows\Header Files + + + Util\Header Files + + + Timer\Header Files + + + Timer\Header Files + + + Timer\Header Files + + + + + Application\Source Files + + + Application\Source Files + + + Application\Source Files + + + Application\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Windows\Source Files + + + Windows\Source Files + + + Windows\Source Files + + + Timer\Source Files + + + Timer\Source Files + + + \ No newline at end of file diff --git a/Util/Util_x64_vs100.vcxproj.user b/Util/Util_x64_vs100.vcxproj.user new file mode 100644 index 000000000..ace9a86ac --- /dev/null +++ b/Util/Util_x64_vs100.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Util/include/Poco/Util/AbstractConfiguration.h b/Util/include/Poco/Util/AbstractConfiguration.h index de1aa75a1..b0f6cc9f4 100644 --- a/Util/include/Poco/Util/AbstractConfiguration.h +++ b/Util/include/Poco/Util/AbstractConfiguration.h @@ -43,7 +43,9 @@ #include "Poco/Util/Util.h" #include "Poco/Mutex.h" #include "Poco/RefCountedObject.h" +#include "Poco/BasicEvent.h" #include +#include namespace Poco { @@ -67,6 +69,62 @@ class Util_API AbstractConfiguration: public Poco::RefCountedObject { public: typedef std::vector Keys; + + class KeyValue + /// A key-value pair, used as event argument. + { + public: + KeyValue(const std::string& key, std::string& value): + _key(key), + _value(value) + { + } + + const std::string& key() const + { + return _key; + } + + const std::string& value() const + { + return _value; + } + + std::string& value() + { + return _value; + } + + private: + const std::string& _key; + std::string& _value; + }; + + Poco::BasicEvent propertyChanging; + /// Fired before a property value is changed or + /// a new property is created. + /// + /// Can be used to check or fix a property value, + /// or to cancel the change by throwing an exception. + /// + /// The event delegate can use one of the get...() functions + /// to obtain the current property value. + + Poco::BasicEvent propertyChanged; + /// Fired after a property value has been changed + /// or a property has been created. + + Poco::BasicEvent propertyRemoving; + /// Fired before a property is removed by a + /// call to remove(). + /// + /// Note: This will even be fired if the key + /// does not exist and the remove operation will + /// fail with an exception. + + Poco::BasicEvent propertyRemoved; + /// Fired after a property has been removed by + /// a call to remove(). AbstractConfiguration(); /// Creates the AbstractConfiguration. @@ -76,6 +134,12 @@ public: bool hasOption(const std::string& key) const; /// Returns true iff the property with the given key exists. + /// + /// Same as hasProperty(). + + bool has(const std::string& key) const; + /// Returns true iff the property with the given key exists. + /// /// Same as hasProperty(). std::string getString(const std::string& key) const; @@ -135,15 +199,15 @@ public: /// are expanded. bool getBool(const std::string& key) const; - /// Returns the double value of the property with the given name. + /// Returns the boolean value of the property with the given name. /// Throws a NotFoundException if the key does not exist. /// Throws a SyntaxException if the property can not be converted - /// to a double. + /// to a boolean. /// If the value contains references to other properties (${}), these /// are expanded. bool getBool(const std::string& key, bool defaultValue) const; - /// If a property with the given key exists, returns the property's bool value, + /// If a property with the given key exists, returns the property's boolean value, /// otherwise returns the given default value. /// Throws a SyntaxException if the property can not be converted /// to a boolean. @@ -190,6 +254,11 @@ public: /// /// If a circular property reference is detected, a /// CircularReferenceException will be thrown. + + void remove(const std::string& key); + /// Removes the property with the given key. + /// + /// Does nothing if the key does not exist. protected: virtual bool getRaw(const std::string& key, std::string& value) const = 0; @@ -207,9 +276,18 @@ protected: virtual void enumerate(const std::string& key, Keys& range) const = 0; /// Returns in range the names of all subkeys under the given key. /// If an empty key is passed, all root level keys are returned. + + virtual void removeRaw(const std::string& key); + /// Removes the property with the given key. + /// + /// Does nothing if the key does not exist. + /// + /// Should be overridden by subclasses; the default + /// implementation throws a Poco::NotImplementedException. static int parseInt(const std::string& value); static bool parseBool(const std::string& value); + void setRawWithEvent(const std::string& key, std::string value); virtual ~AbstractConfiguration(); diff --git a/Util/include/Poco/Util/Application.h b/Util/include/Poco/Util/Application.h index 17a6812d0..d6e2bc9a9 100644 --- a/Util/include/Poco/Util/Application.h +++ b/Util/include/Poco/Util/Application.h @@ -1,7 +1,7 @@ // // Application.h // -// $Id: //poco/Main/Util/include/Poco/Util/Application.h#17 $ +// $Id: //poco/1.4/Util/include/Poco/Util/Application.h#2 $ // // Library: Util // Package: Application @@ -50,6 +50,9 @@ #include "Poco/Timestamp.h" #include "Poco/Timespan.h" #include "Poco/AutoPtr.h" +#if defined(POCO_VXWORKS) +#include +#endif #include #include @@ -145,21 +148,33 @@ public: /// is okay. void init(int argc, char* argv[]); - /// Initializes the application and all registered subsystems, - /// using the given command line arguments. + /// Processes the application's command line arguments + /// and sets the application's properties (e.g., + /// "application.path", "application.name", etc.). + /// + /// Note that as of release 1.3.7, init() no longer + /// calls initialize(). This is now called from run(). #if defined(POCO_WIN32_UTF8) && !defined(POCO_NO_WSTRING) void init(int argc, wchar_t* argv[]); - /// Initializes the application and all registered subsystems, - /// using the given command line arguments. + /// Processes the application's command line arguments + /// and sets the application's properties (e.g., + /// "application.path", "application.name", etc.). + /// + /// Note that as of release 1.3.7, init() no longer + /// calls initialize(). This is now called from run(). /// /// This Windows-specific version of init is used for passing /// Unicode command line arguments from wmain(). #endif void init(const std::vector& args); - /// Initializes the application and all registered subsystems, - /// using the given command line arguments. + /// Processes the application's command line arguments + /// and sets the application's properties (e.g., + /// "application.path", "application.name", etc.). + /// + /// Note that as of release 1.3.7, init() no longer + /// calls initialize(). This is now called from run(). bool initialized() const; /// Returns true iff the application is in initialized state @@ -195,13 +210,13 @@ public: /// Then loadConfiguration() will automatically find a configuration file /// named "SampleApp.properties" if it exists and if "SampleAppd.properties" /// cannot be found. - /// - /// Returns the number of configuration files loaded, which may be zero. - /// - /// This method must not be called before initialize(argc, argv) - /// has been called. + /// + /// Returns the number of configuration files loaded, which may be zero. + /// + /// This method must not be called before init(argc, argv) + /// has been called. - void loadConfiguration(const std::string& path, int priority = PRIO_DEFAULT); + void loadConfiguration(const std::string& path, int priority = PRIO_DEFAULT); /// Loads configuration information from the file specified by /// the given path. The file type is determined by the file /// extension. The following extensions are supported: @@ -210,13 +225,12 @@ public: /// - .xml - XML file (XMLConfiguration) /// /// Extensions are not case sensitive. - /// - /// The configuration will be added to the application's - /// LayeredConfiguration with the given priority. - /// + /// + /// The configuration will be added to the application's + /// LayeredConfiguration with the given priority. - template C& getSubsystem() const; - /// Returns a reference to the subsystem of the class + template C& getSubsystem() const; + /// Returns a reference to the subsystem of the class /// given as template argument. /// /// Throws a NotFoundException if such a subsystem has @@ -225,6 +239,12 @@ public: virtual int run(); /// Runs the application by performing additional initializations /// and calling the main() method. + /// + /// First calls initialize(), then calls main(), and + /// finally calls uninitialize(). The latter will be called + /// even if main() throws an exception. If initialize() throws + /// an exception, main() will not be called and the exception + /// will be propagated to the caller. std::string commandName() const; /// Returns the command name used to invoke the application. @@ -365,12 +385,16 @@ private: OptionSet _options; bool _unixOptions; Poco::Logger* _pLogger; - Poco::Timestamp _startTime; - bool _stopOptionsProcessing; + Poco::Timestamp _startTime; + bool _stopOptionsProcessing; - static Application* _pInstance; - - friend class LoggingSubsystem; +#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_VXWORKS) + std::string _workingDirAtLaunch; +#endif + + static Application* _pInstance; + + friend class LoggingSubsystem; Application(const Application&); Application& operator = (const Application&); @@ -446,9 +470,9 @@ inline Poco::Timespan Application::uptime() const // Macro to implement main() // #if defined(_WIN32) && defined(POCO_WIN32_UTF8) && !defined(POCO_NO_WSTRING) && !defined(MINGW32) - #define POCO_APP_MAIN(App) \ - int wmain(int argc, wchar_t** argv) \ - { \ + #define POCO_APP_MAIN(App) \ + int wmain(int argc, wchar_t** argv) \ + { \ Poco::AutoPtr pApp = new App; \ try \ { \ @@ -461,6 +485,33 @@ inline Poco::Timespan Application::uptime() const } \ return pApp->run(); \ } +#elif defined(POCO_VXWORKS) + #define POCO_APP_MAIN(App) \ + int pocoAppMain(const char* appName, ...) \ + { \ + std::vector args; \ + args.push_back(std::string(appName)); \ + va_list vargs; \ + va_start(vargs, appName); \ + const char* arg = va_arg(vargs, const char*); \ + while (arg) \ + { \ + args.push_back(std::string(arg)); \ + arg = va_arg(vargs, const char*); \ + } \ + va_end(vargs); \ + Poco::AutoPtr pApp = new App; \ + try \ + { \ + pApp->init(args); \ + } \ + catch (Poco::Exception& exc) \ + { \ + pApp->logger().log(exc); \ + return Poco::Util::Application::EXIT_CONFIG;\ + } \ + return pApp->run(); \ + } #else #define POCO_APP_MAIN(App) \ int main(int argc, char** argv) \ diff --git a/Util/include/Poco/Util/ConfigurationMapper.h b/Util/include/Poco/Util/ConfigurationMapper.h index 9dedd97ee..4c1aa50f3 100644 --- a/Util/include/Poco/Util/ConfigurationMapper.h +++ b/Util/include/Poco/Util/ConfigurationMapper.h @@ -94,6 +94,7 @@ protected: bool getRaw(const std::string& key, std::string& value) const; void setRaw(const std::string& key, const std::string& value); void enumerate(const std::string& key, Keys& range) const; + void removeRaw(const std::string& key); std::string translateKey(const std::string& key) const; diff --git a/Util/include/Poco/Util/ConfigurationView.h b/Util/include/Poco/Util/ConfigurationView.h index 603edff68..eb0053472 100644 --- a/Util/include/Poco/Util/ConfigurationView.h +++ b/Util/include/Poco/Util/ConfigurationView.h @@ -83,6 +83,7 @@ protected: bool getRaw(const std::string& key, std::string& value) const; void setRaw(const std::string& key, const std::string& value); void enumerate(const std::string& key, Keys& range) const; + void removeRaw(const std::string& key); std::string translateKey(const std::string& key) const; diff --git a/Util/include/Poco/Util/FilesystemConfiguration.h b/Util/include/Poco/Util/FilesystemConfiguration.h index d149e33df..7a7fb71a9 100644 --- a/Util/include/Poco/Util/FilesystemConfiguration.h +++ b/Util/include/Poco/Util/FilesystemConfiguration.h @@ -100,6 +100,7 @@ protected: bool getRaw(const std::string& key, std::string& value) const; void setRaw(const std::string& key, const std::string& value); void enumerate(const std::string& key, Keys& range) const; + void removeRaw(const std::string& key); Poco::Path keyToPath(const std::string& key) const; ~FilesystemConfiguration(); diff --git a/Util/include/Poco/Util/IniFileConfiguration.h b/Util/include/Poco/Util/IniFileConfiguration.h index e83862f76..22537c7a1 100644 --- a/Util/include/Poco/Util/IniFileConfiguration.h +++ b/Util/include/Poco/Util/IniFileConfiguration.h @@ -93,6 +93,7 @@ protected: bool getRaw(const std::string& key, std::string& value) const; void setRaw(const std::string& key, const std::string& value); void enumerate(const std::string& key, Keys& range) const; + void removeRaw(const std::string& key); ~IniFileConfiguration(); private: diff --git a/Util/include/Poco/Util/LayeredConfiguration.h b/Util/include/Poco/Util/LayeredConfiguration.h index f92714d43..3b89abc81 100644 --- a/Util/include/Poco/Util/LayeredConfiguration.h +++ b/Util/include/Poco/Util/LayeredConfiguration.h @@ -127,6 +127,12 @@ public: /// If shared is true, the LayeredConfiguration takes ownership /// of the given configuration. + void removeConfiguration(AbstractConfiguration* pConfig); + /// Removes the given configuration from the LayeredConfiguration. + /// + /// Does nothing if the given configuration is not part of the + /// LayeredConfiguration. + protected: typedef Poco::AutoPtr ConfigPtr; @@ -140,6 +146,7 @@ protected: bool getRaw(const std::string& key, std::string& value) const; void setRaw(const std::string& key, const std::string& value); void enumerate(const std::string& key, Keys& range) const; + void removeRaw(const std::string& key); int lowest() const; int highest() const; diff --git a/Util/include/Poco/Util/MapConfiguration.h b/Util/include/Poco/Util/MapConfiguration.h index d8dae8881..168288b28 100644 --- a/Util/include/Poco/Util/MapConfiguration.h +++ b/Util/include/Poco/Util/MapConfiguration.h @@ -66,6 +66,7 @@ protected: bool getRaw(const std::string& key, std::string& value) const; void setRaw(const std::string& key, const std::string& value); void enumerate(const std::string& key, Keys& range) const; + void removeRaw(const std::string& key); ~MapConfiguration(); iterator begin() const; diff --git a/Util/include/Poco/Util/ServerApplication.h b/Util/include/Poco/Util/ServerApplication.h index 63250d18d..302e740d2 100644 --- a/Util/include/Poco/Util/ServerApplication.h +++ b/Util/include/Poco/Util/ServerApplication.h @@ -43,6 +43,9 @@ #include "Poco/Util/Util.h" #include "Poco/Util/Application.h" #include "Poco/Event.h" +#if defined(POCO_OS_FAMILY_WINDOWS) +#include "Poco/NamedEvent.h" +#endif namespace Poco { @@ -64,6 +67,12 @@ class Util_API ServerApplication: public Application /// initialize() method. /// - At the end of the main() method, waitForTerminationRequest() /// should be called. + /// - New threads must only be created in initialize() or main() or + /// methods called from there, but not in the application class' + /// constructor or in the constructor of instance variables. + /// The reason for this is that fork() will be called in order to + /// create the daemon process, and threads created prior to calling + /// fork() won't be taken over to the daemon process. /// - The main(argc, argv) function must look as follows: /// /// int main(int argc, char** argv) @@ -85,11 +94,14 @@ class Util_API ServerApplication: public Application /// can be started from the command line, with the /registerService option /// specified. This causes the application to register itself with the /// SCM, and then exit. Similarly, an application registered as a service can - /// be unregistered, by specifying the /unregisterService option. - /// The file name of the application executable (excluding the .exe suffix) - /// is used as the service name. Additionally, a more user-friendly name can be - /// specified, using the /displayName option (e.g., /displayName="Demo Service"). - /// + /// be unregistered, by specifying the /unregisterService option. + /// The file name of the application executable (excluding the .exe suffix) + /// is used as the service name. Additionally, a more user-friendly name can be + /// specified, using the /displayName option (e.g., /displayName="Demo Service") + /// and a service description can be added with the /description option. + /// The startup mode (automatic or manual) for the service can be specified + /// with the /startup option. + /// /// An application can determine whether it is running as a service by checking /// for the "application.runAsService" configuration property. /// @@ -149,6 +161,10 @@ public: int run(int argc, char** argv); /// Runs the application by performing additional initializations /// and calling the main() method. + + int run(const std::vector& args); + /// Runs the application by performing additional initializations + /// and calling the main() method. #if defined(POCO_WIN32_UTF8) && !defined(POCO_NO_WSTRING) int run(int argc, wchar_t** argv); @@ -159,18 +175,29 @@ public: /// Unicode command line arguments from wmain(). #endif + static void terminate(); + /// Sends a friendly termination request to the application. + /// If the application's main thread is waiting in + /// waitForTerminationRequest(), this method will return + /// and the application can shut down. + protected: int run(); void waitForTerminationRequest(); +#if !defined(_WIN32_WCE) void defineOptions(OptionSet& options); - void handleOption(const std::string& name, const std::string& value); - static void terminate(); +#endif private: -#if defined(POCO_OS_FAMILY_UNIX) +#if defined(POCO_VXWORKS) + static Poco::Event _terminate; +#elif defined(POCO_OS_FAMILY_UNIX) + void handleDaemon(const std::string& name, const std::string& value); + void handlePidFile(const std::string& name, const std::string& value); bool isDaemon(int argc, char** argv); void beDaemon(); #elif defined(POCO_OS_FAMILY_WINDOWS) +#if !defined(_WIN32_WCE) enum Action { SRV_RUN, @@ -190,13 +217,22 @@ private: void beService(); void registerService(); void unregisterService(); - - Action _action; - std::string _displayName; + void handleRegisterService(const std::string& name, const std::string& value); + void handleUnregisterService(const std::string& name, const std::string& value); + void handleDisplayName(const std::string& name, const std::string& value); + void handleDescription(const std::string& name, const std::string& value); + void handleStartup(const std::string& name, const std::string& value); + + Action _action; + std::string _displayName; + std::string _description; + std::string _startup; - static Poco::Event _terminated; + static Poco::Event _terminated; static SERVICE_STATUS _serviceStatus; static SERVICE_STATUS_HANDLE _serviceStatusHandle; +#endif // _WIN32_WCE + static Poco::NamedEvent _terminate; #endif }; @@ -207,13 +243,31 @@ private: // // Macro to implement main() // -#if defined(_WIN32) && defined(POCO_WIN32_UTF8) && !defined(MINGW32) +#if defined(_WIN32) && defined(POCO_WIN32_UTF8) #define POCO_SERVER_MAIN(App) \ int wmain(int argc, wchar_t** argv) \ { \ App app; \ return app.run(argc, argv); \ } +#elif defined(POCO_VXWORKS) + #define POCO_SERVER_MAIN(App) \ + int pocoSrvMain(const char* appName, ...) \ + { \ + std::vector args; \ + args.push_back(std::string(appName)); \ + va_list vargs; \ + va_start(vargs, appName); \ + const char* arg = va_arg(vargs, const char*); \ + while (arg) \ + { \ + args.push_back(std::string(arg)); \ + arg = va_arg(vargs, const char*); \ + } \ + va_end(vargs); \ + App app; \ + return app.run(args); \ + } #else #define POCO_SERVER_MAIN(App) \ int main(int argc, char** argv) \ diff --git a/Util/include/Poco/Util/SystemConfiguration.h b/Util/include/Poco/Util/SystemConfiguration.h index b631a1591..82603520a 100644 --- a/Util/include/Poco/Util/SystemConfiguration.h +++ b/Util/include/Poco/Util/SystemConfiguration.h @@ -57,6 +57,8 @@ class Util_API SystemConfiguration: public AbstractConfiguration /// - system.osVersion: the operating system version /// - system.osArchitecture: the operating system architecture /// - system.nodeName: the node (or host) name + /// - system.nodeId: system ID, based on the Ethernet address (format "xxxxxxxxxxxx") + /// of the first Ethernet adapter found on the system. /// - system.currentDir: the current working directory /// - system.homeDir: the user's home directory /// - system.tempDir: the system's temporary directory @@ -69,6 +71,9 @@ class Util_API SystemConfiguration: public AbstractConfiguration /// /// Enumerating environment variables is not supported. /// An attempt to call keys("system.env") will return an empty range. + /// + /// Removing key is not supported. An attempt to remove a key results + /// in a NotImplementedException being thrown. { public: SystemConfiguration(); @@ -78,6 +83,7 @@ protected: bool getRaw(const std::string& key, std::string& value) const; void setRaw(const std::string& key, const std::string& value); void enumerate(const std::string& key, Keys& range) const; + void removeRaw(const std::string& key); ~SystemConfiguration(); private: @@ -87,11 +93,14 @@ private: static const std::string OSVERSION; static const std::string OSARCHITECTURE; static const std::string NODENAME; + static const std::string NODEID; static const std::string CURRENTDIR; static const std::string HOMEDIR; static const std::string TEMPDIR; static const std::string DATETIME; +#if !defined(POCO_VXWORKS) static const std::string PID; +#endif static const std::string ENV; }; diff --git a/Util/include/Poco/Util/Timer.h b/Util/include/Poco/Util/Timer.h index 06f7ab62b..9e9640433 100644 --- a/Util/include/Poco/Util/Timer.h +++ b/Util/include/Poco/Util/Timer.h @@ -1,140 +1,146 @@ -// -// Timer.h -// -// $Id: //poco/Main/Util/include/Poco/Util/Timer.h#1 $ -// -// Library: Util -// Package: Timer -// Module: Timer -// -// Definition of the Timer class. -// -// Copyright (c) 2009, 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 Util_Timer_INCLUDED -#define Util_Timer_INCLUDED - - -#include "Poco/Util/Util.h" -#include "Poco/Util/TimerTask.h" -#include "Poco/TimedNotificationQueue.h" -#include "Poco/Thread.h" -#include "Poco/Runnable.h" - - -namespace Poco { -namespace Util { - - -class Util_API Timer: protected Poco::Runnable - /// A Timer allows to schedule tasks (TimerTask objects) for future execution - /// in a background thread. Tasks may be scheduled for one-time execution, - /// or for repeated execution at regular intervals. - /// - /// The Timer object creates a thread that executes all scheduled tasks - /// sequentially. Therefore, tasks should complete their work as quickly - /// as possible, otherwise subsequent tasks may be delayed. - /// - /// Timer is save for multithreaded use - multiple threads can schedule - /// new tasks simultaneously. - /// - /// Acknowledgement: The interface of this class has been inspired by - /// the java.util.Timer class from Java 1.3. -{ -public: - Timer(); - /// Creates the Timer. - - explicit Timer(Poco::Thread::Priority priority); - /// Creates the Timer, using a timer thread with - /// the given priority. - - ~Timer(); - /// Destroys the Timer, cancelling all pending tasks. - - void cancel(); - /// Cancels all pending tasks. - /// - /// If a task is currently running, it is allowed to finish. - - void schedule(TimerTask::Ptr pTask, Poco::Timestamp time); - /// Schedules a task for execution at the specified time. - /// - /// If the time lies in the past, the task is executed - /// immediately. - - void schedule(TimerTask::Ptr pTask, long delay, long interval); - /// Schedules a task for periodic execution. - /// - /// The task is first executed after the given delay. - /// Subsequently, the task is executed periodically with - /// the given interval in milliseconds between invocations. - - void schedule(TimerTask::Ptr pTask, Poco::Timestamp time, long interval); - /// Schedules a task for periodic execution. - /// - /// The task is first executed at the given time. - /// Subsequently, the task is executed periodically with - /// the given interval in milliseconds between invocations. - - void scheduleAtFixedRate(TimerTask::Ptr pTask, long delay, long interval); - /// Schedules a task for periodic execution at a fixed rate. - /// - /// The task is first executed after the given delay. - /// Subsequently, the task is executed periodically - /// every number of milliseconds specified by interval. - /// - /// If task execution takes longer than the given interval, - /// further executions are delayed. - - void scheduleAtFixedRate(TimerTask::Ptr pTask, Poco::Timestamp time, long interval); - /// Schedules a task for periodic execution at a fixed rate. - /// - /// The task is first executed at the given time. - /// Subsequently, the task is executed periodically - /// every number of milliseconds specified by interval. - /// - /// If task execution takes longer than the given interval, - /// further executions are delayed. - -protected: - void run(); - -private: - Timer(const Timer&); - Timer& operator = (const Timer&); - - Poco::TimedNotificationQueue _queue; - Poco::Thread _thread; -}; - - -} } // namespace Poco::Util - - -#endif // Util_Timer_INCLUDED +// +// Timer.h +// +// $Id: //poco/1.4/Util/include/Poco/Util/Timer.h#1 $ +// +// Library: Util +// Package: Timer +// Module: Timer +// +// Definition of the Timer class. +// +// Copyright (c) 2009, 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 Util_Timer_INCLUDED +#define Util_Timer_INCLUDED + + +#include "Poco/Util/Util.h" +#include "Poco/Util/TimerTask.h" +#include "Poco/TimedNotificationQueue.h" +#include "Poco/Thread.h" +#include "Poco/Runnable.h" + + +namespace Poco { +namespace Util { + + +class Util_API Timer: protected Poco::Runnable + /// A Timer allows to schedule tasks (TimerTask objects) for future execution + /// in a background thread. Tasks may be scheduled for one-time execution, + /// or for repeated execution at regular intervals. + /// + /// The Timer object creates a thread that executes all scheduled tasks + /// sequentially. Therefore, tasks should complete their work as quickly + /// as possible, otherwise subsequent tasks may be delayed. + /// + /// Timer is save for multithreaded use - multiple threads can schedule + /// new tasks simultaneously. + /// + /// Acknowledgement: The interface of this class has been inspired by + /// the java.util.Timer class from Java 1.3. +{ +public: + Timer(); + /// Creates the Timer. + + explicit Timer(Poco::Thread::Priority priority); + /// Creates the Timer, using a timer thread with + /// the given priority. + + ~Timer(); + /// Destroys the Timer, cancelling all pending tasks. + + void cancel(bool wait = false); + /// Cancels all pending tasks. + /// + /// If a task is currently running, it is allowed to finish. + /// + /// Task cancellation is done asynchronously. If wait + /// is false, cancel() returns immediately and the + /// task queue will be purged as soon as the currently + /// running task finishes. If wait is true, waits + /// until the queue has been purged. + + void schedule(TimerTask::Ptr pTask, Poco::Timestamp time); + /// Schedules a task for execution at the specified time. + /// + /// If the time lies in the past, the task is executed + /// immediately. + + void schedule(TimerTask::Ptr pTask, long delay, long interval); + /// Schedules a task for periodic execution. + /// + /// The task is first executed after the given delay. + /// Subsequently, the task is executed periodically with + /// the given interval in milliseconds between invocations. + + void schedule(TimerTask::Ptr pTask, Poco::Timestamp time, long interval); + /// Schedules a task for periodic execution. + /// + /// The task is first executed at the given time. + /// Subsequently, the task is executed periodically with + /// the given interval in milliseconds between invocations. + + void scheduleAtFixedRate(TimerTask::Ptr pTask, long delay, long interval); + /// Schedules a task for periodic execution at a fixed rate. + /// + /// The task is first executed after the given delay. + /// Subsequently, the task is executed periodically + /// every number of milliseconds specified by interval. + /// + /// If task execution takes longer than the given interval, + /// further executions are delayed. + + void scheduleAtFixedRate(TimerTask::Ptr pTask, Poco::Timestamp time, long interval); + /// Schedules a task for periodic execution at a fixed rate. + /// + /// The task is first executed at the given time. + /// Subsequently, the task is executed periodically + /// every number of milliseconds specified by interval. + /// + /// If task execution takes longer than the given interval, + /// further executions are delayed. + +protected: + void run(); + +private: + Timer(const Timer&); + Timer& operator = (const Timer&); + + Poco::TimedNotificationQueue _queue; + Poco::Thread _thread; +}; + + +} } // namespace Poco::Util + + +#endif // Util_Timer_INCLUDED diff --git a/Util/include/Poco/Util/TimerTask.h b/Util/include/Poco/Util/TimerTask.h index 3cf94eddb..529afe302 100644 --- a/Util/include/Poco/Util/TimerTask.h +++ b/Util/include/Poco/Util/TimerTask.h @@ -1,117 +1,117 @@ -// -// TimerTask.h -// -// $Id: //poco/Main/Util/include/Poco/Util/TimerTask.h#1 $ -// -// Library: Util -// Package: Timer -// Module: TimerTask -// -// Definition of the TimerTask class. -// -// Copyright (c) 2009, 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 Util_TimerTask_INCLUDED -#define Util_TimerTask_INCLUDED - - -#include "Poco/Util/Util.h" -#include "Poco/Runnable.h" -#include "Poco/RefCountedObject.h" -#include "Poco/AutoPtr.h" -#include "Poco/Timestamp.h" - - -namespace Poco { -namespace Util { - - -class Util_API TimerTask: public Poco::RefCountedObject, public Poco::Runnable - /// A task that can be scheduled for one-time or - /// repeated execution by a Timer. - /// - /// This is an abstract class. Subclasses must override the run() member - /// function to implement the actual task logic. -{ -public: - typedef Poco::AutoPtr Ptr; - - TimerTask(); - /// Creates the TimerTask. - - void cancel(); - /// Cancels the execution of the timer. - /// If the task has been scheduled for one-time execution and has - /// not yet run, or has not yet been scheduled, it will never run. - /// If the task has been scheduled for repeated execution, it will never - /// run again. If the task is running when this call occurs, the task - /// will run to completion, but will never run again. - - bool isCancelled() const; - /// Returns true iff the TimerTask has been cancelled by a call - /// to cancel(). - - Poco::Timestamp lastExecution() const; - /// Returns the time of the last execution of the timer task. - /// - /// Returns 0 if the timer has never been executed. - -protected: - ~TimerTask(); - /// Destroys the TimerTask. - -private: - TimerTask(const TimerTask&); - TimerTask& operator = (const TimerTask&); - - Poco::Timestamp _lastExecution; - bool _isCancelled; - - friend class TaskNotification; -}; - - -// -// inlines -// -inline bool TimerTask::isCancelled() const -{ - return _isCancelled; -} - - -inline Poco::Timestamp TimerTask::lastExecution() const -{ - return _lastExecution; -} - - -} } // namespace Poco::Util - - -#endif // Util_TimerTask_INCLUDED +// +// TimerTask.h +// +// $Id: //poco/1.4/Util/include/Poco/Util/TimerTask.h#1 $ +// +// Library: Util +// Package: Timer +// Module: TimerTask +// +// Definition of the TimerTask class. +// +// Copyright (c) 2009, 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 Util_TimerTask_INCLUDED +#define Util_TimerTask_INCLUDED + + +#include "Poco/Util/Util.h" +#include "Poco/Runnable.h" +#include "Poco/RefCountedObject.h" +#include "Poco/AutoPtr.h" +#include "Poco/Timestamp.h" + + +namespace Poco { +namespace Util { + + +class Util_API TimerTask: public Poco::RefCountedObject, public Poco::Runnable + /// A task that can be scheduled for one-time or + /// repeated execution by a Timer. + /// + /// This is an abstract class. Subclasses must override the run() member + /// function to implement the actual task logic. +{ +public: + typedef Poco::AutoPtr Ptr; + + TimerTask(); + /// Creates the TimerTask. + + void cancel(); + /// Cancels the execution of the timer. + /// If the task has been scheduled for one-time execution and has + /// not yet run, or has not yet been scheduled, it will never run. + /// If the task has been scheduled for repeated execution, it will never + /// run again. If the task is running when this call occurs, the task + /// will run to completion, but will never run again. + + bool isCancelled() const; + /// Returns true iff the TimerTask has been cancelled by a call + /// to cancel(). + + Poco::Timestamp lastExecution() const; + /// Returns the time of the last execution of the timer task. + /// + /// Returns 0 if the timer has never been executed. + +protected: + ~TimerTask(); + /// Destroys the TimerTask. + +private: + TimerTask(const TimerTask&); + TimerTask& operator = (const TimerTask&); + + Poco::Timestamp _lastExecution; + bool _isCancelled; + + friend class TaskNotification; +}; + + +// +// inlines +// +inline bool TimerTask::isCancelled() const +{ + return _isCancelled; +} + + +inline Poco::Timestamp TimerTask::lastExecution() const +{ + return _lastExecution; +} + + +} } // namespace Poco::Util + + +#endif // Util_TimerTask_INCLUDED diff --git a/Util/include/Poco/Util/TimerTaskAdapter.h b/Util/include/Poco/Util/TimerTaskAdapter.h index 59bd35469..2ddab6138 100644 --- a/Util/include/Poco/Util/TimerTaskAdapter.h +++ b/Util/include/Poco/Util/TimerTaskAdapter.h @@ -1,91 +1,91 @@ -// -// TimerTaskAdapter.h -// -// $Id: //poco/Main/Util/include/Poco/Util/TimerTaskAdapter.h#1 $ -// -// Library: Util -// Package: Timer -// Module: TimerTaskAdapter -// -// Definition of the TimerTaskAdapter class template. -// -// Copyright (c) 2009, 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 Util_TimerTaskAdapter_INCLUDED -#define Util_TimerTaskAdapter_INCLUDED - - -#include "Poco/Util/Util.h" -#include "Poco/Util/TimerTask.h" - - -namespace Poco { -namespace Util { - - -template -class TimerTaskAdapter: public TimerTask - /// This class template simplifies the implementation - /// of TimerTask objects by allowing a member function - /// of an object to be called as task. -{ -public: - typedef void (C::*Callback)(TimerTask&); - - TimerTaskAdapter(C& object, Callback method): _pObject(&object), _method(method) - /// Creates the TimerTaskAdapter, using the given - /// object and its member function as task target. - /// - /// The member function must accept one argument, - /// a reference to a TimerTask object. - { - } - - void run() - { - (_pObject->*_method)(*this); - } - -protected: - ~TimerTaskAdapter() - /// Destroys the TimerTaskAdapter. - { - } - -private: - TimerTaskAdapter(); - - C* _pObject; - Callback _method; -}; - - -} } // namespace Poco::Util - - -#endif // Util_TimerTaskAdapter_INCLUDED +// +// TimerTaskAdapter.h +// +// $Id: //poco/1.4/Util/include/Poco/Util/TimerTaskAdapter.h#1 $ +// +// Library: Util +// Package: Timer +// Module: TimerTaskAdapter +// +// Definition of the TimerTaskAdapter class template. +// +// Copyright (c) 2009, 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 Util_TimerTaskAdapter_INCLUDED +#define Util_TimerTaskAdapter_INCLUDED + + +#include "Poco/Util/Util.h" +#include "Poco/Util/TimerTask.h" + + +namespace Poco { +namespace Util { + + +template +class TimerTaskAdapter: public TimerTask + /// This class template simplifies the implementation + /// of TimerTask objects by allowing a member function + /// of an object to be called as task. +{ +public: + typedef void (C::*Callback)(TimerTask&); + + TimerTaskAdapter(C& object, Callback method): _pObject(&object), _method(method) + /// Creates the TimerTaskAdapter, using the given + /// object and its member function as task target. + /// + /// The member function must accept one argument, + /// a reference to a TimerTask object. + { + } + + void run() + { + (_pObject->*_method)(*this); + } + +protected: + ~TimerTaskAdapter() + /// Destroys the TimerTaskAdapter. + { + } + +private: + TimerTaskAdapter(); + + C* _pObject; + Callback _method; +}; + + +} } // namespace Poco::Util + + +#endif // Util_TimerTaskAdapter_INCLUDED diff --git a/Util/include/Poco/Util/Units.h b/Util/include/Poco/Util/Units.h index cafd536b5..f0e0d51dc 100644 --- a/Util/include/Poco/Util/Units.h +++ b/Util/include/Poco/Util/Units.h @@ -1,1333 +1,1324 @@ -// -// Units.h -// -// $Id: //poco/svn/Util/include/Poco/Util/Units.h#1 $ -// -// Library: Util -// Package: Units -// Module: Units -// -// Basic definitions for the Poco Util library. -// This file must be the first file included by every other Util -// header file. -// -// Copyright (c) 2007-2009, 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. -// -// Adapted for POCO from the following source: -// -// Written by Calum Grant -// Copyright (C) Calum Grant 2007 -// -// Home page: http://calumgrant.net/units -// File location: http://calumgrant.net/units/units.hpp -// -// Copying permitted under the terms of the Boost software license. -// - - -#ifndef Util_Units_INCLUDED -#define Util_Units_INCLUDED - - -#include -#include - - -namespace Poco { -namespace Util { -namespace Units { - - - namespace Internal - { - template struct Convert; - /// Forward - - struct None; - /// Allows construction of no units - - template - struct FixedPower; - /// Forward - } - - - template - struct Compose; - /// Construct a unit equivalent to Unit1*Unit2 - - - template - struct Scale; - /// Constructs a unit equivalent to U*Num/Den - - - template - struct Translate; - /// Constructs a Unit equivalent to U+Num/Den - - - template - struct Power; - /// Constructs a Unit equivalent to U^(Num/Den) - - - typedef Power Unit; - /// A unit which is effectively no units at all. - - - template - class Value - /// A Value with a unit. - /// - V is the type you are storing - /// - U is the units of the Value - { - public: - typedef V ValueType; - typedef U Unit; - - Value(): _rep() - { - } - - explicit Value(const ValueType& v): _rep(v) - { - } - - template - Value(const Value& v): - _rep(Internal::Convert::fn(v.get())) - { - } - - const ValueType& get() const - { - return _rep; - } - - template - Value& operator = (const Value& other) - { - _rep = Value(other).get(); - return *this; - } - - template - Value operator + (const Value& other) const - { - return Value(get() + Value(other).get()); - } - - template - Value& operator += (const Value& other) - { - _rep += Value(other).get(); - return *this; - } - - template - Value& operator -= (const Value& other) - { - _rep -= Value(other).get(); - return *this; - } - - template - Value operator - (const Value& other) const - { - return Value(get() - Value(other).get()); - } - - Value operator - () const - { - return Value(-get()); - } - - template - Value > - operator * (const Value& other) const - { - return Value >(get() * other.get()); - } - - Value operator * (const ValueType& v) const - { - return Value(get() * v); - } - - Value& operator *= (const ValueType& v) - { - _rep *= v; - return *this; - } - - template - Value > > operator / (const Value& other) const - { - return Value > >(get() / other.get()); - } - - Value operator / (const ValueType& v) const - { - return Value(get() / v); - } - - Value& operator /= (const ValueType& v) - { - _rep /= v; - return *this; - } - - template - bool operator == (const Value& other) const - { - return get() == Value(other).get(); - } - - template - bool operator != (const Value& other) const - { - return get() != Value(other).get(); - } - - template - bool operator < (const Value& other) const - { - return get() < Value(other).get(); - } - - template - bool operator <= (const Value& other) const - { - return get() <= Value(other).get(); - } - - template - bool operator > (const Value& other) const - { - return get() > Value(other).get(); - } - - template - bool operator >= (const Value& other) const - { - return get() >= Value(other).get(); - } - - Value& operator ++ () - { - ++_rep; - return *this; - } - - Value operator ++ (int) - { - Value v = *this; - ++_rep; - return v; - } - - Value& operator -- () - { - --_rep; - return *this; - } - - Value operator -- (int) - { - Value v = *this; - --_rep; - return v; - } - - private: - ValueType _rep; - }; - - - template - Value > operator / (const V& a, const Value& b) - { - return Value >(a / b.get()); - } - - - template - Value operator * (const V& a, const Value& b) - { - return Value(a * b.get()); - } - - - template - Value > sqrt(const Value& a) - { - return Value >(std::sqrt(a.get())); - } - - - template - Value > square(const Value& a) - { - return Value >(std::pow(a.get(), 2)); - } - - - template - Value > cube(const Value& a) - { - return Value >(std::pow(a.get(), 3)); - } - - - template - Value > raise(const Value& a) - { - return Value >(Internal::FixedPower::Power(a.get())); - } -} // namespace Units - - -// -// Implementation -// - - -namespace Units -{ - namespace Internal - { - template struct static_assert; - template <> struct static_assert { }; - /// Ensures (at compile-time) that the template argument is true. - - - template - struct Convertible; - /// Forward - - - template - struct ScalingFactor; - /// Forward - - - template - struct Convert3 - /// Converts T1 to T2. - /// Stage 3 - performed after Stage 1 and Stage 2. - /// The reason we perform Convert in stages is so that the compiler - /// can resolve templates in the order we want it to. - { - template - static V fn(const V& v) - /// The default implementation assumes that the two quantities are in compatible - /// Units up to some scaling factor. Find the scaling factor and apply it. - { - return v * ScalingFactor::template fn() / ScalingFactor::template fn(); - } - }; - - - template - struct Convert2 - /// Converts T1 to T2. - /// Template matches the first argument (T1), - /// this is the fall-through to Convert3. - { - template - static V fn(const V& v) - { - return Convert3::fn(v); - } - }; - - - template - struct Convert - /// Converts T1 to T2. - /// If you really want to implement your own conversion routine, - /// specialize this template. - /// The default implementation falls through to Convert2. - { - static_assert::Value> check_convertible; - /// If this fails, then T1 is not Convertible to T2: - - template - static V fn(const V& v) - { - return Convert2::fn(v); - } - }; - - - template - struct Convert - /// Trivial conversion to the same type. - { - template - static const U& fn(const U& u) { return u; } - }; - - - template - struct Convert3 - /// Convert to same type. - { - template - static const U& fn(const U& u) { return u; } - }; - - - template - struct Convert2, U> - /// Convert from a scaled Unit - { - template - static V fn(const V& v) - { - return Convert::fn((v * Den)/Num); - } - }; - - - template - struct Convert3 > - /// Convert to a scaled Unit - { - template - static V fn(const V& v) - { - return (Convert::fn(v) * Num)/ Den; - } - }; - - - template - struct Convert2, U> - /// Convert from a translated Unit - { - template - static V fn(const V& v) - { - return Convert::fn(v - static_cast(Num) / static_cast(Den)); - } - }; - - - template - struct Convert3 > - /// Convert to a translated Unit - { - template - static V fn(const V& v) - { - return Convert::fn(v) + static_cast(Num) / static_cast(Den); - } - }; - - - template - struct CountTerms - /// Count the power to which Unit Term is raised in the Unit List. - /// Returns a rational num/den of the power of term Term in List. - /// The default assumes that Term is not found (num/den=0) - { - static const int num = 0; - static const int den = 1; - }; - - - template - struct CountTerms - { - static const int num = 1; - static const int den = 1; - }; - - - template - struct CountTerms > - /// CountTerms ignores scaling factors - that is taken care of by ScalingFactor. - { - typedef CountTerms result; - static const int num = result::num; - static const int den = result::den; - }; - - - template - struct CountTerms > - /// CountTerms ignores translation. - { - typedef CountTerms result; - static const int num = result::num; - static const int den = result::den; - }; - - - template - struct CountTerms > - /// Addition of fractions. - { - typedef CountTerms result1; - typedef CountTerms result2; - static const int num = - result1::num * result2::den + result1::den * result2::num; - static const int den = - result1::den * result2::den; - }; - - - template - struct CountTerms > - /// Multiplication of fractions. - { - typedef CountTerms result; - static const int num = N * result::num; - static const int den = D * result::den; - }; - - - template - struct CheckTermsEqual - /// Counts the power of the Unit Term in Units T1 and T2. - /// Reports if they are equal, using equality of fractions. - /// Does a depth-first search of the Unit "Term", - /// or counts the terms in the default case. - { - typedef CountTerms count1; - typedef CountTerms count2; - - static const bool Value = - count1::num * count2::den == - count1::den * count2::num; - }; - - - template - struct CheckTermsEqual, T1, T2 > - { - static const bool Value = CheckTermsEqual::Value; - }; - - - template - struct CheckTermsEqual, T1, T2 > - { - static const bool Value = CheckTermsEqual::Value; - }; - - - template - struct CheckTermsEqual, T1, T2 > - { - static const bool Value = CheckTermsEqual::Value; - }; - - - template - struct CheckTermsEqual,T3,T4> - { - static const bool Value = - CheckTermsEqual::Value && - CheckTermsEqual::Value; - }; - - - template - struct Convertible - /// Determines whether two types are Convertible - /// Counts the powers in the LHS and RHS and ensures they are equal. - { - static const bool Value = - CheckTermsEqual::Value && - CheckTermsEqual::Value; - }; - - - template - struct FixedPower - /// A functor that raises a Value to the power Num/Den. - /// The template is specialised for efficiency - /// so that we don't always have to call the std::Power function. - { - template static T Power(const T& t) - { - return std::pow(t, static_cast(Num)/static_cast(Den)); - } - }; - - - template - struct FixedPower - { - template static const T& Power(const T& t) - { - return t; - } - }; - - - template - struct FixedPower - { - template static T Power(const T& t) - { - return t*t; - } - }; - - - template - struct FixedPower - { - template static T Power(const T& t) - { - return t*t*t; - } - }; - - - template - struct FixedPower - { - template static const T& Power(const T& t) - { - T u = t*t; - return u*u; - } - }; - - - template - struct FixedPower - { - template static T Power(const T& t) - { - return 1/t; - } - }; - - - template - struct FixedPower - { - template static T Power(const T& t) - { - return 1/(t*t); - } - }; - - - template - struct FixedPower - { - template static T Power(const T& t) - { - return 1; - } - }; - - - template - struct ScalingFactor - /// Determine the scaling factor of a Unit in relation to its "base" Units. - /// Default is that U is a primitive Unit and is not scaled. - { - template - static T fn() { return 1; } - }; - - - template - struct ScalingFactor< Compose > - { - template - static T fn() - { - return - ScalingFactor::template fn() * - ScalingFactor::template fn(); - } - }; - - - template - struct ScalingFactor< Scale > - { - template - static T fn() - { - return - ScalingFactor::template fn() * - static_cast(N) / static_cast(D); - } - }; - - - template - struct ScalingFactor< Power > - { - template - static T fn() - { - return FixedPower::Power(ScalingFactor::template fn()); - } - }; - - - template - struct ScalingFactor< Translate > - { - template - static T fn() - { - return ScalingFactor::template fn(); - } - }; - } -} - - -/// -/// Display -/// - - -#define UNIT_DISPLAY_NAME(Unit, string) \ - template <> struct OutputUnit { \ - template static void fn(Stream& os) { os << string; } \ - }; - - -#define UNITS_DISPLAY_NAME(Unit, string) \ - namespace Units { UNIT_DISPLAY_NAME(Unit, string) } - - -namespace Units -{ - namespace Internal - { - template - struct OutputUnit2 - /// The default Unit formatting mechanism - { - template - static void fn(Stream &os) { os << "Units"; } - }; - } - - - template - struct OutputUnit - /// Functor to write Unit text to stream - { - template - static void fn(Stream &os) { Internal::OutputUnit2::fn(os); } - }; - - - UNIT_DISPLAY_NAME(Unit, "1"); - - - namespace Internal - { - template - struct OutputUnit2< Compose > - { - template - static void fn(Stream &os) - { - OutputUnit::fn(os); - os << '.'; - OutputUnit::fn(os); - } - }; - - - template - struct OutputUnit2< Power > - { - template - static void fn(Stream &os) - { - if(Num!=Den) os << '('; - OutputUnit::fn(os); - if(Num!=Den) - { - os << ')'; - os << '^' << Num; - if(Num%Den) - { - os << '/' << Den; - } - } - } - }; - - - template - struct OutputUnit2< Translate > - { - template - static void fn(Stream &os) - { - os << '('; - OutputUnit::fn(os); - os << '+' << Num; - if(Den!=1) os << '/' << Den; - os << ')'; - } - }; - - - template - struct OutputUnit2< Scale > - { - template - static void fn(Stream &os) - { - os << Den; - if(Num != 1) - os << '/' << Num; - os << '.'; - OutputUnit::fn(os); - } - }; - } - - - template - Str& operator << (Str& os, const Value& value) - { - os << value.get() << ' '; - OutputUnit::fn(os); - return os; - } -} - - -/// -/// Additional Units -/// - - -namespace Units -{ - namespace Units - { - typedef Poco::Util::Units::Unit Unit; - - // SI base Units: - - struct m; // meter - struct kg; // kilogram - struct s; // second - struct K; // Kelvin - struct A; // Ampere - struct mol; // mole - struct cd; // candela - } - - - UNIT_DISPLAY_NAME(Units::m, "m"); - UNIT_DISPLAY_NAME(Units::kg, "kg"); - UNIT_DISPLAY_NAME(Units::s, "s"); - UNIT_DISPLAY_NAME(Units::K, "K"); - UNIT_DISPLAY_NAME(Units::A, "A"); - UNIT_DISPLAY_NAME(Units::mol, "mol"); - UNIT_DISPLAY_NAME(Units::cd, "cd"); - - - namespace Units - { - // SI derived Units: - typedef Compose > rad; - typedef Compose, Power > sr; - typedef Power Hz; - typedef Compose > > N; - typedef Compose > Pa; - typedef Compose J; - typedef Compose > W; - typedef Compose C; - typedef Compose > V; - typedef Compose > F; - typedef Compose > Ohm; - typedef Compose > S; - typedef Compose Wb; - typedef Compose > T; - typedef Compose > H; - typedef cd lm; - typedef Compose > lx; - typedef Power Bq; - typedef Compose > Gy; - typedef Gy Sv; - typedef Compose,mol> kat; - } - - - UNIT_DISPLAY_NAME(Units::rad, "rad"); - UNIT_DISPLAY_NAME(Units::sr, "sr"); - // UNIT_DISPLAY_NAME(Units::Hz, "Hz"); // Too problematic - UNIT_DISPLAY_NAME(Units::N, "N"); - UNIT_DISPLAY_NAME(Units::Pa, "Pa"); - UNIT_DISPLAY_NAME(Units::J, "J"); - UNIT_DISPLAY_NAME(Units::W, "W"); - UNIT_DISPLAY_NAME(Units::C, "C"); - UNIT_DISPLAY_NAME(Units::V, "V"); - UNIT_DISPLAY_NAME(Units::F, "F"); - UNIT_DISPLAY_NAME(Units::Ohm, "Ohm"); - UNIT_DISPLAY_NAME(Units::S, "S"); - UNIT_DISPLAY_NAME(Units::Wb, "Wb"); - UNIT_DISPLAY_NAME(Units::T, "T"); - UNIT_DISPLAY_NAME(Units::H, "H"); - UNIT_DISPLAY_NAME(Units::lx, "lx"); - UNIT_DISPLAY_NAME(Units::Gy, "Gy"); - UNIT_DISPLAY_NAME(Units::kat, "kat"); - - - namespace Units - { - // SI prefixes: - template struct deca { typedef Scale type; }; - template struct hecto { typedef Scale type; }; - template struct kilo { typedef Scale type; }; - template struct mega { typedef Scale::type, 1, 1000> type; }; - template struct giga { typedef Scale::type, 1, 1000> type; }; - template struct tera { typedef Scale::type, 1, 1000> type; }; - template struct peta { typedef Scale::type, 1, 1000> type; }; - template struct exa { typedef Scale::type, 1, 1000> type; }; - template struct zetta { typedef Scale::type, 1, 1000> type; }; - template struct yotta { typedef Scale::type, 1, 1000> type; }; - - template struct deci { typedef Scale type; }; - template struct centi { typedef Scale type; }; - template struct milli { typedef Scale type; }; - template struct micro { typedef Scale::type, 1000> type; }; - template struct nano { typedef Scale::type, 1000> type; }; - template struct pico { typedef Scale::type, 1000> type; }; - template struct femto { typedef Scale::type, 1000> type; }; - template struct atto { typedef Scale::type, 1000> type; }; - template struct zepto { typedef Scale::type, 1000> type; }; - template struct yocto { typedef Scale::type, 1000> type; }; - - - // Some prefixed SI Units: - typedef centi::type cm; - typedef milli::type mm; - typedef kilo::type km; - typedef milli::type g; - typedef milli::type mg; - typedef milli::type ms; - - - class Prefix - /// Parent class for unit prefixes. - /// Use classes inheriting from this class to scale - /// the values. - { - public: - template - Prefix(const T& val, double multiplier = 1, const std::string& prefix = ""): - _pHolder(new Holder(val)), - _multiplier(multiplier), - _prefix(prefix) - { } - - double value() const - { return _pHolder->get() * _multiplier; } - - void addPrefix(std::ostream& os) const - { os << _prefix; } - - void addUnit(std::ostream& os) const - { _pHolder->appendUnit(os); } - - private: - Prefix(); - - class Placeholder - { - public: - virtual ~Placeholder() { } - virtual double get() const = 0; - virtual void appendUnit(std::ostream& os) const = 0; - }; - - template - struct Holder : public Placeholder - { - typedef Value ValueType; - - Holder (const U& val): _val(ValueType(val)) { } - - double get() const - { return _val.get(); } - - void appendUnit(std::ostream& os) const - { OutputUnit::fn(os); } - - ValueType _val; - }; - - Placeholder* _pHolder; - double _multiplier; - std::string _prefix; - }; - } - - - template - Str& streamOp (Str& os, const Units::Prefix& val) - { - os << val.value() << ' '; - val.addPrefix(os); - val.addUnit(os); - return os; - } - - - template - Str& operator << (Str& os, const Units::Prefix& val) - /// Streaming operator for prefixed values. - { - return streamOp(os, val); - } - - - UNIT_DISPLAY_NAME(Units::cm, "cm"); - UNIT_DISPLAY_NAME(Units::mm, "mm"); - UNIT_DISPLAY_NAME(Units::km, "km"); - UNIT_DISPLAY_NAME(Units::g, "g"); - UNIT_DISPLAY_NAME(Units::mg, "mg"); - UNIT_DISPLAY_NAME(Units::ms, "ms"); - - - namespace Units - { - // Non-SI mass - typedef Scale lb; - typedef Scale oz; - typedef Scale tonne; - - // Non-SI temperature - typedef Translate Celsius; - typedef Translate, 32> Fahrenheit; - - // Non-SI time - typedef Scale minute; - typedef Scale hour; - typedef Scale day; - typedef Scale week; - struct month; // No fixed ratio with week - typedef Scale year; - typedef Scale century; - typedef Scale millennium; - - // Non-SI length - typedef Scale inch; - typedef Scale foot; - typedef Scale yard; - typedef Scale mile; - typedef Scale nautical_mile; - - // Non-SI area - typedef Power m2; - typedef Power mm2; - typedef Scale hectare; - typedef Scale are; - typedef Power inch2; - typedef Scale acre; - - // Non-SI volume - typedef Power cm3; - typedef cm3 ml; - typedef Scale liter; - typedef Scale dl; - typedef Scale cl; - typedef Power m3; - - // Non-SI velocity - typedef Compose > mph; - typedef Compose > kph; - typedef Compose > meters_per_second; - typedef Compose > knot; - typedef Scale mach; - - // Angles - typedef Scale degree; - typedef Scale grad; - typedef Scale< degree, 60 > degree_minute; - typedef Scale< degree_minute, 60 > degree_second; - - // Pressure - typedef Scale kPa; - typedef Scale psi; - typedef Scale millibar; - - // Other - typedef Scale rpm; - typedef Scale percent; - typedef Scale dozen; - typedef Scale bakers_dozen; - } - - - UNIT_DISPLAY_NAME(Units::lb, "lb"); - UNIT_DISPLAY_NAME(Units::oz, "oz"); - UNIT_DISPLAY_NAME(Units::tonne, "tonnes"); - UNIT_DISPLAY_NAME(Units::Celsius, "'C"); - UNIT_DISPLAY_NAME(Units::Fahrenheit, "'F"); - UNIT_DISPLAY_NAME(Units::minute, "minutes"); - UNIT_DISPLAY_NAME(Units::hour, "hours"); - UNIT_DISPLAY_NAME(Units::day, "days"); - UNIT_DISPLAY_NAME(Units::week, "weeks"); - UNIT_DISPLAY_NAME(Units::month, "months"); - UNIT_DISPLAY_NAME(Units::year, "years"); - UNIT_DISPLAY_NAME(Units::century, "centuries"); - UNIT_DISPLAY_NAME(Units::millennium, "millennia"); - UNIT_DISPLAY_NAME(Units::inch, "inches"); - UNIT_DISPLAY_NAME(Units::foot, "foot"); - UNIT_DISPLAY_NAME(Units::yard, "yards"); - UNIT_DISPLAY_NAME(Units::mile, "miles"); - UNIT_DISPLAY_NAME(Units::nautical_mile, "nautical miles"); - UNIT_DISPLAY_NAME(Units::hectare, "ha"); - UNIT_DISPLAY_NAME(Units::are, "are"); - UNIT_DISPLAY_NAME(Units::acre, "acres"); - UNIT_DISPLAY_NAME(Units::ml, "ml"); - UNIT_DISPLAY_NAME(Units::liter, "l"); - UNIT_DISPLAY_NAME(Units::dl, "dl"); - UNIT_DISPLAY_NAME(Units::cl, "cl"); - UNIT_DISPLAY_NAME(Units::mph, "mph"); - UNIT_DISPLAY_NAME(Units::kph, "km/h"); - UNIT_DISPLAY_NAME(Units::knot, "knots"); - UNIT_DISPLAY_NAME(Units::mach, "mach"); - UNIT_DISPLAY_NAME(Units::degree, "deg"); - UNIT_DISPLAY_NAME(Units::grad, "grad"); - UNIT_DISPLAY_NAME(Units::degree_minute, "'"); - UNIT_DISPLAY_NAME(Units::degree_second, "\""); - UNIT_DISPLAY_NAME(Units::kPa, "kPa"); - UNIT_DISPLAY_NAME(Units::psi, "PSI"); - UNIT_DISPLAY_NAME(Units::millibar, "millibars"); - UNIT_DISPLAY_NAME(Units::percent, "%"); - UNIT_DISPLAY_NAME(Units::rpm, "rpm"); - UNIT_DISPLAY_NAME(Units::dozen, "dozen"); - UNIT_DISPLAY_NAME(Units::bakers_dozen, "bakers dozen"); - - - namespace Values - { - typedef Value Unit; - - // SI Units - typedef Value m; - typedef Value kg; - typedef Value s; - typedef Value K; - typedef Value A; - typedef Value mol; - typedef Value cd; - - // SI derived - typedef Value rad; - typedef Value sr; - typedef Value Hz; - typedef Value N; - typedef Value Pa; - typedef Value J; - typedef Value W; - typedef Value C; - typedef Value V; - typedef Value F; - typedef Value Ohm; - typedef Value S; - typedef Value Wb; - typedef Value T; - typedef Value H; - typedef Value lm; - typedef Value lx; - typedef Value Bq; - typedef Value Gy; - typedef Value Sv; - typedef Value kat; - - // Prefixed Units - typedef Value cm; - typedef Value mm; - typedef Value km; - typedef Value g; - typedef Value mg; - typedef Value ms; - - // Non-SI - typedef Value lb; - typedef Value oz; - typedef Value tonne; - - typedef Value Celsius; - typedef Value Fahrenheit; - - typedef Value minute; - typedef Value hour; - typedef Value day; - typedef Value week; - typedef Value month; - typedef Value year; - typedef Value century; - typedef Value millennium; - - typedef Value inch; - typedef Value foot; - typedef Value yard; - typedef Value mile; - typedef Value nautical_mile; - - typedef Value m2; - typedef Value mm2; - typedef Value hectare; - typedef Value are; - typedef Value inch2; - typedef Value acre; - - typedef Value cm3; - typedef Value ml; - typedef Value cl; - typedef Value liter; - typedef Value dl; - typedef Value m3; - - typedef Value mph; - typedef Value kph; - typedef Value meters_per_second; - typedef Value knot; - typedef Value mach; - - typedef Value degree; - typedef Value grad; - typedef Value degree_minute; - typedef Value degree_second; - - typedef Value kPa; - typedef Value psi; - typedef Value millibar; - - typedef Value percent; - typedef Value rpm; - typedef Value dozen; - typedef Value bakers_dozen; - - #define DEFINE_PREFIX_CLASS(name, scale, prefix) struct name: public Units::Prefix \ - { template name(const T& val): Prefix(val, scale, prefix) { } }; \ - template Str& operator << (Str& os, const name& val) \ - { return streamOp(os, val); } - - DEFINE_PREFIX_CLASS (deca, .1, "da") - DEFINE_PREFIX_CLASS (hecto, .01, "h") - DEFINE_PREFIX_CLASS (kilo, .001, "k") - DEFINE_PREFIX_CLASS (mega, 1e-6, "M") - DEFINE_PREFIX_CLASS (giga, 1e-9, "G") - DEFINE_PREFIX_CLASS (tera, 1e-12, "T") - DEFINE_PREFIX_CLASS (peta, 1e-15, "P") - DEFINE_PREFIX_CLASS (exa, 1e-18, "E") - DEFINE_PREFIX_CLASS (zetta, 1e-21, "Z") - DEFINE_PREFIX_CLASS (yotta, 1e-24, "Y") - - DEFINE_PREFIX_CLASS (deci, 10, "d") - DEFINE_PREFIX_CLASS (centi, 100, "c") - DEFINE_PREFIX_CLASS (milli, 1000, "m") - DEFINE_PREFIX_CLASS (micro, 1e6, "u") - DEFINE_PREFIX_CLASS (nano, 1e9, "n") - DEFINE_PREFIX_CLASS (pico, 1e12, "p") - DEFINE_PREFIX_CLASS (femto, 1e15, "f") - DEFINE_PREFIX_CLASS (atto, 1e18, "a") - DEFINE_PREFIX_CLASS (zepto, 1e21, "z") - DEFINE_PREFIX_CLASS (yocto, 1e24, "y") - } - - - namespace Constants - { - // Physical constants: - const Value > > k (1.3806504e-23); - const Value mu (1.660538782e-27); - const Value > NA (6.02214179e23); - const Value G0 (7.7480917004e-5); - const Value > > e0 (8.854187817e-12); - const Value me (9.10938215e-31); - const Value eV (1.602176487e-19); - const Value e (1.602176487e-19); - const Value F (96485.3399); - const Value alpha (7.2973525376e-3); - const Value inv_alpha (137.035999679); - const Value > > u0 (12.566370614); - const Value phi0 (2.067833667e-15); // ?? - const Value, Power > > > R (8.314472); - const Value, Compose, Power > > > G (6.67428e-11); - const Value > h (6.62606896e-34); - const Value > h_bar (1.054571628e-34); - const Value mp (1.672621637e-27); - const Value mpme (1836.15267247); - const Value > Rinf (10973731.568527); - const Value > > c (299792458); - const Value, Power > > > rho (5.6704e-8); - - // Other constants: - const Value pi (3.141592653589793); - const Value lightyear (9.4605284e15); - const Value AU(149597871); - const Value > > g (9.80665); - } - - - // Trigonometry - - - template - V sin(const Value& angle) - { - return std::sin(Value(angle).get()); - } - - - template - V cos(const Value& angle) - { - return std::cos(Value(angle).get()); - } - - - template - V tan(const Value& angle) - { - return std::tan(Value(angle).get()); - } - - -} } } // namespace Poco::Util::Units - - -#endif // Util_Units_INCLUDED +// +// Units.h +// +// $Id: //poco/1.4/Util/include/Poco/Util/Units.h#1 $ +// +// Library: Util +// Package: Units +// Module: Units +// +// Definitions for the C++ Units library. +// +// Copyright (c) 2007-2010, 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. +// +// Adapted for POCO from the following source: +// +// C++ Units by Calum Grant +// +// Written by Calum Grant +// Copyright (C) Calum Grant 2007 +// +// Home page: http://calumgrant.net/units +// File location: http://calumgrant.net/units/units.hpp +// Manual: http://calumgrant.net/units/units.html +// +// Copying permitted under the terms of the Boost software license. +// + + +#ifndef Util_Units_INCLUDED +#define Util_Units_INCLUDED + + +#include "Poco/Util/Util.h" +#include + + +namespace Poco { +namespace Util { +namespace Units { + + +namespace Internal +{ + template struct Convert; + struct None; + template + struct FixedPower; +} + + +template +struct Compose; + /// Construct a unit equivalent to Unit1*Unit2 + + +template +struct Scale; + /// Constructs a unit equivalent to U*Num/Den + + +template +struct Translate; + /// Constructs a Unit equivalent to U+Num/Den + + +template +struct Power; + /// Constructs a Unit equivalent to U^(Num/Den) + + +typedef Power Unit; + /// A unit which is effectively no units at all. + + +template +class Value + /// A Value with a unit. + /// - V is the type you are storing + /// - U is the unit of the Value + /// + /// This class is usually not used directly; + /// client code should use the typedef'd + /// instantiations defined in the Values and + /// Constants namespace. + /// + /// Example: + /// + /// using namespace Poco::Util::Units::Values; + /// + /// std::cout << "One mile is " << km(mile(1)) << std::endl; + /// // Output: One mile is 1.60934 km + /// + /// std::cout << "Flow rate is " << m3(mile(1)*inch(80)*foot(9))/s(minute(5)); + /// // Output: Flow rate is 29.9026 (m)^3.(s)^-1 + /// + /// hours h; + /// h = cm(3); // Compile-time error: incompatible units + /// h = 4; // Compile-time error: 4 of what? + /// h = days(4); // Ok: h is 96 hours +{ +public: + typedef V ValueType; + typedef U Unit; + + Value(): _rep() + { + } + + explicit Value(const ValueType& v): _rep(v) + { + } + + template + Value(const Value& v): + _rep(Internal::Convert::fn(v.get())) + { + } + + const ValueType& get() const + { + return _rep; + } + + template + Value& operator = (const Value& other) + { + _rep = Value(other).get(); + return *this; + } + + template + Value operator + (const Value& other) const + { + return Value(get() + Value(other).get()); + } + + template + Value& operator += (const Value& other) + { + _rep += Value(other).get(); + return *this; + } + + template + Value& operator -= (const Value& other) + { + _rep -= Value(other).get(); + return *this; + } + + template + Value operator - (const Value& other) const + { + return Value(get() - Value(other).get()); + } + + Value operator - () const + { + return Value(-get()); + } + + template + Value > + operator * (const Value& other) const + { + return Value >(get() * other.get()); + } + + Value operator * (const ValueType& v) const + { + return Value(get() * v); + } + + Value& operator *= (const ValueType& v) + { + _rep *= v; + return *this; + } + + template + Value > > operator / (const Value& other) const + { + return Value > >(get() / other.get()); + } + + Value operator / (const ValueType& v) const + { + return Value(get() / v); + } + + Value& operator /= (const ValueType& v) + { + _rep /= v; + return *this; + } + + template + bool operator == (const Value& other) const + { + return get() == Value(other).get(); + } + + template + bool operator != (const Value& other) const + { + return get() != Value(other).get(); + } + + template + bool operator < (const Value& other) const + { + return get() < Value(other).get(); + } + + template + bool operator <= (const Value& other) const + { + return get() <= Value(other).get(); + } + + template + bool operator > (const Value& other) const + { + return get() > Value(other).get(); + } + + template + bool operator >= (const Value& other) const + { + return get() >= Value(other).get(); + } + + Value& operator ++ () + { + ++_rep; + return *this; + } + + Value operator ++ (int) + { + Value v = *this; + ++_rep; + return v; + } + + Value& operator -- () + { + --_rep; + return *this; + } + + Value operator -- (int) + { + Value v = *this; + --_rep; + return v; + } + +private: + ValueType _rep; +}; + + +template +Value > operator / (const V& a, const Value& b) +{ + return Value >(a / b.get()); +} + + +template +Value operator * (const V& a, const Value& b) +{ + return Value(a * b.get()); +} + + +template +Value > sqrt(const Value& a) +{ + return Value >(std::sqrt(a.get())); +} + + +template +Value > square(const Value& a) +{ + return Value >(std::pow(a.get(), 2)); +} + + +template +Value > cube(const Value& a) +{ + return Value >(std::pow(a.get(), 3)); +} + + +template +Value > raise(const Value& a) +{ + return Value >(Internal::FixedPower::Power(a.get())); +} + + +namespace Internal +{ + template struct static_assert; + template <> struct static_assert { }; + /// Ensures (at compile-time) that the template argument is true. + + template + struct Convertible; + + template + struct ScalingFactor; + + template + struct Convert3 + /// Converts T1 to T2. + /// Stage 3 - performed after Stage 1 and Stage 2. + /// The reason we perform Convert in stages is so that the compiler + /// can resolve templates in the order we want it to. + { + template + static V fn(const V& v) + /// The default implementation assumes that the two quantities are in compatible + /// Units up to some scaling factor. Find the scaling factor and apply it. + { + return v * ScalingFactor::template fn() / ScalingFactor::template fn(); + } + }; + + template + struct Convert2 + /// Converts T1 to T2. + /// Template matches the first argument (T1), + /// this is the fall-through to Convert3. + { + template + static V fn(const V& v) + { + return Convert3::fn(v); + } + }; + + template + struct Convert + /// Converts T1 to T2. + /// If you really want to implement your own conversion routine, + /// specialize this template. + /// The default implementation falls through to Convert2. + { + static_assert::Value> checkConvertible; + /// If this fails, then T1 is not Convertible to T2: + + template + static V fn(const V& v) + { + return Convert2::fn(v); + } + }; + + template + struct Convert + // Trivial conversion to the same type. + { + template + static const U& fn(const U& u) { return u; } + }; + + template + struct Convert3 + // Convert to same type. + { + template + static const U& fn(const U& u) { return u; } + }; + + template + struct Convert2, U> + // Convert from a scaled Unit. + { + template + static V fn(const V& v) + { + return Convert::fn((v * Den)/Num); + } + }; + + template + struct Convert3 > + // Convert to a scaled Unit. + { + template + static V fn(const V& v) + { + return (Convert::fn(v) * Num)/ Den; + } + }; + + template + struct Convert2, U> + // Convert from a translated Unit. + { + template + static V fn(const V& v) + { + return Convert::fn(v - static_cast(Num) / static_cast(Den)); + } + }; + + template + struct Convert3 > + // Convert to a translated Unit. + { + template + static V fn(const V& v) + { + return Convert::fn(v) + static_cast(Num) / static_cast(Den); + } + }; + + template + struct CountTerms + /// Count the power to which Unit Term is raised in the Unit List. + /// Returns a rational num/den of the power of term Term in List. + /// The default assumes that Term is not found (num/den=0). + { + static const int num = 0; + static const int den = 1; + }; + + template + struct CountTerms + { + static const int num = 1; + static const int den = 1; + }; + + template + struct CountTerms > + // CountTerms ignores scaling factors - that is taken care of by ScalingFactor. + { + typedef CountTerms result; + static const int num = result::num; + static const int den = result::den; + }; + + template + struct CountTerms > + // CountTerms ignores translation. + { + typedef CountTerms result; + static const int num = result::num; + static const int den = result::den; + }; + + template + struct CountTerms > + // Addition of fractions. + { + typedef CountTerms result1; + typedef CountTerms result2; + static const int num = result1::num * result2::den + result1::den * result2::num; + static const int den = result1::den * result2::den; + }; + + template + struct CountTerms > + // Multiplication of fractions. + { + typedef CountTerms result; + static const int num = N * result::num; + static const int den = D * result::den; + }; + + template + struct CheckTermsEqual + /// Counts the power of the Unit Term in Units T1 and T2. + /// Reports if they are equal, using equality of fractions. + /// Does a depth-first search of the Unit "Term", + /// or counts the terms in the default case. + { + typedef CountTerms count1; + typedef CountTerms count2; + + static const bool Value = + count1::num * count2::den == + count1::den * count2::num; + }; + + template + struct CheckTermsEqual, T1, T2 > + { + static const bool Value = CheckTermsEqual::Value; + }; + + template + struct CheckTermsEqual, T1, T2 > + { + static const bool Value = CheckTermsEqual::Value; + }; + + template + struct CheckTermsEqual, T1, T2 > + { + static const bool Value = CheckTermsEqual::Value; + }; + + template + struct CheckTermsEqual,T3,T4> + { + static const bool Value = + CheckTermsEqual::Value && + CheckTermsEqual::Value; + }; + + template + struct Convertible + /// Determines whether two types are Convertible. + /// Counts the powers in the LHS and RHS and ensures they are equal. + { + static const bool Value = + CheckTermsEqual::Value && + CheckTermsEqual::Value; + }; + + template + struct FixedPower + /// A functor that raises a Value to the power Num/Den. + /// The template is specialised for efficiency + /// so that we don't always have to call the std::power function. + { + template static T Power(const T& t) + { + return std::pow(t, static_cast(Num)/static_cast(Den)); + } + }; + + template + struct FixedPower + { + template static const T& Power(const T& t) + { + return t; + } + }; + + template + struct FixedPower + { + template static T Power(const T& t) + { + return t*t; + } + }; + + template + struct FixedPower + { + template static T Power(const T& t) + { + return t*t*t; + } + }; + + template + struct FixedPower + { + template static const T& Power(const T& t) + { + T u = t*t; + return u*u; + } + }; + + template + struct FixedPower + { + template static T Power(const T& t) + { + return 1/t; + } + }; + + template + struct FixedPower + { + template static T Power(const T& t) + { + return 1/(t*t); + } + }; + + template + struct FixedPower + { + template static T Power(const T& t) + { + return 1; + } + }; + + template + struct ScalingFactor + /// Determine the scaling factor of a Unit in relation to its "base" Units. + /// Default is that U is a primitive Unit and is not scaled. + { + template + static T fn() { return 1; } + }; + + template + struct ScalingFactor< Compose > + { + template + static T fn() + { + return + ScalingFactor::template fn() * + ScalingFactor::template fn(); + } + }; + + template + struct ScalingFactor< Scale > + { + template + static T fn() + { + return + ScalingFactor::template fn() * + static_cast(N) / static_cast(D); + } + }; + + template + struct ScalingFactor< Power > + { + template + static T fn() + { + return FixedPower::Power(ScalingFactor::template fn()); + } + }; + + template + struct ScalingFactor< Translate > + { + template + static T fn() + { + return ScalingFactor::template fn(); + } + }; +} // namespace Internal + + +/// +/// Display +/// + + +#define UNIT_DISPLAY_NAME(Unit, string) \ + template <> \ + struct OutputUnit \ + { \ + template \ + static void fn(Stream& os) \ + { \ + os << string; \ + } \ + } + + +namespace Internal +{ + template + struct OutputUnit2 + /// The default Unit formatting mechanism. + { + template + static void fn(Stream &os) + { + os << "Units"; + } + }; +} + + +template +struct OutputUnit + /// Functor to write Unit text to stream. +{ + template + static void fn(Stream &os) + { + Internal::OutputUnit2::fn(os); + } +}; + + +UNIT_DISPLAY_NAME(Unit, "1"); + + +namespace Internal +{ + template + struct OutputUnit2< Compose > + { + template + static void fn(Stream &os) + { + OutputUnit::fn(os); + os << '.'; + OutputUnit::fn(os); + } + }; + + template + struct OutputUnit2< Power > + { + template + static void fn(Stream &os) + { + if(Num!=Den) os << '('; + OutputUnit::fn(os); + if(Num!=Den) + { + os << ')'; + os << '^' << Num; + if(Num%Den) + { + os << '/' << Den; + } + } + } + }; + + template + struct OutputUnit2< Translate > + { + template + static void fn(Stream &os) + { + os << '('; + OutputUnit::fn(os); + os << '+' << Num; + if(Den!=1) os << '/' << Den; + os << ')'; + } + }; + + template + struct OutputUnit2< Scale > + { + template + static void fn(Stream &os) + { + os << Den; + if(Num != 1) + os << '/' << Num; + os << '.'; + OutputUnit::fn(os); + } + }; +} // namespace Internal + + +template +Str& operator << (Str& os, const Value& value) +{ + os << value.get() << ' '; + OutputUnit::fn(os); + return os; +} + + +/// +/// Additional Units +/// + + +namespace Units +{ + typedef Poco::Util::Units::Unit Unit; + + // SI base Units: + + struct m; /// meter + struct kg; /// kilogram + struct s; /// second + struct K; /// Kelvin + struct A; /// Ampere + struct mol; /// mole + struct cd; /// candela +} + + +UNIT_DISPLAY_NAME(Units::m, "m"); +UNIT_DISPLAY_NAME(Units::kg, "kg"); +UNIT_DISPLAY_NAME(Units::s, "s"); +UNIT_DISPLAY_NAME(Units::K, "K"); +UNIT_DISPLAY_NAME(Units::A, "A"); +UNIT_DISPLAY_NAME(Units::mol, "mol"); +UNIT_DISPLAY_NAME(Units::cd, "cd"); + + +namespace Units +{ + // SI derived Units: + typedef Compose > rad; + typedef Compose, Power > sr; + typedef Power Hz; + typedef Compose > > N; + typedef Compose > Pa; + typedef Compose J; + typedef Compose > W; + typedef Compose C; + typedef Compose > V; + typedef Compose > F; + typedef Compose > Ohm; + typedef Compose > S; + typedef Compose Wb; + typedef Compose > T; + typedef Compose > H; + typedef cd lm; + typedef Compose > lx; + typedef Power Bq; + typedef Compose > Gy; + typedef Gy Sv; + typedef Compose,mol> kat; +} + + +UNIT_DISPLAY_NAME(Units::rad, "rad"); +UNIT_DISPLAY_NAME(Units::sr, "sr"); +// UNIT_DISPLAY_NAME(Units::Hz, "Hz"); // Too problematic +UNIT_DISPLAY_NAME(Units::N, "N"); +UNIT_DISPLAY_NAME(Units::Pa, "Pa"); +UNIT_DISPLAY_NAME(Units::J, "J"); +UNIT_DISPLAY_NAME(Units::W, "W"); +UNIT_DISPLAY_NAME(Units::C, "C"); +UNIT_DISPLAY_NAME(Units::V, "V"); +UNIT_DISPLAY_NAME(Units::F, "F"); +UNIT_DISPLAY_NAME(Units::Ohm, "Ohm"); +UNIT_DISPLAY_NAME(Units::S, "S"); +UNIT_DISPLAY_NAME(Units::Wb, "Wb"); +UNIT_DISPLAY_NAME(Units::T, "T"); +UNIT_DISPLAY_NAME(Units::H, "H"); +UNIT_DISPLAY_NAME(Units::lx, "lx"); +UNIT_DISPLAY_NAME(Units::Gy, "Gy"); +UNIT_DISPLAY_NAME(Units::kat, "kat"); + + +namespace Units +{ + // SI prefixes: + template struct deca { typedef Scale type; }; + template struct hecto { typedef Scale type; }; + template struct kilo { typedef Scale type; }; + template struct mega { typedef Scale::type, 1, 1000> type; }; + template struct giga { typedef Scale::type, 1, 1000> type; }; + template struct tera { typedef Scale::type, 1, 1000> type; }; + template struct peta { typedef Scale::type, 1, 1000> type; }; + template struct exa { typedef Scale::type, 1, 1000> type; }; + template struct zetta { typedef Scale::type, 1, 1000> type; }; + template struct yotta { typedef Scale::type, 1, 1000> type; }; + + template struct deci { typedef Scale type; }; + template struct centi { typedef Scale type; }; + template struct milli { typedef Scale type; }; + template struct micro { typedef Scale::type, 1000> type; }; + template struct nano { typedef Scale::type, 1000> type; }; + template struct pico { typedef Scale::type, 1000> type; }; + template struct femto { typedef Scale::type, 1000> type; }; + template struct atto { typedef Scale::type, 1000> type; }; + template struct zepto { typedef Scale::type, 1000> type; }; + template struct yocto { typedef Scale::type, 1000> type; }; + + + // Some prefixed SI Units: + typedef centi::type cm; + typedef milli::type mm; + typedef kilo::type km; + typedef milli::type g; + typedef milli::type mg; + typedef milli::type ms; + + + class Prefix + /// Parent class for unit prefixes. + /// Use classes inheriting from this class to scale + /// the values. + { + public: + template + Prefix(const T& val, double multiplier = 1, const std::string& prefix = ""): + _pHolder(new Holder(val)), + _multiplier(multiplier), + _prefix(prefix) + { + } + + double value() const + { + return _pHolder->get() * _multiplier; + } + + void addPrefix(std::ostream& os) const + { + os << _prefix; + } + + void addUnit(std::ostream& os) const + { + _pHolder->appendUnit(os); + } + + private: + Prefix(); + + class Placeholder + { + public: + virtual ~Placeholder() { } + virtual double get() const = 0; + virtual void appendUnit(std::ostream& os) const = 0; + }; + + template + struct Holder : public Placeholder + { + typedef Value ValueType; + + Holder (const U& val): _val(ValueType(val)) + { + } + + double get() const + { + return _val.get(); + } + + void appendUnit(std::ostream& os) const + { + OutputUnit::fn(os); + } + + ValueType _val; + }; + + Placeholder* _pHolder; + double _multiplier; + std::string _prefix; + }; +} + + +template +Str& streamOp (Str& os, const Units::Prefix& val) +{ + os << val.value() << ' '; + val.addPrefix(os); + val.addUnit(os); + return os; +} + + +template +Str& operator << (Str& os, const Units::Prefix& val) + /// Streaming operator for prefixed values. +{ + return streamOp(os, val); +} + + +UNIT_DISPLAY_NAME(Units::cm, "cm"); +UNIT_DISPLAY_NAME(Units::mm, "mm"); +UNIT_DISPLAY_NAME(Units::km, "km"); +UNIT_DISPLAY_NAME(Units::g, "g"); +UNIT_DISPLAY_NAME(Units::mg, "mg"); +UNIT_DISPLAY_NAME(Units::ms, "ms"); + + +namespace Units +{ + // Non-SI mass + typedef Scale lb; + typedef Scale oz; + typedef Scale tonne; + + // Non-SI temperature + typedef Translate Celsius; + typedef Translate, 32> Fahrenheit; + + // Non-SI time + typedef Scale minute; + typedef Scale hour; + typedef Scale day; + typedef Scale week; + struct month; // No fixed ratio with week + typedef Scale year; + typedef Scale century; + typedef Scale millennium; + + // Non-SI length + typedef Scale inch; + typedef Scale foot; + typedef Scale yard; + typedef Scale mile; + typedef Scale nautical_mile; + + // Non-SI area + typedef Power m2; + typedef Power mm2; + typedef Scale hectare; + typedef Scale are; + typedef Power inch2; + typedef Scale acre; + + // Non-SI volume + typedef Power cm3; + typedef cm3 ml; + typedef Scale liter; + typedef Scale dl; + typedef Scale cl; + typedef Power m3; + + // Non-SI velocity + typedef Compose > mph; + typedef Compose > kph; + typedef Compose > meters_per_second; + typedef Compose > knot; + typedef Scale mach; + + // Angles + typedef Scale degree; + typedef Scale grad; + typedef Scale< degree, 60 > degree_minute; + typedef Scale< degree_minute, 60 > degree_second; + + // Pressure + typedef Scale kPa; + typedef Scale psi; + typedef Scale millibar; + + // Other + typedef Scale rpm; + typedef Scale percent; + typedef Scale dozen; + typedef Scale bakers_dozen; +} + + +UNIT_DISPLAY_NAME(Units::lb, "lb"); +UNIT_DISPLAY_NAME(Units::oz, "oz"); +UNIT_DISPLAY_NAME(Units::tonne, "tonnes"); +UNIT_DISPLAY_NAME(Units::Celsius, "'C"); +UNIT_DISPLAY_NAME(Units::Fahrenheit, "'F"); +UNIT_DISPLAY_NAME(Units::minute, "minutes"); +UNIT_DISPLAY_NAME(Units::hour, "hours"); +UNIT_DISPLAY_NAME(Units::day, "days"); +UNIT_DISPLAY_NAME(Units::week, "weeks"); +UNIT_DISPLAY_NAME(Units::month, "months"); +UNIT_DISPLAY_NAME(Units::year, "years"); +UNIT_DISPLAY_NAME(Units::century, "centuries"); +UNIT_DISPLAY_NAME(Units::millennium, "millennia"); +UNIT_DISPLAY_NAME(Units::inch, "inches"); +UNIT_DISPLAY_NAME(Units::foot, "foot"); +UNIT_DISPLAY_NAME(Units::yard, "yards"); +UNIT_DISPLAY_NAME(Units::mile, "miles"); +UNIT_DISPLAY_NAME(Units::nautical_mile, "nautical miles"); +UNIT_DISPLAY_NAME(Units::hectare, "ha"); +UNIT_DISPLAY_NAME(Units::are, "are"); +UNIT_DISPLAY_NAME(Units::acre, "acres"); +UNIT_DISPLAY_NAME(Units::ml, "ml"); +UNIT_DISPLAY_NAME(Units::liter, "l"); +UNIT_DISPLAY_NAME(Units::dl, "dl"); +UNIT_DISPLAY_NAME(Units::cl, "cl"); +UNIT_DISPLAY_NAME(Units::mph, "mph"); +UNIT_DISPLAY_NAME(Units::kph, "km/h"); +UNIT_DISPLAY_NAME(Units::knot, "knots"); +UNIT_DISPLAY_NAME(Units::mach, "mach"); +UNIT_DISPLAY_NAME(Units::degree, "deg"); +UNIT_DISPLAY_NAME(Units::grad, "grad"); +UNIT_DISPLAY_NAME(Units::degree_minute, "'"); +UNIT_DISPLAY_NAME(Units::degree_second, "\""); +UNIT_DISPLAY_NAME(Units::kPa, "kPa"); +UNIT_DISPLAY_NAME(Units::psi, "PSI"); +UNIT_DISPLAY_NAME(Units::millibar, "millibars"); +UNIT_DISPLAY_NAME(Units::percent, "%"); +UNIT_DISPLAY_NAME(Units::rpm, "rpm"); +UNIT_DISPLAY_NAME(Units::dozen, "dozen"); +UNIT_DISPLAY_NAME(Units::bakers_dozen, "bakers dozen"); + + +namespace Values +{ + typedef Value Unit; + + // SI Units + typedef Value m; + typedef Value kg; + typedef Value s; + typedef Value K; + typedef Value A; + typedef Value mol; + typedef Value cd; + + // SI derived + typedef Value rad; + typedef Value sr; + typedef Value Hz; + typedef Value N; + typedef Value Pa; + typedef Value J; + typedef Value W; + typedef Value C; + typedef Value V; + typedef Value F; + typedef Value Ohm; + typedef Value S; + typedef Value Wb; + typedef Value T; + typedef Value H; + typedef Value lm; + typedef Value lx; + typedef Value Bq; + typedef Value Gy; + typedef Value Sv; + typedef Value kat; + + // Prefixed Units + typedef Value cm; + typedef Value mm; + typedef Value km; + typedef Value g; + typedef Value mg; + typedef Value ms; + + // Non-SI + typedef Value lb; + typedef Value oz; + typedef Value tonne; + + typedef Value Celsius; + typedef Value Fahrenheit; + + typedef Value minute; + typedef Value hour; + typedef Value day; + typedef Value week; + typedef Value month; + typedef Value year; + typedef Value century; + typedef Value millennium; + + typedef Value inch; + typedef Value foot; + typedef Value yard; + typedef Value mile; + typedef Value nautical_mile; + + typedef Value m2; + typedef Value mm2; + typedef Value hectare; + typedef Value are; + typedef Value inch2; + typedef Value acre; + + typedef Value cm3; + typedef Value ml; + typedef Value cl; + typedef Value liter; + typedef Value dl; + typedef Value m3; + + typedef Value mph; + typedef Value kph; + typedef Value meters_per_second; + typedef Value knot; + typedef Value mach; + + typedef Value degree; + typedef Value grad; + typedef Value degree_minute; + typedef Value degree_second; + + typedef Value kPa; + typedef Value psi; + typedef Value millibar; + + typedef Value percent; + typedef Value rpm; + typedef Value dozen; + typedef Value bakers_dozen; + + #define DEFINE_PREFIX_CLASS(name, scale, prefix) \ + struct name: public Units::Prefix \ + { \ + template \ + name(const T& val): Prefix(val, scale, prefix) \ + { \ + } \ + }; \ + template \ + Str& operator << (Str& os, const name& val) \ + { \ + return streamOp(os, val); \ + } + + DEFINE_PREFIX_CLASS (deca, .1, "da") + DEFINE_PREFIX_CLASS (hecto, .01, "h") + DEFINE_PREFIX_CLASS (kilo, .001, "k") + DEFINE_PREFIX_CLASS (mega, 1e-6, "M") + DEFINE_PREFIX_CLASS (giga, 1e-9, "G") + DEFINE_PREFIX_CLASS (tera, 1e-12, "T") + DEFINE_PREFIX_CLASS (peta, 1e-15, "P") + DEFINE_PREFIX_CLASS (exa, 1e-18, "E") + DEFINE_PREFIX_CLASS (zetta, 1e-21, "Z") + DEFINE_PREFIX_CLASS (yotta, 1e-24, "Y") + + DEFINE_PREFIX_CLASS (deci, 10, "d") + DEFINE_PREFIX_CLASS (centi, 100, "c") + DEFINE_PREFIX_CLASS (milli, 1000, "m") + DEFINE_PREFIX_CLASS (micro, 1e6, "u") + DEFINE_PREFIX_CLASS (nano, 1e9, "n") + DEFINE_PREFIX_CLASS (pico, 1e12, "p") + DEFINE_PREFIX_CLASS (femto, 1e15, "f") + DEFINE_PREFIX_CLASS (atto, 1e18, "a") + DEFINE_PREFIX_CLASS (zepto, 1e21, "z") + DEFINE_PREFIX_CLASS (yocto, 1e24, "y") +} + + +namespace Constants +{ + // Physical constants: + const Value > > k (1.3806504e-23); + const Value mu (1.660538782e-27); + const Value > NA (6.02214179e23); + const Value G0 (7.7480917004e-5); + const Value > > e0 (8.854187817e-12); + const Value me (9.10938215e-31); + const Value eV (1.602176487e-19); + const Value e (1.602176487e-19); + const Value F (96485.3399); + const Value alpha (7.2973525376e-3); + const Value inv_alpha (137.035999679); + const Value > > u0 (12.566370614); + const Value phi0 (2.067833667e-15); // ?? + const Value, Power > > > R (8.314472); + const Value, Compose, Power > > > G (6.67428e-11); + const Value > h (6.62606896e-34); + const Value > h_bar (1.054571628e-34); + const Value mp (1.672621637e-27); + const Value mpme (1836.15267247); + const Value > Rinf (10973731.568527); + const Value > > c (299792458); + const Value, Power > > > rho (5.6704e-8); + + // Other constants: + const Value pi (3.141592653589793); + const Value lightyear (9.4605284e15); + const Value AU(149597871); + const Value > > g (9.80665); +} + + +// +// Trigonometry +// + + +template +V sin(const Value& angle) +{ + return std::sin(Value(angle).get()); +} + + +template +V cos(const Value& angle) +{ + return std::cos(Value(angle).get()); +} + + +template +V tan(const Value& angle) +{ + return std::tan(Value(angle).get()); +} + + +} } } // namespace Poco::Util::Units + + +#endif // Util_Units_INCLUDED diff --git a/Util/include/Poco/Util/Util.h b/Util/include/Poco/Util/Util.h index f156e6a03..b54e18574 100644 --- a/Util/include/Poco/Util/Util.h +++ b/Util/include/Poco/Util/Util.h @@ -72,19 +72,7 @@ // #if defined(_MSC_VER) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Util_EXPORTS) - #if defined(POCO_DLL) - #if defined(_DEBUG) - #pragma comment(lib, "PocoUtild.lib") - #else - #pragma comment(lib, "PocoUtil.lib") - #endif - #else - #if defined(_DEBUG) - #pragma comment(lib, "PocoUtilmtd.lib") - #else - #pragma comment(lib, "PocoUtilmt.lib") - #endif - #endif + #pragma comment(lib, "PocoUtil" POCO_LIB_SUFFIX) #endif #endif diff --git a/Util/include/Poco/Util/WinRegistryConfiguration.h b/Util/include/Poco/Util/WinRegistryConfiguration.h index f72c4fa33..48e2d8b3f 100644 --- a/Util/include/Poco/Util/WinRegistryConfiguration.h +++ b/Util/include/Poco/Util/WinRegistryConfiguration.h @@ -1,7 +1,7 @@ // // WinRegistryConfiguration.h // -// $Id: //poco/Main/Util/include/Poco/Util/WinRegistryConfiguration.h#2 $ +// $Id: //poco/1.4/Util/include/Poco/Util/WinRegistryConfiguration.h#1 $ // // Library: Util // Package: Windows @@ -52,6 +52,9 @@ namespace Util { class Util_API WinRegistryConfiguration: public AbstractConfiguration /// An implementation of AbstractConfiguration that stores configuration data /// in the Windows registry. + /// + /// Removing key is not supported. An attempt to remove a key results + /// in a NotImplementedException being thrown. { public: WinRegistryConfiguration(const std::string& rootPath); @@ -62,26 +65,15 @@ public: /// dot seperated, e.g. the path MyService.ServiceName will be converted to /// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\ServiceName. - bool getRaw(const std::string& key, std::string& value) const; - /// If the property with the given key exists, stores the property's value - /// in value and returns true. Otherwise, returns false. - /// - /// Must be overridden by subclasses. - - void setRaw(const std::string& key, const std::string& value); - /// Sets the property with the given key to the given value. - /// An already existing value for the key is overwritten. - /// - /// Must be overridden by subclasses. - - void enumerate(const std::string& key, Keys& range) const; - /// Returns in range the names of all subkeys under the given key. - /// If an empty key is passed, all root level keys are returned. - protected: ~WinRegistryConfiguration(); /// Destroys the WinRegistryConfiguration. + bool getRaw(const std::string& key, std::string& value) const; + void setRaw(const std::string& key, const std::string& value); + void enumerate(const std::string& key, Keys& range) const; + void removeRaw(const std::string& key); + std::string ConvertToRegFormat(const std::string& key, std::string& keyName) const; /// takes a key in the format of A.B.C and converts it to /// registry format A\B\C, the last entry is the keyName, the rest is returned as path diff --git a/Util/include/Poco/Util/WinRegistryKey.h b/Util/include/Poco/Util/WinRegistryKey.h index c4de9346f..6d5a974ae 100644 --- a/Util/include/Poco/Util/WinRegistryKey.h +++ b/Util/include/Poco/Util/WinRegistryKey.h @@ -1,7 +1,7 @@ // // WinRegistryKey.h // -// $Id: //poco/Main/Util/include/Poco/Util/WinRegistryKey.h#4 $ +// $Id: //poco/1.4/Util/include/Poco/Util/WinRegistryKey.h#2 $ // // Library: Util // Package: Windows @@ -67,7 +67,7 @@ public: REGT_DWORD = 4 }; - WinRegistryKey(const std::string& key, bool readOnly = false); + WinRegistryKey(const std::string& key, bool readOnly = false, REGSAM extraSam = 0); /// Creates the WinRegistryKey. /// /// The key must start with one of the root key names @@ -76,13 +76,19 @@ public: /// If readOnly is true, then only read access to the registry /// is available and any attempt to write to the registry will /// result in an exception. + /// + /// extraSam is used to pass extra flags (in addition to KEY_READ and KEY_WRITE) + /// to the samDesired argument of RegOpenKeyEx() or RegCreateKeyEx(). - WinRegistryKey(HKEY hRootKey, const std::string& subKey, bool readOnly = false); + WinRegistryKey(HKEY hRootKey, const std::string& subKey, bool readOnly = false, REGSAM extraSam = 0); /// Creates the WinRegistryKey. /// /// If readOnly is true, then only read access to the registry /// is available and any attempt to write to the registry will /// result in an exception. + /// + /// extraSam is used to pass extra flags (in addition to KEY_READ and KEY_WRITE) + /// to the samDesired argument of RegOpenKeyEx() or RegCreateKeyEx(). ~WinRegistryKey(); /// Destroys the WinRegistryKey. @@ -162,6 +168,7 @@ private: std::string _subKey; HKEY _hKey; bool _readOnly; + REGSAM _extraSam; }; diff --git a/Util/include/Poco/Util/WinService.h b/Util/include/Poco/Util/WinService.h index ff585e92a..21e87d824 100644 --- a/Util/include/Poco/Util/WinService.h +++ b/Util/include/Poco/Util/WinService.h @@ -126,14 +126,24 @@ public: void setStartup(Startup startup); /// Sets the startup mode for the service. - Startup getStartup() const; - /// Returns the startup mode for the service. + Startup getStartup() const; + /// Returns the startup mode for the service. + + void setDescription(const std::string& description); + /// Sets the service description in the registry. + + std::string getDescription() const; + /// Returns the service description from the registry. - static const int STARTUP_TIMEOUT; + static const int STARTUP_TIMEOUT; + +protected: + static const std::string REGISTRY_KEY; + static const std::string REGISTRY_DESCRIPTION; private: - void open() const; - bool tryOpen() const; + void open() const; + bool tryOpen() const; void close() const; POCO_LPQUERY_SERVICE_CONFIG config() const; diff --git a/Util/include/Poco/Util/XMLConfiguration.h b/Util/include/Poco/Util/XMLConfiguration.h index 64fc1c57a..ae78a82f6 100644 --- a/Util/include/Poco/Util/XMLConfiguration.h +++ b/Util/include/Poco/Util/XMLConfiguration.h @@ -58,8 +58,8 @@ class Util_API XMLConfiguration: public AbstractConfiguration /// from an XML document. An XPath-like syntax for property /// names is supported to allow full access to the XML document. /// XML namespaces are not supported. The name of the root element - /// of an XML document is not significant. Periods in tag names - /// are not supported. + /// of the XML document is not significant and ignored. + /// Periods in tag names are not supported. /// /// Given the following XML document as an example: /// @@ -70,8 +70,8 @@ class Util_API XMLConfiguration: public AbstractConfiguration /// /// /// - /// value5 - /// value6 + /// value5 + /// value6 /// /// /// The following property names would be valid and would @@ -84,6 +84,8 @@ class Util_API XMLConfiguration: public AbstractConfiguration /// prop3.prop4[1][@attr] -> value4 /// prop5[0] -> value5 /// prop5[1] -> value6 + /// prop5[@id=first] -> value5 + /// prop5[@id='second'] -> value6 /// /// Enumerating attributes is not supported. /// Calling keys("prop3.prop4") will return an empty range. @@ -158,13 +160,16 @@ protected: bool getRaw(const std::string& key, std::string& value) const; void setRaw(const std::string& key, const std::string& value); void enumerate(const std::string& key, Keys& range) const; + void removeRaw(const std::string& key); ~XMLConfiguration(); private: const Poco::XML::Node* findNode(const std::string& key) const; + Poco::XML::Node* findNode(const std::string& key); static Poco::XML::Node* findNode(std::string::const_iterator& it, const std::string::const_iterator& end, Poco::XML::Node* pNode, bool create = false); static Poco::XML::Node* findElement(const std::string& name, Poco::XML::Node* pNode, bool create); static Poco::XML::Node* findElement(int index, Poco::XML::Node* pNode, bool create); + static Poco::XML::Node* findElement(const std::string& attr, const std::string& value, Poco::XML::Node* pNode); static Poco::XML::Node* findAttribute(const std::string& name, Poco::XML::Node* pNode, bool create); Poco::XML::AutoPtr _pRoot; diff --git a/Util/samples/CMakeLists.txt b/Util/samples/CMakeLists.txt index 1045759d6..62c21118e 100644 --- a/Util/samples/CMakeLists.txt +++ b/Util/samples/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory( SampleApp ) add_subdirectory( SampleServer ) add_subdirectory( Units ) +add_subdirectory( pkill ) diff --git a/Util/samples/SampleApp/SampleApp_vs100.vcxproj b/Util/samples/SampleApp/SampleApp_vs100.vcxproj new file mode 100644 index 000000000..920505ca8 --- /dev/null +++ b/Util/samples/SampleApp/SampleApp_vs100.vcxproj @@ -0,0 +1,302 @@ + + + + + debug_shared + Win32 + + + debug_static_md + Win32 + + + debug_static_mt + Win32 + + + release_shared + Win32 + + + release_static_md + Win32 + + + release_static_mt + Win32 + + + + SampleApp + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0} + SampleApp + Win32Proj + + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + bin\ + obj\$(Configuration)\ + true + bin\ + obj\$(Configuration)\ + false + bin\static_mt\ + obj\$(Configuration)\ + true + bin\static_mt\ + obj\$(Configuration)\ + false + bin\static_md\ + obj\$(Configuration)\ + true + bin\static_md\ + obj\$(Configuration)\ + false + SampleAppd + SampleAppd + SampleAppd + SampleApp + SampleApp + SampleApp + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\SampleAppd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\SampleAppd.pdb + Console + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\SampleApp.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\SampleAppd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\static_mt\SampleAppd.pdb + Console + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\SampleApp.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\SampleAppd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\static_md\SampleAppd.pdb + Console + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\SampleApp.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + + + + + + + diff --git a/Util/samples/SampleApp/SampleApp_vs100.vcxproj.filters b/Util/samples/SampleApp/SampleApp_vs100.vcxproj.filters new file mode 100644 index 000000000..3901e234c --- /dev/null +++ b/Util/samples/SampleApp/SampleApp_vs100.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + {0ab99809-86ad-4d76-97d2-8e26f6e6f1e3} + + + {700f4628-6181-4786-a214-142e56d53e2b} + + + + + Configuration Files + + + + + Source Files + + + \ No newline at end of file diff --git a/Util/samples/SampleApp/SampleApp_vs100.vcxproj.user b/Util/samples/SampleApp/SampleApp_vs100.vcxproj.user new file mode 100644 index 000000000..ace9a86ac --- /dev/null +++ b/Util/samples/SampleApp/SampleApp_vs100.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Util/samples/SampleApp/SampleApp_x64_vs100.vcxproj b/Util/samples/SampleApp/SampleApp_x64_vs100.vcxproj new file mode 100644 index 000000000..aff04e65e --- /dev/null +++ b/Util/samples/SampleApp/SampleApp_x64_vs100.vcxproj @@ -0,0 +1,302 @@ + + + + + debug_shared + x64 + + + debug_static_md + x64 + + + debug_static_mt + x64 + + + release_shared + x64 + + + release_static_md + x64 + + + release_static_mt + x64 + + + + SampleApp + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0} + SampleApp + Win32Proj + + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + bin64\ + obj64\$(Configuration)\ + true + bin64\ + obj64\$(Configuration)\ + false + bin64\static_mt\ + obj64\$(Configuration)\ + true + bin64\static_mt\ + obj64\$(Configuration)\ + false + bin64\static_md\ + obj64\$(Configuration)\ + true + bin64\static_md\ + obj64\$(Configuration)\ + false + SampleAppd + SampleAppd + SampleAppd + SampleApp + SampleApp + SampleApp + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\SampleAppd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\SampleAppd.pdb + Console + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\SampleApp.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\SampleAppd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\static_mt\SampleAppd.pdb + Console + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\SampleApp.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\SampleAppd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\static_md\SampleAppd.pdb + Console + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\SampleApp.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + + + + + + + diff --git a/Util/samples/SampleApp/SampleApp_x64_vs100.vcxproj.filters b/Util/samples/SampleApp/SampleApp_x64_vs100.vcxproj.filters new file mode 100644 index 000000000..b55929cb2 --- /dev/null +++ b/Util/samples/SampleApp/SampleApp_x64_vs100.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + {69781289-9082-4b7c-869e-50b87f61cc12} + + + {b204c0c7-3a66-4d78-a8be-63e57b7868aa} + + + + + Configuration Files + + + + + Source Files + + + \ No newline at end of file diff --git a/Util/samples/SampleApp/SampleApp_x64_vs100.vcxproj.user b/Util/samples/SampleApp/SampleApp_x64_vs100.vcxproj.user new file mode 100644 index 000000000..ace9a86ac --- /dev/null +++ b/Util/samples/SampleApp/SampleApp_x64_vs100.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Util/samples/SampleServer/SampleServer_vs100.vcxproj b/Util/samples/SampleServer/SampleServer_vs100.vcxproj new file mode 100644 index 000000000..77b089a89 --- /dev/null +++ b/Util/samples/SampleServer/SampleServer_vs100.vcxproj @@ -0,0 +1,299 @@ + + + + + debug_shared + Win32 + + + debug_static_md + Win32 + + + debug_static_mt + Win32 + + + release_shared + Win32 + + + release_static_md + Win32 + + + release_static_mt + Win32 + + + + SampleServer + {F475C5DD-0558-37AF-870B-666DE931B7BA} + SampleServer + Win32Proj + + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + bin\ + obj\$(Configuration)\ + true + bin\ + obj\$(Configuration)\ + false + bin\static_mt\ + obj\$(Configuration)\ + true + bin\static_mt\ + obj\$(Configuration)\ + false + bin\static_md\ + obj\$(Configuration)\ + true + bin\static_md\ + obj\$(Configuration)\ + false + SampleServerd + SampleServerd + SampleServerd + SampleServer + SampleServer + SampleServer + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\SampleServerd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\SampleServerd.pdb + Console + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\SampleServer.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\SampleServerd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\static_mt\SampleServerd.pdb + Console + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\SampleServer.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\SampleServerd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\static_md\SampleServerd.pdb + Console + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\SampleServer.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + + + + diff --git a/Util/samples/SampleServer/SampleServer_vs100.vcxproj.filters b/Util/samples/SampleServer/SampleServer_vs100.vcxproj.filters new file mode 100644 index 000000000..4d1f2b36b --- /dev/null +++ b/Util/samples/SampleServer/SampleServer_vs100.vcxproj.filters @@ -0,0 +1,16 @@ + + + + + {7adca311-211e-433a-b1c4-544d94fa9a52} + + + {c295c404-b19b-4b8f-808b-37c43445988b} + + + + + Source Files + + + \ No newline at end of file diff --git a/Util/samples/SampleServer/SampleServer_vs100.vcxproj.user b/Util/samples/SampleServer/SampleServer_vs100.vcxproj.user new file mode 100644 index 000000000..ace9a86ac --- /dev/null +++ b/Util/samples/SampleServer/SampleServer_vs100.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Util/samples/SampleServer/SampleServer_x64_vs100.vcxproj b/Util/samples/SampleServer/SampleServer_x64_vs100.vcxproj new file mode 100644 index 000000000..0af75b4cc --- /dev/null +++ b/Util/samples/SampleServer/SampleServer_x64_vs100.vcxproj @@ -0,0 +1,299 @@ + + + + + debug_shared + x64 + + + debug_static_md + x64 + + + debug_static_mt + x64 + + + release_shared + x64 + + + release_static_md + x64 + + + release_static_mt + x64 + + + + SampleServer + {F475C5DD-0558-37AF-870B-666DE931B7BA} + SampleServer + Win32Proj + + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + bin64\ + obj64\$(Configuration)\ + true + bin64\ + obj64\$(Configuration)\ + false + bin64\static_mt\ + obj64\$(Configuration)\ + true + bin64\static_mt\ + obj64\$(Configuration)\ + false + bin64\static_md\ + obj64\$(Configuration)\ + true + bin64\static_md\ + obj64\$(Configuration)\ + false + SampleServerd + SampleServerd + SampleServerd + SampleServer + SampleServer + SampleServer + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\SampleServerd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\SampleServerd.pdb + Console + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\SampleServer.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\SampleServerd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\static_mt\SampleServerd.pdb + Console + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\SampleServer.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\SampleServerd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\static_md\SampleServerd.pdb + Console + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\SampleServer.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + + + + diff --git a/Util/samples/SampleServer/SampleServer_x64_vs100.vcxproj.filters b/Util/samples/SampleServer/SampleServer_x64_vs100.vcxproj.filters new file mode 100644 index 000000000..b7fc78a12 --- /dev/null +++ b/Util/samples/SampleServer/SampleServer_x64_vs100.vcxproj.filters @@ -0,0 +1,16 @@ + + + + + {67e6ecdb-d3cd-4c09-be4e-7eb8f4a281c1} + + + {f54502f5-c56f-4a9f-a5ed-0324711c0f28} + + + + + Source Files + + + \ No newline at end of file diff --git a/Util/samples/SampleServer/SampleServer_x64_vs100.vcxproj.user b/Util/samples/SampleServer/SampleServer_x64_vs100.vcxproj.user new file mode 100644 index 000000000..ace9a86ac --- /dev/null +++ b/Util/samples/SampleServer/SampleServer_x64_vs100.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Util/samples/pkill/Makefile b/Util/samples/pkill/Makefile new file mode 100644 index 000000000..409746de5 --- /dev/null +++ b/Util/samples/pkill/Makefile @@ -0,0 +1,17 @@ +# +# Makefile +# +# $Id: //poco/1.4/Util/samples/pkill/Makefile#1 $ +# +# Makefile for Poco pkill utility +# + +include $(POCO_BASE)/build/rules/global + +objects = pkill + +target = pkill +target_version = 1 +target_libs = PocoUtil PocoXML PocoFoundation + +include $(POCO_BASE)/build/rules/exec diff --git a/Util/samples/pkill/pkill.progen b/Util/samples/pkill/pkill.progen new file mode 100644 index 000000000..65bd82b3d --- /dev/null +++ b/Util/samples/pkill/pkill.progen @@ -0,0 +1,12 @@ +vc.project.guid = ${vc.project.guidFromName} +vc.project.name = ${vc.project.baseName} +vc.project.target = ${vc.project.name} +vc.project.type = executable +vc.project.pocobase = ..\\..\\.. +vc.project.platforms = Win32, x64, WinCE +vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md +vc.project.prototype = ${vc.project.name}_vs90.vcproj +vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include +vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib +vc.project.linker.dependencies.x64 = ws2_32.lib iphlpapi.lib +vc.project.linker.dependencies.WinCE = ws2.lib iphlpapi.lib diff --git a/Util/samples/pkill/pkill_CE_vs90.vcproj b/Util/samples/pkill/pkill_CE_vs90.vcproj new file mode 100644 index 000000000..4ee1bbd79 --- /dev/null +++ b/Util/samples/pkill/pkill_CE_vs90.vcproj @@ -0,0 +1,466 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Util/samples/pkill/pkill_vs100.vcxproj b/Util/samples/pkill/pkill_vs100.vcxproj new file mode 100644 index 000000000..bd6e14f6d --- /dev/null +++ b/Util/samples/pkill/pkill_vs100.vcxproj @@ -0,0 +1,299 @@ + + + + + debug_shared + Win32 + + + debug_static_md + Win32 + + + debug_static_mt + Win32 + + + release_shared + Win32 + + + release_static_md + Win32 + + + release_static_mt + Win32 + + + + pkill + {63EDD785-29E1-3073-87EB-3CE788A4A1DE} + pkill + Win32Proj + + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + bin\ + obj\$(Configuration)\ + true + bin\ + obj\$(Configuration)\ + false + bin\static_mt\ + obj\$(Configuration)\ + true + bin\static_mt\ + obj\$(Configuration)\ + false + bin\static_md\ + obj\$(Configuration)\ + true + bin\static_md\ + obj\$(Configuration)\ + false + pkilld + pkilld + pkilld + pkill + pkill + pkill + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\pkilld.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\pkilld.pdb + Console + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\pkill.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\pkilld.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\static_mt\pkilld.pdb + Console + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\pkill.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\pkilld.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\static_md\pkilld.pdb + Console + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\pkill.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + + + + diff --git a/Util/samples/pkill/pkill_vs100.vcxproj.filters b/Util/samples/pkill/pkill_vs100.vcxproj.filters new file mode 100644 index 000000000..8d601920f --- /dev/null +++ b/Util/samples/pkill/pkill_vs100.vcxproj.filters @@ -0,0 +1,13 @@ + + + + + {1dd02ef4-9975-4ac1-a3a6-0df726f390d1} + + + + + Source Files + + + \ No newline at end of file diff --git a/Util/samples/pkill/pkill_vs100.vcxproj.user b/Util/samples/pkill/pkill_vs100.vcxproj.user new file mode 100644 index 000000000..ace9a86ac --- /dev/null +++ b/Util/samples/pkill/pkill_vs100.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Util/samples/pkill/pkill_vs71.vcproj b/Util/samples/pkill/pkill_vs71.vcproj new file mode 100644 index 000000000..7c044fb5c --- /dev/null +++ b/Util/samples/pkill/pkill_vs71.vcproj @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Util/samples/pkill/pkill_vs80.vcproj b/Util/samples/pkill/pkill_vs80.vcproj new file mode 100644 index 000000000..6a8d80a22 --- /dev/null +++ b/Util/samples/pkill/pkill_vs80.vcproj @@ -0,0 +1,433 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Util/samples/pkill/pkill_vs90.vcproj b/Util/samples/pkill/pkill_vs90.vcproj new file mode 100644 index 000000000..bd133040b --- /dev/null +++ b/Util/samples/pkill/pkill_vs90.vcproj @@ -0,0 +1,433 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Util/samples/pkill/pkill_x64_vs100.vcxproj b/Util/samples/pkill/pkill_x64_vs100.vcxproj new file mode 100644 index 000000000..36d49f5cc --- /dev/null +++ b/Util/samples/pkill/pkill_x64_vs100.vcxproj @@ -0,0 +1,299 @@ + + + + + debug_shared + x64 + + + debug_static_md + x64 + + + debug_static_mt + x64 + + + release_shared + x64 + + + release_static_md + x64 + + + release_static_mt + x64 + + + + pkill + {63EDD785-29E1-3073-87EB-3CE788A4A1DE} + pkill + Win32Proj + + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + bin64\ + obj64\$(Configuration)\ + true + bin64\ + obj64\$(Configuration)\ + false + bin64\static_mt\ + obj64\$(Configuration)\ + true + bin64\static_mt\ + obj64\$(Configuration)\ + false + bin64\static_md\ + obj64\$(Configuration)\ + true + bin64\static_md\ + obj64\$(Configuration)\ + false + pkilld + pkilld + pkilld + pkill + pkill + pkill + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\pkilld.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\pkilld.pdb + Console + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\pkill.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\pkilld.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\static_mt\pkilld.pdb + Console + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\pkill.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\pkilld.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\static_md\pkilld.pdb + Console + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + iphlpapi.lib;winmm.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\pkill.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + + + + diff --git a/Util/samples/pkill/pkill_x64_vs100.vcxproj.filters b/Util/samples/pkill/pkill_x64_vs100.vcxproj.filters new file mode 100644 index 000000000..26c49b341 --- /dev/null +++ b/Util/samples/pkill/pkill_x64_vs100.vcxproj.filters @@ -0,0 +1,13 @@ + + + + + {2e1359c4-cbd0-41ca-ada1-95455c90b06d} + + + + + Source Files + + + \ No newline at end of file diff --git a/Util/samples/pkill/pkill_x64_vs100.vcxproj.user b/Util/samples/pkill/pkill_x64_vs100.vcxproj.user new file mode 100644 index 000000000..ace9a86ac --- /dev/null +++ b/Util/samples/pkill/pkill_x64_vs100.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Util/samples/pkill/pkill_x64_vs90.vcproj b/Util/samples/pkill/pkill_x64_vs90.vcproj new file mode 100644 index 000000000..b64a75404 --- /dev/null +++ b/Util/samples/pkill/pkill_x64_vs90.vcproj @@ -0,0 +1,433 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Util/samples/pkill/src/pkill.cpp b/Util/samples/pkill/src/pkill.cpp new file mode 100644 index 000000000..26cc3c9f3 --- /dev/null +++ b/Util/samples/pkill/src/pkill.cpp @@ -0,0 +1,125 @@ +// +// pkill.cpp +// +// $Id: //poco/1.4/Util/samples/pkill/src/pkill.cpp#1 $ +// +// Process killer utility application. +// +// Copyright (c) 2010, 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/Util/Application.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" +#include "Poco/Process.h" +#include "Poco/NumberParser.h" +#include + + +using Poco::Util::Application; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::HelpFormatter; +using Poco::Util::OptionCallback; + + +class ProcessKillerApp: public Application +{ +public: + ProcessKillerApp(): + _helpRequested(false), + _friendly(false) + { + } + +protected: + void defineOptions(OptionSet& options) + { + Application::defineOptions(options); + + options.addOption( + Option("help", "h", "Display help information on command line arguments.") + .required(false) + .repeatable(false) + .callback(OptionCallback(this, &ProcessKillerApp::handleHelp))); + + options.addOption( + Option("friendly", "f", "Kindly ask application to shut down.") + .required(false) + .repeatable(false) + .callback(OptionCallback(this, &ProcessKillerApp::handleFriendly))); + } + + void handleHelp(const std::string& name, const std::string& value) + { + _helpRequested = true; + stopOptionsProcessing(); + } + + void handleFriendly(const std::string& name, const std::string& value) + { + _friendly = true; + } + + void displayHelp() + { + HelpFormatter helpFormatter(options()); + helpFormatter.setCommand(commandName()); + helpFormatter.setUsage("[options] ..."); + helpFormatter.setHeader("A utility application to kill processes."); + helpFormatter.setFooter("Note that the friendly option only works with applications using Poco::Util::ServerApplication::waitForTerminationRequest()."); + helpFormatter.format(std::cout); + } + + int main(const std::vector& args) + { + if (_helpRequested || args.empty()) + { + displayHelp(); + } + else + { + for (std::vector::const_iterator it = args.begin(); it != args.end(); ++it) + { + Poco::Process::PID pid = Poco::NumberParser::parseUnsigned(*it); + if (_friendly) + Poco::Process::requestTermination(pid); + else + Poco::Process::kill(pid); + } + } + return Application::EXIT_OK; + } + +private: + bool _helpRequested; + bool _friendly; +}; + + +POCO_APP_MAIN(ProcessKillerApp) diff --git a/Util/samples/samples_vs100.sln b/Util/samples/samples_vs100.sln new file mode 100644 index 000000000..4adadf7ed --- /dev/null +++ b/Util/samples/samples_vs100.sln @@ -0,0 +1,77 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pkill", "pkill\pkill_vs100.vcxproj", "{63EDD785-29E1-3073-87EB-3CE788A4A1DE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleApp", "SampleApp\SampleApp_vs100.vcxproj", "{C3F12C11-469F-3FB6-8C95-8638F78FF7C0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleServer", "SampleServer\SampleServer_vs100.vcxproj", "{F475C5DD-0558-37AF-870B-666DE931B7BA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_shared|Win32.Build.0 = release_shared|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_shared|Win32.Build.0 = release_shared|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_shared|Win32.Build.0 = release_shared|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Util/samples/samples_x64_vs100.sln b/Util/samples/samples_x64_vs100.sln new file mode 100644 index 000000000..d69cc11ce --- /dev/null +++ b/Util/samples/samples_x64_vs100.sln @@ -0,0 +1,77 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pkill", "pkill\pkill_x64_vs100.vcxproj", "{63EDD785-29E1-3073-87EB-3CE788A4A1DE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleApp", "SampleApp\SampleApp_x64_vs100.vcxproj", "{C3F12C11-469F-3FB6-8C95-8638F78FF7C0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleServer", "SampleServer\SampleServer_x64_vs100.vcxproj", "{F475C5DD-0558-37AF-870B-666DE931B7BA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_shared|x64.Build.0 = debug_shared|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_shared|x64.ActiveCfg = release_shared|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_shared|x64.Build.0 = release_shared|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_shared|x64.Deploy.0 = release_shared|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_md|x64.Build.0 = release_static_md|x64 + {63EDD785-29E1-3073-87EB-3CE788A4A1DE}.release_static_md|x64.Deploy.0 = release_static_md|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_shared|x64.Build.0 = debug_shared|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_shared|x64.ActiveCfg = release_shared|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_shared|x64.Build.0 = release_shared|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_shared|x64.Deploy.0 = release_shared|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_md|x64.Build.0 = release_static_md|x64 + {C3F12C11-469F-3FB6-8C95-8638F78FF7C0}.release_static_md|x64.Deploy.0 = release_static_md|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_shared|x64.Build.0 = debug_shared|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_shared|x64.ActiveCfg = release_shared|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_shared|x64.Build.0 = release_shared|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_shared|x64.Deploy.0 = release_shared|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_md|x64.Build.0 = release_static_md|x64 + {F475C5DD-0558-37AF-870B-666DE931B7BA}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Util/src/AbstractConfiguration.cpp b/Util/src/AbstractConfiguration.cpp index d3373a1f9..b1845aa37 100644 --- a/Util/src/AbstractConfiguration.cpp +++ b/Util/src/AbstractConfiguration.cpp @@ -79,6 +79,12 @@ bool AbstractConfiguration::hasOption(const std::string& key) const return hasProperty(key); } + +bool AbstractConfiguration::has(const std::string& key) const +{ + return hasProperty(key); +} + std::string AbstractConfiguration::getString(const std::string& key) const { @@ -202,33 +208,25 @@ bool AbstractConfiguration::getBool(const std::string& key, bool defaultValue) c void AbstractConfiguration::setString(const std::string& key, const std::string& value) { - FastMutex::ScopedLock lock(_mutex); - - setRaw(key, value); + setRawWithEvent(key, value); } void AbstractConfiguration::setInt(const std::string& key, int value) { - FastMutex::ScopedLock lock(_mutex); - - setRaw(key, NumberFormatter::format(value)); + setRawWithEvent(key, NumberFormatter::format(value)); } void AbstractConfiguration::setDouble(const std::string& key, double value) { - FastMutex::ScopedLock lock(_mutex); - - setRaw(key, NumberFormatter::format(value)); + setRawWithEvent(key, NumberFormatter::format(value)); } void AbstractConfiguration::setBool(const std::string& key, bool value) { - FastMutex::ScopedLock lock(_mutex); - - setRaw(key, value ? "true" : "false"); + setRawWithEvent(key, value ? "true" : "false"); } @@ -292,6 +290,24 @@ std::string AbstractConfiguration::expand(const std::string& value) const } +void AbstractConfiguration::remove(const std::string& key) +{ + propertyRemoving(this, key); + { + FastMutex::ScopedLock lock(_mutex); + + removeRaw(key); + } + propertyRemoved(this, key); +} + + +void AbstractConfiguration::removeRaw(const std::string& key) +{ + throw Poco::NotImplementedException("removeRaw()"); +} + + std::string AbstractConfiguration::internalExpand(const std::string& value) const { AutoCounter counter(_depth); @@ -367,4 +383,17 @@ bool AbstractConfiguration::parseBool(const std::string& value) } +void AbstractConfiguration::setRawWithEvent(const std::string& key, std::string value) +{ + KeyValue kv(key, value); + propertyChanging(this, kv); + { + FastMutex::ScopedLock lock(_mutex); + + setRaw(key, value); + } + propertyChanged(this, kv); +} + + } } // namespace Poco::Util diff --git a/Util/src/Application.cpp b/Util/src/Application.cpp index 7d3706610..43e0703a8 100644 --- a/Util/src/Application.cpp +++ b/Util/src/Application.cpp @@ -55,7 +55,7 @@ #if defined(POCO_OS_FAMILY_WINDOWS) #include "Poco/UnWindows.h" #endif -#if defined(POCO_OS_FAMILY_UNIX) +#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_VXWORKS) #include "Poco/SignalHandler.h" #endif #if defined(POCO_WIN32_UTF8) && !defined(POCO_NO_WSTRING) @@ -106,13 +106,6 @@ Application::Application(int argc, char* argv[]): Application::~Application() { - try - { - uninitialize(); - } - catch (...) - { - } _pInstance = 0; } @@ -120,16 +113,18 @@ Application::~Application() void Application::setup() { poco_assert (_pInstance == 0); - + _pConfig->add(new SystemConfiguration, PRIO_SYSTEM, false, false); _pConfig->add(new MapConfiguration, PRIO_APPLICATION, true, false); - - addSubsystem(new LoggingSubsystem); - -#if defined(POCO_OS_FAMILY_UNIX) - #if !defined(_DEBUG) - Poco::SignalHandler::install(); - #endif + + addSubsystem(new LoggingSubsystem); + +#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_VXWORKS) + _workingDirAtLaunch = Path::current(); + + #if !defined(_DEBUG) + Poco::SignalHandler::install(); + #endif #else setUnixOptions(false); #endif @@ -188,7 +183,6 @@ void Application::init() _pConfig->setString("application.dir", appPath.parent().toString()); _pConfig->setString("application.configDir", appPath.parent().toString()); processOptions(); - initialize(*this); } @@ -305,9 +299,11 @@ void Application::stopOptionsProcessing() int Application::run() { + int rc = EXIT_SOFTWARE; + initialize(*this); try { - return main(_args); + rc = main(_args); } catch (Poco::Exception& exc) { @@ -321,7 +317,8 @@ int Application::run() { logger().fatal("system exception"); } - return EXIT_SOFTWARE; + uninitialize(); + return rc; } @@ -389,26 +386,26 @@ void Application::processOptions() void Application::getApplicationPath(Poco::Path& appPath) const { -#if defined(POCO_OS_FAMILY_UNIX) +#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_VXWORKS) if (_command.find('/') != std::string::npos) { Path path(_command); if (path.isAbsolute()) { appPath = path; - } - else - { - appPath = Path::current(); - appPath.append(path); - } - } - else - { - if (!Path::find(Environment::get("PATH"), _command, appPath)) - appPath = Path(Path::current(), _command); - appPath.makeAbsolute(); - } + } + else + { + appPath = _workingDirAtLaunch; + appPath.append(path); + } + } + else + { + if (!Path::find(Environment::get("PATH"), _command, appPath)) + appPath = Path(_workingDirAtLaunch, _command); + appPath.makeAbsolute(); + } #elif defined(POCO_OS_FAMILY_WINDOWS) #if defined(POCO_WIN32_UTF8) && !defined(POCO_NO_WSTRING) wchar_t path[1024]; diff --git a/Util/src/ConfigurationMapper.cpp b/Util/src/ConfigurationMapper.cpp index 2a337052b..6deba0121 100644 --- a/Util/src/ConfigurationMapper.cpp +++ b/Util/src/ConfigurationMapper.cpp @@ -104,6 +104,13 @@ void ConfigurationMapper::enumerate(const std::string& key, Keys& range) const } +void ConfigurationMapper::removeRaw(const std::string& key) +{ + std::string translatedKey = translateKey(key); + _pConfig->remove(translatedKey); +} + + std::string ConfigurationMapper::translateKey(const std::string& key) const { std::string result(key); diff --git a/Util/src/ConfigurationView.cpp b/Util/src/ConfigurationView.cpp index ba1dfde59..3f818639d 100644 --- a/Util/src/ConfigurationView.cpp +++ b/Util/src/ConfigurationView.cpp @@ -78,10 +78,17 @@ void ConfigurationView::enumerate(const std::string& key, Keys& range) const } +void ConfigurationView::removeRaw(const std::string& key) +{ + std::string translatedKey = translateKey(key); + _pConfig->remove(translatedKey); +} + + std::string ConfigurationView::translateKey(const std::string& key) const { std::string result = _prefix; - if (!result.empty() && !key.empty()) result += '.'; + if (!result.empty() && !key.empty() && key[0] != '[') result += '.'; result += key; return result; } diff --git a/Util/src/FilesystemConfiguration.cpp b/Util/src/FilesystemConfiguration.cpp index f1af7a690..e49be7775 100644 --- a/Util/src/FilesystemConfiguration.cpp +++ b/Util/src/FilesystemConfiguration.cpp @@ -39,7 +39,6 @@ #include "Poco/Path.h" #include "Poco/DirectoryIterator.h" #include "Poco/StringTokenizer.h" -#include "Poco/Exception.h" #include "Poco/FileStream.h" @@ -47,7 +46,6 @@ using Poco::Path; using Poco::File; using Poco::DirectoryIterator; using Poco::StringTokenizer; -using Poco::NotFoundException; namespace Poco { @@ -107,7 +105,14 @@ void FilesystemConfiguration::setRaw(const std::string& key, const std::string& void FilesystemConfiguration::enumerate(const std::string& key, Keys& range) const { - DirectoryIterator it(keyToPath(key)); + Path p(keyToPath(key)); + File dir(p); + if (!dir.exists()) + { + return; + } + + DirectoryIterator it(p); DirectoryIterator end; while (it != end) { @@ -118,6 +123,17 @@ void FilesystemConfiguration::enumerate(const std::string& key, Keys& range) con } +void FilesystemConfiguration::removeRaw(const std::string& key) +{ + Path p(keyToPath(key)); + File dir(p); + if (dir.exists()) + { + dir.remove(true); + } +} + + Path FilesystemConfiguration::keyToPath(const std::string& key) const { Path result(_path); diff --git a/Util/src/IniFileConfiguration.cpp b/Util/src/IniFileConfiguration.cpp index 9c778fcae..cc11b2739 100644 --- a/Util/src/IniFileConfiguration.cpp +++ b/Util/src/IniFileConfiguration.cpp @@ -39,7 +39,7 @@ #include "Poco/String.h" #include "Poco/Path.h" #include "Poco/FileStream.h" -#include +#include "Poco/Ascii.h" #include @@ -109,7 +109,7 @@ bool IniFileConfiguration::getRaw(const std::string& key, std::string& value) co void IniFileConfiguration::setRaw(const std::string& key, const std::string& value) { - throw Poco::NotImplementedException("Setting a property in an IniFileConfiguration"); + _map[key] = value; } @@ -139,6 +139,24 @@ void IniFileConfiguration::enumerate(const std::string& key, Keys& range) const } +void IniFileConfiguration::removeRaw(const std::string& key) +{ + std::string prefix = key; + if (!prefix.empty()) prefix += '.'; + std::string::size_type psize = prefix.size(); + IStringMap::iterator it = _map.begin(); + IStringMap::iterator itCur; + while (it != _map.end()) + { + itCur = it++; + if ((icompare(itCur->first, key) == 0) || (icompare(itCur->first, psize, prefix) == 0)) + { + _map.erase(itCur); + } + } +} + + bool IniFileConfiguration::ICompare::operator () (const std::string& s1, const std::string& s2) const { return icompare(s1, s2) < 0; @@ -150,7 +168,7 @@ void IniFileConfiguration::parseLine(std::istream& istr) static const int eof = std::char_traits::eof(); int c = istr.get(); - while (c != eof && std::isspace((char) c)) c = istr.get(); + while (c != eof && Poco::Ascii::isSpace(c)) c = istr.get(); if (c != eof) { if (c == ';') diff --git a/Util/src/LayeredConfiguration.cpp b/Util/src/LayeredConfiguration.cpp index 460aa01bd..8c12390a8 100644 --- a/Util/src/LayeredConfiguration.cpp +++ b/Util/src/LayeredConfiguration.cpp @@ -120,6 +120,19 @@ void LayeredConfiguration::add(AbstractConfiguration* pConfig, int priority, boo } +void LayeredConfiguration::removeConfiguration(AbstractConfiguration* pConfig) +{ + for (ConfigList::iterator it = _configs.begin(); it != _configs.end(); ++it) + { + if (it->pConfig == pConfig) + { + _configs.erase(it); + break; + } + } +} + + bool LayeredConfiguration::getRaw(const std::string& key, std::string& value) const { for (ConfigList::const_iterator it = _configs.begin(); it != _configs.end(); ++it) @@ -164,6 +177,19 @@ void LayeredConfiguration::enumerate(const std::string& key, Keys& range) const } +void LayeredConfiguration::removeRaw(const std::string& key) +{ + for (ConfigList::iterator it = _configs.begin(); it != _configs.end(); ++it) + { + if (it->writeable) + { + it->pConfig->remove(key); + return; + } + } +} + + int LayeredConfiguration::lowest() const { if (_configs.empty()) diff --git a/Util/src/MapConfiguration.cpp b/Util/src/MapConfiguration.cpp index 53056aa6b..9dd4efca1 100644 --- a/Util/src/MapConfiguration.cpp +++ b/Util/src/MapConfiguration.cpp @@ -102,6 +102,24 @@ void MapConfiguration::enumerate(const std::string& key, Keys& range) const } +void MapConfiguration::removeRaw(const std::string& key) +{ + std::string prefix = key; + if (!prefix.empty()) prefix += '.'; + std::string::size_type psize = prefix.size(); + StringMap::iterator it = _map.begin(); + StringMap::iterator itCur; + while (it != _map.end()) + { + itCur = it++; + if ((itCur->first == key) || (itCur->first.compare(0, psize, prefix) == 0)) + { + _map.erase(itCur); + } + } +} + + MapConfiguration::iterator MapConfiguration::begin() const { return _map.begin(); diff --git a/Util/src/PropertyFileConfiguration.cpp b/Util/src/PropertyFileConfiguration.cpp index 80a7c0369..dcd73d57d 100644 --- a/Util/src/PropertyFileConfiguration.cpp +++ b/Util/src/PropertyFileConfiguration.cpp @@ -40,7 +40,7 @@ #include "Poco/Path.h" #include "Poco/FileStream.h" #include "Poco/LineEndingConverter.h" -#include +#include "Poco/Ascii.h" using Poco::trim; @@ -125,7 +125,7 @@ void PropertyFileConfiguration::parseLine(std::istream& istr) static const int eof = std::char_traits::eof(); int c = istr.get(); - while (c != eof && std::isspace((char) c)) c = istr.get(); + while (c != eof && Poco::Ascii::isSpace(c)) c = istr.get(); if (c != eof) { if (c == '#' || c == '!') diff --git a/Util/src/ServerApplication.cpp b/Util/src/ServerApplication.cpp index 3ab30d9b1..c01056bdf 100644 --- a/Util/src/ServerApplication.cpp +++ b/Util/src/ServerApplication.cpp @@ -37,12 +37,16 @@ #include "Poco/Util/ServerApplication.h" #include "Poco/Util/Option.h" #include "Poco/Util/OptionSet.h" +#include "Poco/Util/OptionException.h" #include "Poco/Exception.h" +#if !defined(POCO_VXWORKS) #include "Poco/Process.h" -#include "Poco/NumberFormatter.h" #include "Poco/NamedEvent.h" +#endif +#include "Poco/NumberFormatter.h" #include "Poco/Logger.h" -#if defined(POCO_OS_FAMILY_UNIX) +#include "Poco/String.h" +#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_VXWORKS) #include "Poco/TemporaryFile.h" #include #include @@ -51,7 +55,10 @@ #include #include #elif defined(POCO_OS_FAMILY_WINDOWS) +#if !defined(_WIN32_WCE) #include "Poco/Util/WinService.h" +#include "Poco/Util/WinRegistryKey.h" +#endif #include "Poco/UnWindows.h" #include #endif @@ -60,8 +67,6 @@ #endif -using Poco::NamedEvent; -using Poco::Process; using Poco::NumberFormatter; using Poco::Exception; using Poco::SystemException; @@ -72,18 +77,26 @@ namespace Util { #if defined(POCO_OS_FAMILY_WINDOWS) +Poco::NamedEvent ServerApplication::_terminate(Poco::ProcessImpl::terminationEventName(Poco::Process::id())); +#if !defined(_WIN32_WCE) Poco::Event ServerApplication::_terminated; SERVICE_STATUS ServerApplication::_serviceStatus; SERVICE_STATUS_HANDLE ServerApplication::_serviceStatusHandle = 0; #endif +#endif +#if defined(POCO_VXWORKS) +Poco::Event ServerApplication::_terminate; +#endif ServerApplication::ServerApplication() { #if defined(POCO_OS_FAMILY_WINDOWS) +#if !defined(_WIN32_WCE) _action = SRV_RUN; std::memset(&_serviceStatus, 0, sizeof(_serviceStatus)); #endif +#endif } @@ -107,11 +120,18 @@ int ServerApplication::run() void ServerApplication::terminate() { - Process::requestTermination(Process::id()); +#if defined(POCO_OS_FAMILY_WINDOWS) + _terminate.set(); +#elif defined(POCO_VXWORKS) + _terminate.set(); +#else + Poco::Process::requestTermination(Process::id()); +#endif } #if defined(POCO_OS_FAMILY_WINDOWS) +#if !defined(_WIN32_WCE) // @@ -207,13 +227,6 @@ void ServerApplication::ServiceMain(DWORD argc, LPTSTR* argv) _serviceStatus.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR; _serviceStatus.dwServiceSpecificExitCode = EXIT_SOFTWARE; } - try - { - app.uninitialize(); - } - catch (...) - { - } _serviceStatus.dwCurrentState = SERVICE_STOPPED; SetServiceStatus(_serviceStatusHandle, &_serviceStatus); } @@ -222,10 +235,7 @@ void ServerApplication::ServiceMain(DWORD argc, LPTSTR* argv) void ServerApplication::waitForTerminationRequest() { SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE); - std::string evName("POCOTRM"); - NumberFormatter::appendHex(evName, Process::id(), 8); - NamedEvent ev(evName); - ev.wait(); + _terminate.wait(); _terminated.set(); } @@ -254,7 +264,42 @@ int ServerApplication::run(int argc, char** argv) break; default: rc = run(); - uninitialize(); + } + } + catch (Exception& exc) + { + logger().log(exc); + rc = EXIT_SOFTWARE; + } + return rc; + } +} + + +int ServerApplication::run(const std::vector& args) +{ + if (!hasConsole() && isService()) + { + return 0; + } + else + { + int rc = EXIT_OK; + try + { + init(args); + switch (_action) + { + case SRV_REGISTER: + registerService(); + rc = EXIT_OK; + break; + case SRV_UNREGISTER: + unregisterService(); + rc = EXIT_OK; + break; + default: + rc = run(); } } catch (Exception& exc) @@ -292,7 +337,6 @@ int ServerApplication::run(int argc, wchar_t** argv) break; default: rc = run(); - uninitialize(); } } catch (Exception& exc) @@ -329,7 +373,7 @@ bool ServerApplication::isService() bool ServerApplication::hasConsole() { HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); - return hStdOut != INVALID_HANDLE_VALUE && hStdOut != NULL; + return hStdOut != INVALID_HANDLE_VALUE && hStdOut != NULL; } @@ -343,7 +387,13 @@ void ServerApplication::registerService() service.registerService(path); else service.registerService(path, _displayName); - logger().information("The application has been successfully registered as a service"); + if (_startup == "auto") + service.setStartup(WinService::SVC_AUTO_START); + else if (_startup == "manual") + service.setStartup(WinService::SVC_MANUAL_START); + if (!_description.empty()) + service.setDescription(_description); + logger().information("The application has been successfully registered as a service."); } @@ -353,7 +403,7 @@ void ServerApplication::unregisterService() WinService service(name); service.unregisterService(); - logger().information("The service has been successfully unregistered"); + logger().information("The service has been successfully unregistered."); } @@ -362,33 +412,203 @@ void ServerApplication::defineOptions(OptionSet& options) Application::defineOptions(options); options.addOption( - Option("registerService", "", "register application as a service") - .required(false) - .repeatable(false)); - - options.addOption( - Option("unregisterService", "", "unregister application as a service") - .required(false) - .repeatable(false)); - - options.addOption( - Option("displayName", "", "specify a display name for the service (only with /registerService)") + Option("registerService", "", "Register the application as a service.") .required(false) .repeatable(false) - .argument("name")); + .callback(OptionCallback(this, &ServerApplication::handleRegisterService))); + + options.addOption( + Option("unregisterService", "", "Unregister the application as a service.") + .required(false) + .repeatable(false) + .callback(OptionCallback(this, &ServerApplication::handleUnregisterService))); + + options.addOption( + Option("displayName", "", "Specify a display name for the service (only with /registerService).") + .required(false) + .repeatable(false) + .argument("name") + .callback(OptionCallback(this, &ServerApplication::handleDisplayName))); + + options.addOption( + Option("description", "", "Specify a description for the service (only with /registerService).") + .required(false) + .repeatable(false) + .argument("text") + .callback(OptionCallback(this, &ServerApplication::handleDescription))); + + options.addOption( + Option("startup", "", "Specify the startup mode for the service (only with /registerService).") + .required(false) + .repeatable(false) + .argument("automatic|manual") + .callback(OptionCallback(this, &ServerApplication::handleStartup))); } -void ServerApplication::handleOption(const std::string& name, const std::string& value) +void ServerApplication::handleRegisterService(const std::string& name, const std::string& value) { - if (name == "registerService") - _action = SRV_REGISTER; - else if (name == "unregisterService") - _action = SRV_UNREGISTER; - else if (name == "displayName") - _displayName = value; + _action = SRV_REGISTER; +} + + +void ServerApplication::handleUnregisterService(const std::string& name, const std::string& value) +{ + _action = SRV_UNREGISTER; +} + + +void ServerApplication::handleDisplayName(const std::string& name, const std::string& value) +{ + _displayName = value; +} + + +void ServerApplication::handleDescription(const std::string& name, const std::string& value) +{ + _description = value; +} + + +void ServerApplication::handleStartup(const std::string& name, const std::string& value) +{ + if (Poco::icompare(value, 4, std::string("auto")) == 0) + _startup = "auto"; + else if (Poco::icompare(value, std::string("manual")) == 0) + _startup = "manual"; else - Application::handleOption(name, value); + throw InvalidArgumentException("argument to startup option must be 'auto[matic]' or 'manual'"); +} + + +#else // _WIN32_WCE +void ServerApplication::waitForTerminationRequest() +{ + _terminate.wait(); +} + + +int ServerApplication::run(int argc, char** argv) +{ + try + { + init(argc, argv); + } + catch (Exception& exc) + { + logger().log(exc); + return EXIT_CONFIG; + } + int rc = run(); + try + { + uninitialize(); + } + catch (Exception& exc) + { + logger().log(exc); + rc = EXIT_CONFIG; + } + return rc; +} + + +int ServerApplication::run(const std::vector& args) +{ + try + { + init(args); + } + catch (Exception& exc) + { + logger().log(exc); + return EXIT_CONFIG; + } + int rc = run(); + try + { + uninitialize(); + } + catch (Exception& exc) + { + logger().log(exc); + rc = EXIT_CONFIG; + } + return rc; +} + + +#if defined(POCO_WIN32_UTF8) && !defined(POCO_NO_WSTRING) +int ServerApplication::run(int argc, wchar_t** argv) +{ + try + { + init(argc, argv); + } + catch (Exception& exc) + { + logger().log(exc); + return EXIT_CONFIG; + } + int rc = run(); + try + { + uninitialize(); + } + catch (Exception& exc) + { + logger().log(exc); + rc = EXIT_CONFIG; + } + return rc; +} +#endif + + +#endif // _WIN32_WCE +#elif defined(POCO_VXWORKS) +// +// VxWorks specific code +// +void ServerApplication::waitForTerminationRequest() +{ + _terminate.wait(); +} + + +int ServerApplication::run(int argc, char** argv) +{ + try + { + init(argc, argv); + } + catch (Exception& exc) + { + logger().log(exc); + return EXIT_CONFIG; + } + return run(); +} + + +int ServerApplication::run(const std::vector& args) +{ + try + { + init(args); + } + catch (Exception& exc) + { + logger().log(exc); + return EXIT_CONFIG; + } + return run(); +} + + +void ServerApplication::defineOptions(OptionSet& options) +{ + Application::defineOptions(options); } @@ -402,7 +622,10 @@ void ServerApplication::waitForTerminationRequest() { sigset_t sset; sigemptyset(&sset); - sigaddset(&sset, SIGINT); + if (!std::getenv("POCO_ENABLE_DEBUGGER")) + { + sigaddset(&sset, SIGINT); + } sigaddset(&sset, SIGQUIT); sigaddset(&sset, SIGTERM); sigprocmask(SIG_BLOCK, &sset, NULL); @@ -432,17 +655,40 @@ int ServerApplication::run(int argc, char** argv) logger().log(exc); return EXIT_CONFIG; } - int rc = run(); + return run(); +} + + +int ServerApplication::run(const std::vector& args) +{ + bool runAsDaemon = false; + for (std::vector::const_iterator it = args.begin(); it != args.end(); ++it) + { + if (*it == "--daemon") + { + runAsDaemon = true; + break; + } + } + if (runAsDaemon) + { + beDaemon(); + } try { - uninitialize(); + init(args); + if (runAsDaemon) + { + int rc = chdir("/"); + if (rc != 0) return EXIT_OSERR; + } } catch (Exception& exc) { logger().log(exc); - rc = EXIT_CONFIG; + return EXIT_CONFIG; } - return rc; + return run(); } @@ -487,34 +733,34 @@ void ServerApplication::defineOptions(OptionSet& options) Application::defineOptions(options); options.addOption( - Option("daemon", "", "run application as a daemon") - .required(false) - .repeatable(false)); - - options.addOption( - Option("pidfile", "", "write PID to given file") + Option("daemon", "", "Run application as a daemon.") .required(false) .repeatable(false) - .argument("path")); + .callback(OptionCallback(this, &ServerApplication::handleDaemon))); + + options.addOption( + Option("pidfile", "", "Write the process ID of the application to given file.") + .required(false) + .repeatable(false) + .argument("path") + .callback(OptionCallback(this, &ServerApplication::handlePidFile))); } -void ServerApplication::handleOption(const std::string& name, const std::string& value) +void ServerApplication::handleDaemon(const std::string& name, const std::string& value) { - if (name == "daemon") - { - config().setBool("application.runAsDaemon", true); - } - else if (name == "pidfile") - { - std::ofstream ostr(value.c_str()); - if (ostr.good()) - ostr << Poco::Process::id() << std::endl; - else - throw Poco::CreateFileException("Cannot write PID to file", value); - Poco::TemporaryFile::registerForDeletion(value); - } - else Application::handleOption(name, value); + config().setBool("application.runAsDaemon", true); +} + + +void ServerApplication::handlePidFile(const std::string& name, const std::string& value) +{ + std::ofstream ostr(value.c_str()); + if (ostr.good()) + ostr << Poco::Process::id() << std::endl; + else + throw Poco::CreateFileException("Cannot write PID to file", value); + Poco::TemporaryFile::registerForDeletion(value); } @@ -552,8 +798,8 @@ void ServerApplication::waitForTerminationRequest() sys$qiow(0, ioChan, IO$_SETMODE | IO$M_CTRLCAST, 0, 0, 0, terminate, 0, 0, 0, 0, 0); std::string evName("POCOTRM"); - NumberFormatter::appendHex(evName, Process::id(), 8); - NamedEvent ev(evName); + NumberFormatter::appendHex(evName, Poco::Process::id(), 8); + Poco::NamedEvent ev(evName); try { ev.wait(); @@ -578,17 +824,22 @@ int ServerApplication::run(int argc, char** argv) logger().log(exc); return EXIT_CONFIG; } - int rc = run(); + return run(); +} + + +int ServerApplication::run(const std::vector& args) +{ try { - uninitialize(); + init(args); } catch (Exception& exc) { logger().log(exc); - rc = EXIT_CONFIG; + return EXIT_CONFIG; } - return rc; + return run(); } @@ -598,12 +849,6 @@ void ServerApplication::defineOptions(OptionSet& options) } -void ServerApplication::handleOption(const std::string& name, const std::string& value) -{ - Application::handleOption(name, value); -} - - #endif diff --git a/Util/src/SystemConfiguration.cpp b/Util/src/SystemConfiguration.cpp index ea39418d0..f81e749c6 100644 --- a/Util/src/SystemConfiguration.cpp +++ b/Util/src/SystemConfiguration.cpp @@ -41,8 +41,11 @@ #include "Poco/DateTimeFormatter.h" #include "Poco/DateTimeFormat.h" #include "Poco/NumberFormatter.h" +#if !defined(POCO_VXWORKS) #include "Poco/Process.h" +#endif #include "Poco/Exception.h" +#include using Poco::Environment; @@ -57,11 +60,14 @@ const std::string SystemConfiguration::OSNAME = "system.osName"; const std::string SystemConfiguration::OSVERSION = "system.osVersion"; const std::string SystemConfiguration::OSARCHITECTURE = "system.osArchitecture"; const std::string SystemConfiguration::NODENAME = "system.nodeName"; +const std::string SystemConfiguration::NODEID = "system.nodeId"; const std::string SystemConfiguration::CURRENTDIR = "system.currentDir"; const std::string SystemConfiguration::HOMEDIR = "system.homeDir"; const std::string SystemConfiguration::TEMPDIR = "system.tempDir"; const std::string SystemConfiguration::DATETIME = "system.dateTime"; +#if !defined(POCO_VXWORKS) const std::string SystemConfiguration::PID = "system.pid"; +#endif const std::string SystemConfiguration::ENV = "system.env."; @@ -78,27 +84,70 @@ SystemConfiguration::~SystemConfiguration() bool SystemConfiguration::getRaw(const std::string& key, std::string& value) const { if (key == OSNAME) + { value = Environment::osName(); + } else if (key == OSVERSION) + { value = Environment::osVersion(); + } else if (key == OSARCHITECTURE) + { value = Environment::osArchitecture(); + } else if (key == NODENAME) + { value = Environment::nodeName(); + } + else if (key == NODEID) + { + try + { + Poco::Environment::NodeId id; + Poco::Environment::nodeId(id); + char result[13]; + std::sprintf(result, "%02x%02x%02x%02x%02x%02x", + id[0], + id[1], + id[2], + id[3], + id[4], + id[5]); + value = result; + } + catch (...) + { + value = "000000000000"; + } + } else if (key == CURRENTDIR) + { value = Path::current(); + } else if (key == HOMEDIR) + { value = Path::home(); + } else if (key == TEMPDIR) + { value = Path::temp(); + } else if (key == DATETIME) + { value = Poco::DateTimeFormatter::format(Poco::DateTime(), Poco::DateTimeFormat::ISO8601_FORMAT); + } +#if !defined(POCO_VXWORKS) else if (key == PID) + { + value = "0"; value = Poco::NumberFormatter::format(Poco::Process::id()); + } +#endif else if (key.compare(0, ENV.size(), ENV) == 0) + { return getEnv(key.substr(ENV.size()), value); - else - return false; + } + else return false; return true; } @@ -121,16 +170,25 @@ void SystemConfiguration::enumerate(const std::string& key, Keys& range) const range.push_back("osVersion"); range.push_back("osArchitecture"); range.push_back("nodeName"); + range.push_back("nodeId"); range.push_back("currentDir"); range.push_back("homeDir"); range.push_back("tempDir"); range.push_back("dateTime"); +#if !defined(POCO_VXWORKS) range.push_back("pid"); +#endif range.push_back("env"); } } +void SystemConfiguration::removeRaw(const std::string& key) +{ + throw Poco::NotImplementedException("Removing a key in a SystemConfiguration"); +} + + bool SystemConfiguration::getEnv(const std::string& name, std::string& value) { if (Environment::has(name)) diff --git a/Util/src/Timer.cpp b/Util/src/Timer.cpp index be2ede65a..85e52e9b4 100644 --- a/Util/src/Timer.cpp +++ b/Util/src/Timer.cpp @@ -1,298 +1,316 @@ -// -// Timer.cpp -// -// $Id: //poco/Main/Util/src/Timer.cpp#2 $ -// -// Library: Util -// Package: Timer -// Module: Timer -// -// Copyright (c) 2009, 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/Util/Timer.h" -#include "Poco/Notification.h" -#include "Poco/ErrorHandler.h" - - -using Poco::ErrorHandler; - - -namespace Poco { -namespace Util { - - -class TimerNotification: public Poco::Notification -{ -public: - TimerNotification(Poco::TimedNotificationQueue& queue): - _queue(queue) - { - } - - ~TimerNotification() - { - } - - virtual bool execute() = 0; - - Poco::TimedNotificationQueue& queue() - { - return _queue; - } - -private: - Poco::TimedNotificationQueue& _queue; -}; - - -class StopNotification: public TimerNotification -{ -public: - StopNotification(Poco::TimedNotificationQueue& queue): - TimerNotification(queue) - { - } - - ~StopNotification() - { - } - - bool execute() - { - queue().clear(); - return false; - } -}; - - -class CancelNotification: public TimerNotification -{ -public: - CancelNotification(Poco::TimedNotificationQueue& queue): - TimerNotification(queue) - { - } - - ~CancelNotification() - { - } - - bool execute() - { - queue().clear(); - return true; - } -}; - - -class TaskNotification: public TimerNotification -{ -public: - TaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask): - TimerNotification(queue), - _pTask(pTask) - { - } - - ~TaskNotification() - { - } - - TimerTask::Ptr task() - { - return _pTask; - } - - bool execute() - { - if (!_pTask->isCancelled()) - { - try - { - _pTask->_lastExecution.update(); - _pTask->run(); - } - catch (Exception& exc) - { - ErrorHandler::handle(exc); - } - catch (std::exception& exc) - { - ErrorHandler::handle(exc); - } - catch (...) - { - ErrorHandler::handle(); - } - } - return true; - } - -private: - TimerTask::Ptr _pTask; -}; - - -class PeriodicTaskNotification: public TaskNotification -{ -public: - PeriodicTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval): - TaskNotification(queue, pTask), - _interval(interval) - { - } - - ~PeriodicTaskNotification() - { - } - - bool execute() - { - TaskNotification::execute(); - - if (!task()->isCancelled()) - { - Poco::Timestamp nextExecution; - nextExecution += static_cast(_interval)*1000; - queue().enqueueNotification(this, nextExecution); - duplicate(); - } - return true; - } - -private: - long _interval; -}; - - -class FixedRateTaskNotification: public TaskNotification -{ -public: - FixedRateTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval): - TaskNotification(queue, pTask), - _interval(interval) - { - } - - ~FixedRateTaskNotification() - { - } - - bool execute() - { - TaskNotification::execute(); - - if (!task()->isCancelled()) - { - Poco::Timestamp nextExecution(task()->lastExecution()); - nextExecution += static_cast(_interval)*1000; - queue().enqueueNotification(this, nextExecution); - duplicate(); - } - return true; - } - -private: - long _interval; -}; - - -Timer::Timer() -{ - _thread.start(*this); -} - - -Timer::Timer(Poco::Thread::Priority priority) -{ - _thread.setPriority(priority); - _thread.start(*this); -} - - -Timer::~Timer() -{ - Poco::Timestamp now; - _queue.enqueueNotification(new StopNotification(_queue), now); - _thread.join(); -} - - -void Timer::cancel() -{ - Poco::Timestamp now; - _queue.enqueueNotification(new CancelNotification(_queue), now); -} - - -void Timer::schedule(TimerTask::Ptr pTask, Poco::Timestamp time) -{ - _queue.enqueueNotification(new TaskNotification(_queue, pTask), time); -} - - -void Timer::schedule(TimerTask::Ptr pTask, long delay, long interval) -{ - Poco::Timestamp time; - time += static_cast(delay)*1000; - schedule(pTask, time, interval); -} - - -void Timer::schedule(TimerTask::Ptr pTask, Poco::Timestamp time, long interval) -{ - _queue.enqueueNotification(new PeriodicTaskNotification(_queue, pTask, interval), time); -} - - -void Timer::scheduleAtFixedRate(TimerTask::Ptr pTask, long delay, long interval) -{ - Poco::Timestamp time; - time += static_cast(delay)*1000; - scheduleAtFixedRate(pTask, time, interval); -} - - -void Timer::scheduleAtFixedRate(TimerTask::Ptr pTask, Poco::Timestamp time, long interval) -{ - _queue.enqueueNotification(new FixedRateTaskNotification(_queue, pTask, interval), time); -} - - -void Timer::run() -{ - bool cont = true; - while (cont) - { - Poco::AutoPtr pNf = static_cast(_queue.waitDequeueNotification()); - cont = pNf->execute(); - } -} - - -} } // namespace Poco::Util +// +// Timer.cpp +// +// $Id: //poco/1.4/Util/src/Timer.cpp#1 $ +// +// Library: Util +// Package: Timer +// Module: Timer +// +// Copyright (c) 2009, 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/Util/Timer.h" +#include "Poco/Notification.h" +#include "Poco/ErrorHandler.h" +#include "Poco/Event.h" + + +using Poco::ErrorHandler; + + +namespace Poco { +namespace Util { + + +class TimerNotification: public Poco::Notification +{ +public: + TimerNotification(Poco::TimedNotificationQueue& queue): + _queue(queue) + { + } + + ~TimerNotification() + { + } + + virtual bool execute() = 0; + + Poco::TimedNotificationQueue& queue() + { + return _queue; + } + +private: + Poco::TimedNotificationQueue& _queue; +}; + + +class StopNotification: public TimerNotification +{ +public: + StopNotification(Poco::TimedNotificationQueue& queue): + TimerNotification(queue) + { + } + + ~StopNotification() + { + } + + bool execute() + { + queue().clear(); + return false; + } +}; + + +class CancelNotification: public TimerNotification +{ +public: + CancelNotification(Poco::TimedNotificationQueue& queue): + TimerNotification(queue) + { + } + + ~CancelNotification() + { + } + + bool execute() + { + queue().clear(); + _finished.set(); + return true; + } + + void wait() + { + _finished.wait(); + } + +private: + Poco::Event _finished; +}; + + +class TaskNotification: public TimerNotification +{ +public: + TaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask): + TimerNotification(queue), + _pTask(pTask) + { + } + + ~TaskNotification() + { + } + + TimerTask::Ptr task() + { + return _pTask; + } + + bool execute() + { + if (!_pTask->isCancelled()) + { + try + { + _pTask->_lastExecution.update(); + _pTask->run(); + } + catch (Exception& exc) + { + ErrorHandler::handle(exc); + } + catch (std::exception& exc) + { + ErrorHandler::handle(exc); + } + catch (...) + { + ErrorHandler::handle(); + } + } + return true; + } + +private: + TimerTask::Ptr _pTask; +}; + + +class PeriodicTaskNotification: public TaskNotification +{ +public: + PeriodicTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval): + TaskNotification(queue, pTask), + _interval(interval) + { + } + + ~PeriodicTaskNotification() + { + } + + bool execute() + { + TaskNotification::execute(); + + if (!task()->isCancelled()) + { + Poco::Timestamp now; + Poco::Timestamp nextExecution; + nextExecution += static_cast(_interval)*1000; + if (nextExecution < now) nextExecution = now; + queue().enqueueNotification(this, nextExecution); + duplicate(); + } + return true; + } + +private: + long _interval; +}; + + +class FixedRateTaskNotification: public TaskNotification +{ +public: + FixedRateTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval, Poco::Timestamp time): + TaskNotification(queue, pTask), + _interval(interval), + _nextExecution(time) + { + } + + ~FixedRateTaskNotification() + { + } + + bool execute() + { + TaskNotification::execute(); + + if (!task()->isCancelled()) + { + Poco::Timestamp now; + _nextExecution += static_cast(_interval)*1000; + if (_nextExecution < now) _nextExecution = now; + queue().enqueueNotification(this, _nextExecution); + duplicate(); + } + return true; + } + +private: + long _interval; + Poco::Timestamp _nextExecution; +}; + + +Timer::Timer() +{ + _thread.start(*this); +} + + +Timer::Timer(Poco::Thread::Priority priority) +{ + _thread.setPriority(priority); + _thread.start(*this); +} + + +Timer::~Timer() +{ + _queue.enqueueNotification(new StopNotification(_queue), 0); + _thread.join(); +} + + +void Timer::cancel(bool wait) +{ + Poco::AutoPtr pNf = new CancelNotification(_queue); + _queue.enqueueNotification(pNf, 0); + if (wait) + { + pNf->wait(); + } +} + + +void Timer::schedule(TimerTask::Ptr pTask, Poco::Timestamp time) +{ + _queue.enqueueNotification(new TaskNotification(_queue, pTask), time); +} + + +void Timer::schedule(TimerTask::Ptr pTask, long delay, long interval) +{ + Poco::Timestamp time; + time += static_cast(delay)*1000; + schedule(pTask, time, interval); +} + + +void Timer::schedule(TimerTask::Ptr pTask, Poco::Timestamp time, long interval) +{ + _queue.enqueueNotification(new PeriodicTaskNotification(_queue, pTask, interval), time); +} + + +void Timer::scheduleAtFixedRate(TimerTask::Ptr pTask, long delay, long interval) +{ + Poco::Timestamp time; + time += static_cast(delay)*1000; + scheduleAtFixedRate(pTask, time, interval); +} + + +void Timer::scheduleAtFixedRate(TimerTask::Ptr pTask, Poco::Timestamp time, long interval) +{ + _queue.enqueueNotification(new FixedRateTaskNotification(_queue, pTask, interval, time), time); +} + + +void Timer::run() +{ + bool cont = true; + while (cont) + { + Poco::AutoPtr pNf = static_cast(_queue.waitDequeueNotification()); + cont = pNf->execute(); + } +} + + +} } // namespace Poco::Util diff --git a/Util/src/TimerTask.cpp b/Util/src/TimerTask.cpp index 906e4cc8e..66eab0979 100644 --- a/Util/src/TimerTask.cpp +++ b/Util/src/TimerTask.cpp @@ -1,62 +1,62 @@ -// -// TimerTask.cpp -// -// $Id: //poco/Main/Util/src/TimerTask.cpp#1 $ -// -// Library: Util -// Package: Timer -// Module: TimerTask -// -// Copyright (c) 2009, 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/Util/TimerTask.h" - - -namespace Poco { -namespace Util { - - -TimerTask::TimerTask(): - _lastExecution(0), - _isCancelled(false) -{ -} - - -TimerTask::~TimerTask() -{ -} - - -void TimerTask::cancel() -{ - _isCancelled = true; -} - - -} } // namespace Poco::Util +// +// TimerTask.cpp +// +// $Id: //poco/1.4/Util/src/TimerTask.cpp#1 $ +// +// Library: Util +// Package: Timer +// Module: TimerTask +// +// Copyright (c) 2009, 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/Util/TimerTask.h" + + +namespace Poco { +namespace Util { + + +TimerTask::TimerTask(): + _lastExecution(0), + _isCancelled(false) +{ +} + + +TimerTask::~TimerTask() +{ +} + + +void TimerTask::cancel() +{ + _isCancelled = true; +} + + +} } // namespace Poco::Util diff --git a/Util/src/WinRegistryConfiguration.cpp b/Util/src/WinRegistryConfiguration.cpp index 46798a2df..3f2896bd8 100644 --- a/Util/src/WinRegistryConfiguration.cpp +++ b/Util/src/WinRegistryConfiguration.cpp @@ -38,6 +38,7 @@ #include "Poco/Util/WinRegistryKey.h" #include "Poco/NumberFormatter.h" #include "Poco/NumberParser.h" +#include "Poco/Exception.h" namespace Poco { @@ -119,6 +120,12 @@ void WinRegistryConfiguration::enumerate(const std::string& key, Keys& range) co } +void WinRegistryConfiguration::removeRaw(const std::string& key) +{ + throw Poco::NotImplementedException("Removing a key in a WinRegistryConfiguration"); +} + + std::string WinRegistryConfiguration::ConvertToRegFormat(const std::string& key, std::string& value) const { std::size_t pos = key.rfind('.'); diff --git a/Util/src/WinRegistryKey.cpp b/Util/src/WinRegistryKey.cpp index 38bf6b9d1..f3289fd57 100644 --- a/Util/src/WinRegistryKey.cpp +++ b/Util/src/WinRegistryKey.cpp @@ -50,9 +50,10 @@ namespace Poco { namespace Util { -WinRegistryKey::WinRegistryKey(const std::string& key, bool readOnly): +WinRegistryKey::WinRegistryKey(const std::string& key, bool readOnly, REGSAM extraSam): _hKey(0), - _readOnly(readOnly) + _readOnly(readOnly), + _extraSam(extraSam) { std::string::size_type pos = key.find('\\'); if (pos != std::string::npos) @@ -65,11 +66,12 @@ WinRegistryKey::WinRegistryKey(const std::string& key, bool readOnly): } -WinRegistryKey::WinRegistryKey(HKEY hRootKey, const std::string& subKey, bool readOnly): +WinRegistryKey::WinRegistryKey(HKEY hRootKey, const std::string& subKey, bool readOnly, REGSAM extraSam): _hRootKey(hRootKey), _subKey(subKey), _hKey(0), - _readOnly(readOnly) + _readOnly(readOnly), + _extraSam(extraSam) { } @@ -222,7 +224,7 @@ int WinRegistryKey::getInt(const std::string& name) open(); DWORD type; DWORD data; - DWORD size; + DWORD size = sizeof(data); #if defined(POCO_WIN32_UTF8) std::wstring uname; Poco::UnicodeConverter::toUTF16(name, uname); @@ -282,13 +284,13 @@ bool WinRegistryKey::exists() #if defined(POCO_WIN32_UTF8) std::wstring usubKey; Poco::UnicodeConverter::toUTF16(_subKey, usubKey); - if (RegOpenKeyExW(_hRootKey, usubKey.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyExW(_hRootKey, usubKey.c_str(), 0, KEY_READ | _extraSam, &hKey) == ERROR_SUCCESS) { RegCloseKey(hKey); return true; } #else - if (RegOpenKeyEx(_hRootKey, _subKey.c_str(), 0, KEY_READ, &hKey) != ERROR_SUCCESS) + if (RegOpenKeyEx(_hRootKey, _subKey.c_str(), 0, KEY_READ | _extraSam, &hKey) != ERROR_SUCCESS) { RegCloseKey(hKey); return true; @@ -327,7 +329,7 @@ bool WinRegistryKey::exists(const std::string& name) #if defined(POCO_WIN32_UTF8) std::wstring usubKey; Poco::UnicodeConverter::toUTF16(_subKey, usubKey); - if (RegOpenKeyExW(_hRootKey, usubKey.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyExW(_hRootKey, usubKey.c_str(), 0, KEY_READ | _extraSam, &hKey) == ERROR_SUCCESS) { std::wstring uname; Poco::UnicodeConverter::toUTF16(name, uname); @@ -335,7 +337,7 @@ bool WinRegistryKey::exists(const std::string& name) RegCloseKey(hKey); } #else - if (RegOpenKeyEx(_hRootKey, _subKey.c_str(), 0, KEY_READ, &hKey) != ERROR_SUCCESS) + if (RegOpenKeyEx(_hRootKey, _subKey.c_str(), 0, KEY_READ | _extraSam, &hKey) != ERROR_SUCCESS) { exists = RegQueryValueEx(hKey, name.c_str(), NULL, NULL, NULL, NULL) == ERROR_SUCCESS; RegCloseKey(hKey); @@ -354,23 +356,23 @@ void WinRegistryKey::open() Poco::UnicodeConverter::toUTF16(_subKey, usubKey); if (_readOnly) { - if (RegOpenKeyExW(_hRootKey, usubKey.c_str(), 0, KEY_READ, &_hKey) != ERROR_SUCCESS) + if (RegOpenKeyExW(_hRootKey, usubKey.c_str(), 0, KEY_READ | _extraSam, &_hKey) != ERROR_SUCCESS) throw NotFoundException("Cannot open registry key: ", key()); } else { - if (RegCreateKeyExW(_hRootKey, usubKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &_hKey, NULL) != ERROR_SUCCESS) + if (RegCreateKeyExW(_hRootKey, usubKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE | _extraSam, NULL, &_hKey, NULL) != ERROR_SUCCESS) throw SystemException("Cannot open registry key: ", key()); } #else if (_readOnly) { - if (RegOpenKeyEx(_hRootKey, _subKey.c_str(), 0, KEY_READ, &_hKey) != ERROR_SUCCESS) + if (RegOpenKeyEx(_hRootKey, _subKey.c_str(), 0, KEY_READ | _extraSam, &_hKey) != ERROR_SUCCESS) throw NotFoundException("Cannot open registry key: ", key()); } else { - if (RegCreateKeyEx(_hRootKey, _subKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &_hKey, NULL) != ERROR_SUCCESS) + if (RegCreateKeyEx(_hRootKey, _subKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE | _extraSam, NULL, &_hKey, NULL) != ERROR_SUCCESS) throw SystemException("Cannot open registry key: ", key()); } #endif diff --git a/Util/src/WinService.cpp b/Util/src/WinService.cpp index b68eb7a25..cdb9386a0 100644 --- a/Util/src/WinService.cpp +++ b/Util/src/WinService.cpp @@ -35,6 +35,7 @@ #include "Poco/Util/WinService.h" +#include "Poco/Util/WinRegistryKey.h" #include "Poco/Thread.h" #include "Poco/Exception.h" #if defined(POCO_WIN32_UTF8) @@ -53,6 +54,8 @@ namespace Util { const int WinService::STARTUP_TIMEOUT = 30000; +const std::string WinService::REGISTRY_KEY("SYSTEM\\CurrentControlSet\\Services\\"); +const std::string WinService::REGISTRY_DESCRIPTION("Description"); WinService::WinService(const std::string& name): @@ -256,9 +259,27 @@ WinService::Startup WinService::getStartup() const } +void WinService::setDescription(const std::string& description) +{ + std::string key(REGISTRY_KEY); + key += _name; + WinRegistryKey regKey(HKEY_LOCAL_MACHINE, key); + regKey.setString(REGISTRY_DESCRIPTION, description); +} + + +std::string WinService::getDescription() const +{ + std::string key(REGISTRY_KEY); + key += _name; + WinRegistryKey regKey(HKEY_LOCAL_MACHINE, key, true); + return regKey.getString(REGISTRY_DESCRIPTION); +} + + void WinService::open() const { - if (!tryOpen()) + if (!tryOpen()) throw NotFoundException("service does not exist", _name); } diff --git a/Util/src/XMLConfiguration.cpp b/Util/src/XMLConfiguration.cpp index fa6033265..b0f2e660a 100644 --- a/Util/src/XMLConfiguration.cpp +++ b/Util/src/XMLConfiguration.cpp @@ -97,7 +97,7 @@ void XMLConfiguration::load(Poco::XML::InputSource* pInputSource) Poco::XML::DOMParser parser; parser.setFeature(Poco::XML::XMLReader::FEATURE_NAMESPACES, false); - parser.setFeature(Poco::XML::DOMParser::FEATURE_WHITESPACE, true); + parser.setFeature(Poco::XML::DOMParser::FEATURE_FILTER_WHITESPACE, true); Poco::XML::AutoPtr pDoc = parser.parse(pInputSource); load(pDoc); } @@ -251,6 +251,33 @@ void XMLConfiguration::enumerate(const std::string& key, Keys& range) const } +void XMLConfiguration::removeRaw(const std::string& key) +{ + Poco::XML::Node* pNode = findNode(key); + + if (pNode) + { + if (pNode->nodeType() == Poco::XML::Node::ELEMENT_NODE) + { + Poco::XML::Node* pParent = pNode->parentNode(); + if (pParent) + { + pParent->removeChild(pNode); + } + } + else if (pNode->nodeType() == Poco::XML::Node::ATTRIBUTE_NODE) + { + Poco::XML::Attr* pAttr = dynamic_cast(pNode); + Poco::XML::Element* pOwner = pAttr->ownerElement(); + if (pOwner) + { + pOwner->removeAttributeNode(pAttr); + } + } + } +} + + const Poco::XML::Node* XMLConfiguration::findNode(const std::string& key) const { std::string::const_iterator it = key.begin(); @@ -259,6 +286,14 @@ const Poco::XML::Node* XMLConfiguration::findNode(const std::string& key) const } +Poco::XML::Node* XMLConfiguration::findNode(const std::string& key) +{ + std::string::const_iterator it = key.begin(); + Poco::XML::Node* pRoot = const_cast(_pRoot.get()); + return findNode(it, key.end(), pRoot); +} + + Poco::XML::Node* XMLConfiguration::findNode(std::string::const_iterator& it, const std::string::const_iterator& end, Poco::XML::Node* pNode, bool create) { if (pNode && it != end) @@ -270,9 +305,29 @@ Poco::XML::Node* XMLConfiguration::findNode(std::string::const_iterator& it, con { ++it; std::string attr; - while (it != end && *it != ']') attr += *it++; - if (it != end) ++it; - return findAttribute(attr, pNode, create); + while (it != end && *it != ']' && *it != '=') attr += *it++; + if (it != end && *it == '=') + { + ++it; + std::string value; + if (it != end && *it == '\'') + { + ++it; + while (it != end && *it != '\'') value += *it++; + if (it != end) ++it; + } + else + { + while (it != end && *it != ']') value += *it++; + } + if (it != end) ++it; + return findNode(it, end, findElement(attr, value, pNode), create); + } + else + { + if (it != end) ++it; + return findAttribute(attr, pNode, create); + } } else { @@ -342,6 +397,27 @@ Poco::XML::Node* XMLConfiguration::findElement(int index, Poco::XML::Node* pNode } +Poco::XML::Node* XMLConfiguration::findElement(const std::string& attr, const std::string& value, Poco::XML::Node* pNode) +{ + Poco::XML::Node* pRefNode = pNode; + Poco::XML::Element* pElem = dynamic_cast(pNode); + if (!(pElem && pElem->getAttribute(attr) == value)) + { + pNode = pNode->nextSibling(); + while (pNode) + { + if (pNode->nodeName() == pRefNode->nodeName()) + { + pElem = dynamic_cast(pNode); + if (pElem && pElem->getAttribute(attr) == value) break; + } + pNode = pNode->nextSibling(); + } + } + return pNode; +} + + Poco::XML::Node* XMLConfiguration::findAttribute(const std::string& name, Poco::XML::Node* pNode, bool create) { Poco::XML::Node* pResult(0); diff --git a/Util/testsuite/TestSuite_vs100.vcxproj b/Util/testsuite/TestSuite_vs100.vcxproj new file mode 100644 index 000000000..e81137414 --- /dev/null +++ b/Util/testsuite/TestSuite_vs100.vcxproj @@ -0,0 +1,357 @@ + + + + + debug_shared + Win32 + + + debug_static_md + Win32 + + + debug_static_mt + Win32 + + + release_shared + Win32 + + + release_static_md + Win32 + + + release_static_mt + Win32 + + + + TestSuite + {E40E738C-447B-40F4-A878-EBA9A2459270} + TestSuite + Win32Proj + + + + Application + Dynamic + MultiByte + + + Application + Dynamic + MultiByte + + + Application + Static + MultiByte + + + Application + Static + MultiByte + + + Application + Dynamic + MultiByte + + + Application + Dynamic + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + bin\ + obj\$(Configuration)\ + true + bin\ + obj\$(Configuration)\ + false + bin\static_mt\ + obj\$(Configuration)\ + true + bin\static_mt\ + obj\$(Configuration)\ + false + bin\static_md\ + obj\$(Configuration)\ + true + bin\static_md\ + obj\$(Configuration)\ + false + TestSuited + TestSuited + TestSuited + TestSuite + TestSuite + TestSuite + + + + Disabled + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + CppUnitd.lib;WinTestRunnerd.lib;%(AdditionalDependencies) + bin\TestSuited.exe + ..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\TestSuited.pdb + Windows + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + CppUnit.lib;WinTestRunner.lib;%(AdditionalDependencies) + bin\TestSuite.exe + ..\..\lib;%(AdditionalLibraryDirectories) + false + Windows + true + true + MachineX86 + + + + + Disabled + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + CppUnitmtd.lib;WinTestRunnermtd.lib;iphlpapi.lib;winmm.lib;nafxcwd.lib;libcmtd.lib;WinTestRunner.res;%(AdditionalDependencies) + bin\static_mt\TestSuited.exe + ..\..\lib;%(AdditionalLibraryDirectories) + nafxcwd.lib;libcmtd.lib;%(IgnoreSpecificDefaultLibraries) + true + true + bin\static_mt\TestSuited.pdb + Windows + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + CppUnitmt.lib;WinTestRunnermt.lib;iphlpapi.lib;winmm.lib;nafxcw.lib;libcmt.lib;WinTestRunner.res;%(AdditionalDependencies) + bin\static_mt\TestSuite.exe + ..\..\lib;%(AdditionalLibraryDirectories) + nafxcw.lib;libcmt.lib;%(IgnoreSpecificDefaultLibraries) + false + Windows + true + true + MachineX86 + + + + + Disabled + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + EditAndContinue + Default + %(DisableSpecificWarnings) + + + CppUnitmdd.lib;WinTestRunnermdd.lib;iphlpapi.lib;winmm.lib;WinTestRunner.res;%(AdditionalDependencies) + bin\static_md\TestSuited.exe + ..\..\lib;%(AdditionalLibraryDirectories) + true + true + bin\static_md\TestSuited.pdb + Windows + MachineX86 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + CppUnitmd.lib;WinTestRunnermd.lib;iphlpapi.lib;winmm.lib;WinTestRunner.res;%(AdditionalDependencies) + bin\static_md\TestSuite.exe + ..\..\lib;%(AdditionalLibraryDirectories) + false + Windows + true + true + MachineX86 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Util/testsuite/TestSuite_vs100.vcxproj.filters b/Util/testsuite/TestSuite_vs100.vcxproj.filters new file mode 100644 index 000000000..571aaf557 --- /dev/null +++ b/Util/testsuite/TestSuite_vs100.vcxproj.filters @@ -0,0 +1,216 @@ + + + + + {ae09dcb9-78ff-4138-b7e4-6ec414c34b24} + + + {285972b2-6cf4-4acf-8e5f-27415200dc77} + + + {361175b6-f449-4679-bd7f-fedd0eeaecae} + + + {d888d224-78a9-400d-9a32-d5da715bb248} + + + {b4c4096d-08a9-41e9-8fbe-b6d24c0eb215} + + + {60cb4a06-ed6b-4e13-9661-50bb331bc591} + + + {07ed0878-5dc8-4f39-aa91-49475cff03b7} + + + {8bb75a16-9627-4e44-b17a-f0a0ba20d6c2} + + + {c5a1436f-963e-4648-9add-0ba55beffff1} + + + {f6966824-de36-4bed-b211-39153dafda63} + + + {31c3ece2-45a2-40d5-8609-17786acd664c} + + + {6696486e-e20d-48fe-8f09-43a7b7d524d3} + + + {34dd39c4-4ed7-40a8-a2ce-3a5104712628} + + + {29238819-0429-43d7-a8d9-e609407c9fd9} + + + {24d325cd-2782-4d91-b37d-f42e54063dba} + + + {aeaa8570-3f71-4b8d-ac03-3923f7c9908a} + + + {2ead5d3d-4053-42a9-9ad5-c408b982a32f} + + + {15ddab26-c6b5-4262-aa11-cd17164dd3eb} + + + {1de1f265-223d-49ce-bac2-21ce3202f96f} + + + {547bf535-81c6-4ca0-acc8-62148f8bb099} + + + + + _Suite\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Windows\Header Files + + + Windows\Header Files + + + Windows\Header Files + + + Timer\Header Files + + + Timer\Header Files + + + + + _Suite\Source Files + + + _Driver\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Windows\Source Files + + + Windows\Source Files + + + Windows\Source Files + + + Timer\Source Files + + + Timer\Source Files + + + \ No newline at end of file diff --git a/Util/testsuite/TestSuite_vs100.vcxproj.user b/Util/testsuite/TestSuite_vs100.vcxproj.user new file mode 100644 index 000000000..ace9a86ac --- /dev/null +++ b/Util/testsuite/TestSuite_vs100.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Util/testsuite/TestSuite_x64_vs100.vcxproj b/Util/testsuite/TestSuite_x64_vs100.vcxproj new file mode 100644 index 000000000..cdb606567 --- /dev/null +++ b/Util/testsuite/TestSuite_x64_vs100.vcxproj @@ -0,0 +1,357 @@ + + + + + debug_shared + x64 + + + debug_static_md + x64 + + + debug_static_mt + x64 + + + release_shared + x64 + + + release_static_md + x64 + + + release_static_mt + x64 + + + + TestSuite + {E40E738C-447B-40F4-A878-EBA9A2459270} + TestSuite + Win32Proj + + + + Application + Dynamic + MultiByte + + + Application + Dynamic + MultiByte + + + Application + Static + MultiByte + + + Application + Static + MultiByte + + + Application + Dynamic + MultiByte + + + Application + Dynamic + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + bin64\ + obj64\$(Configuration)\ + true + bin64\ + obj64\$(Configuration)\ + false + bin64\static_mt\ + obj64\$(Configuration)\ + true + bin64\static_mt\ + obj64\$(Configuration)\ + false + bin64\static_md\ + obj64\$(Configuration)\ + true + bin64\static_md\ + obj64\$(Configuration)\ + false + TestSuited + TestSuited + TestSuited + TestSuite + TestSuite + TestSuite + + + + Disabled + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + CppUnitd.lib;WinTestRunnerd.lib;%(AdditionalDependencies) + bin64\TestSuited.exe + ..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\TestSuited.pdb + Windows + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + CppUnit.lib;WinTestRunner.lib;%(AdditionalDependencies) + bin64\TestSuite.exe + ..\..\lib64;%(AdditionalLibraryDirectories) + false + Windows + true + true + MachineX64 + + + + + Disabled + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + CppUnitmtd.lib;WinTestRunnermtd.lib;iphlpapi.lib;winmm.lib;nafxcwd.lib;libcmtd.lib;WinTestRunner.res;%(AdditionalDependencies) + bin64\static_mt\TestSuited.exe + ..\..\lib64;%(AdditionalLibraryDirectories) + nafxcwd.lib;libcmtd.lib;%(IgnoreSpecificDefaultLibraries) + true + true + bin64\static_mt\TestSuited.pdb + Windows + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + CppUnitmt.lib;WinTestRunnermt.lib;iphlpapi.lib;winmm.lib;nafxcw.lib;libcmt.lib;WinTestRunner.res;%(AdditionalDependencies) + bin64\static_mt\TestSuite.exe + ..\..\lib64;%(AdditionalLibraryDirectories) + nafxcw.lib;libcmt.lib;%(IgnoreSpecificDefaultLibraries) + false + Windows + true + true + MachineX64 + + + + + Disabled + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + %(DisableSpecificWarnings) + + + CppUnitmdd.lib;WinTestRunnermdd.lib;iphlpapi.lib;winmm.lib;WinTestRunner.res;%(AdditionalDependencies) + bin64\static_md\TestSuited.exe + ..\..\lib64;%(AdditionalLibraryDirectories) + true + true + bin64\static_md\TestSuited.pdb + Windows + MachineX64 + + + + + Disabled + OnlyExplicitInline + true + Speed + true + ..\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Foundation\include;..\..\XML\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + %(DisableSpecificWarnings) + + + CppUnitmd.lib;WinTestRunnermd.lib;iphlpapi.lib;winmm.lib;WinTestRunner.res;%(AdditionalDependencies) + bin64\static_md\TestSuite.exe + ..\..\lib64;%(AdditionalLibraryDirectories) + false + Windows + true + true + MachineX64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Util/testsuite/TestSuite_x64_vs100.vcxproj.filters b/Util/testsuite/TestSuite_x64_vs100.vcxproj.filters new file mode 100644 index 000000000..fe1d16bfc --- /dev/null +++ b/Util/testsuite/TestSuite_x64_vs100.vcxproj.filters @@ -0,0 +1,216 @@ + + + + + {645c47a9-f505-4f95-aa4e-23b202e805d0} + + + {055a889d-7c41-41ca-a0e6-d92bbcd7590a} + + + {d88d97e4-85a7-4e16-8402-a3b1ceb23557} + + + {4e63463e-85a2-49df-8d14-b15b49f59855} + + + {7a792685-1fa0-43bb-ab1b-42c1c1cfd823} + + + {d8548cbd-0132-4ec8-978a-328fe0c503b5} + + + {e70c95fc-1ba8-44c3-9a24-6448d7cb8cb3} + + + {3b846552-4cc4-43e6-a7fa-b2491f50a1fc} + + + {cf8fc36b-9e80-4760-bfd6-d833b1beb435} + + + {121544d2-b054-4c58-b30d-5b3af6070feb} + + + {9e0b7bc2-7085-4677-9197-3ea836651722} + + + {c9da5020-3887-45cf-ae36-662b2d167118} + + + {315ff665-36e7-49f0-91cd-56fa0766f56b} + + + {c7b1e0e9-c4a8-4eb7-9d44-650b84d699cf} + + + {3b8928eb-9b21-4348-8522-76f09db009ca} + + + {e9eb5c16-1966-453d-a608-3471256b1417} + + + {27bd9cb5-c05c-42b2-b031-9e166b0e19f1} + + + {1bc9e3ab-479c-4eeb-95c2-673220d955f5} + + + {10022977-d86f-462d-882b-bd4a4530cdac} + + + {5b2155dd-0ab8-4e29-b6a0-ebe815601d85} + + + + + _Suite\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Configuration\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Options\Header Files + + + Windows\Header Files + + + Windows\Header Files + + + Windows\Header Files + + + Timer\Header Files + + + Timer\Header Files + + + + + _Suite\Source Files + + + _Driver\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Configuration\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Options\Source Files + + + Windows\Source Files + + + Windows\Source Files + + + Windows\Source Files + + + Timer\Source Files + + + Timer\Source Files + + + \ No newline at end of file diff --git a/Util/testsuite/TestSuite_x64_vs100.vcxproj.user b/Util/testsuite/TestSuite_x64_vs100.vcxproj.user new file mode 100644 index 000000000..ace9a86ac --- /dev/null +++ b/Util/testsuite/TestSuite_x64_vs100.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file