This commit is contained in:
Guenter Obiltschnig 2006-12-22 09:56:56 +00:00
Родитель e958c09804
Коммит 898be6c227
20 изменённых файлов: 1091 добавлений и 69 удалений

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

@ -11,17 +11,29 @@ EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
debug_shared = debug_shared
debug_static = debug_static
release_shared = release_shared
release_static = release_static
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_shared.ActiveCfg = debug_shared|Win32
{6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_shared.Build.0 = debug_shared|Win32
{6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static.ActiveCfg = debug_static|Win32
{6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static.Build.0 = debug_static|Win32
{6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_shared.ActiveCfg = release_shared|Win32
{6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_shared.Build.0 = release_shared|Win32
{6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static.ActiveCfg = release_static|Win32
{6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static.Build.0 = release_static|Win32
{E40E738C-447B-40F4-A878-EBA9A2459270}.debug_shared.ActiveCfg = debug_shared|Win32
{E40E738C-447B-40F4-A878-EBA9A2459270}.debug_shared.Build.0 = debug_shared|Win32
{E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static.ActiveCfg = debug_static|Win32
{E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static.Build.0 = debug_static|Win32
{E40E738C-447B-40F4-A878-EBA9A2459270}.release_shared.ActiveCfg = release_shared|Win32
{E40E738C-447B-40F4-A878-EBA9A2459270}.release_shared.Build.0 = release_shared|Win32
{E40E738C-447B-40F4-A878-EBA9A2459270}.release_static.ActiveCfg = release_static|Win32
{E40E738C-447B-40F4-A878-EBA9A2459270}.release_static.Build.0 = release_static|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection

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

@ -138,6 +138,107 @@
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="debug_static|Win32"
OutputDirectory="obj\debug_static"
IntermediateDirectory="obj\debug_static"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\Foundation\include;..\XML\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC"
StringPooling="TRUE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\PocoUtilmtd.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="release_static|Win32"
OutputDirectory="obj\release_static"
IntermediateDirectory="obj\release_static"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForProcessor="3"
AdditionalIncludeDirectories=".\include;..\Foundation\include;..\XML\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC"
GeneratePreprocessedFile="0"
KeepComments="FALSE"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\PocoUtilmt.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>

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

@ -10,17 +10,27 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug_shared|Win32 = debug_shared|Win32
debug_static|Win32 = debug_static|Win32
release_shared|Win32 = release_shared|Win32
release_static|Win32 = release_static|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_static|Win32.ActiveCfg = debug_static|Win32
{6FF56CDB-787A-4714-A28C-919003F9FA6C}.debug_static|Win32.Build.0 = debug_static|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_static|Win32.ActiveCfg = release_static|Win32
{6FF56CDB-787A-4714-A28C-919003F9FA6C}.release_static|Win32.Build.0 = release_static|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_static|Win32.ActiveCfg = debug_static|Win32
{E40E738C-447B-40F4-A878-EBA9A2459270}.debug_static|Win32.Build.0 = debug_static|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_static|Win32.ActiveCfg = release_static|Win32
{E40E738C-447B-40F4-A878-EBA9A2459270}.release_static|Win32.Build.0 = release_static|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="Util"
ProjectGUID="{6FF56CDB-787A-4714-A28C-919003F9FA6C}"
RootNamespace="Util"
@ -201,6 +201,154 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="release_static|Win32"
OutputDirectory="obj\release_static"
IntermediateDirectory="obj\release_static"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=".\include;..\Foundation\include;..\XML\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_STATIC"
GeneratePreprocessedFile="0"
KeepComments="false"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\PocoUtilmt.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="debug_static|Win32"
OutputDirectory="obj\debug_static"
IntermediateDirectory="obj\debug_static"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\Foundation\include;..\XML\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC"
StringPooling="true"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\PocoUtilmtd.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>

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

@ -1,7 +1,7 @@
//
// Application.h
//
// $Id: //poco/1.3/Util/include/Poco/Util/Application.h#1 $
// $Id: //poco/1.3/Util/include/Poco/Util/Application.h#2 $
//
// Library: Util
// Package: Application
@ -78,14 +78,21 @@ class Util_API Application: public Subsystem
/// There may be at most one instance of the Application class
/// in a process.
///
/// The Application class maintains a LayeredConfiguration (available
/// via the config() member function) consisting of:
/// - a MapConfiguration (priority -100) storing application-specific
/// properties, as well as properties from bound command line arguments.
/// - a SystemConfiguration (priority 100)
/// - the configurations loaded with loadConfiguration().
///
/// The Application class sets a few default properties in
/// its configuration (available via the config() method).
/// These are:
/// its configuration. These are:
/// - application.path: the absolute path to application executable
/// - application.name: the file name of the application executable
/// - application.baseName: the file name (excluding extension) of the application executable
/// - application.dir: the path to the directory where the application executable resides
/// - application.configDir: the path to the directory where the last configuration file loaded with loadConfiguration() was found.
///
/// If loadConfiguration() has never been called, application.configDir will be equal to application.dir.
///
/// The POCO_APP_MAIN macro can be used to implement main(argc, argv).
@ -115,6 +122,13 @@ public:
EXIT_CONFIG = 78 /// configuration error
};
enum ConfigPriority
{
PRIO_APPLICATION = -100,
PRIO_DEFAULT = 0,
PRIO_SYSTEM = 100
};
Application();
/// Creates the Application.
@ -152,10 +166,16 @@ public:
void setUnixOptions(bool flag);
/// Specify whether command line option handling is Unix-style
/// (flag == true; default) or Windows/OpenVMS-style (flag == false).
///
/// This member function should be called from the constructor of
/// a subclass to be effective.
int loadConfiguration();
int loadConfiguration(int priority = PRIO_DEFAULT);
/// Loads configuration information from a default location.
///
/// The configuration(s) will be added to the application's
/// LayeredConfiguration with the given priority.
///
/// The configuration file(s) must be located in the same directory
/// as the executable or a parent directory of it, and must have the
/// same base name as the executable, with one of the following extensions:
@ -179,7 +199,7 @@ public:
/// This method must not be called before initialize(argc, argv)
/// has been called.
void loadConfiguration(const std::string& path);
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:
@ -188,6 +208,10 @@ public:
/// - .xml - XML file (XMLConfiguration)
///
/// Extensions are not case sensitive.
///
/// The configuration will be added to the application's
/// LayeredConfiguration with the given priority.
///
template <class C> C& getSubsystem() const;
/// Returns a reference to the subsystem of the class
@ -354,8 +378,9 @@ template <class C> C& Application::getSubsystem() const
{
for (SubsystemVec::const_iterator it = _subsystems.begin(); it != _subsystems.end(); ++it)
{
if (dynamic_cast<C*>(*it))
return **it;
Poco::AutoPtr<C> pSubsystem(it->cast<C>());
if (!pSubsystem.isNull())
return *pSubsystem;
}
throw Poco::NotFoundException("The subsystem has not been registered");
}

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

@ -1,7 +1,7 @@
//
// LayeredConfiguration.h
//
// $Id: //poco/1.3/Util/include/Poco/Util/LayeredConfiguration.h#1 $
// $Id: //poco/1.3/Util/include/Poco/Util/LayeredConfiguration.h#2 $
//
// Library: Util
// Package: Configuration
@ -43,7 +43,7 @@
#include "Poco/Util/Util.h"
#include "Poco/Util/AbstractConfiguration.h"
#include "Poco/AutoPtr.h"
#include <vector>
#include <list>
namespace Poco {
@ -54,53 +54,106 @@ class Util_API LayeredConfiguration: public AbstractConfiguration
/// A LayeredConfiguration consists of a number of AbstractConfigurations.
///
/// When reading a configuration property in a LayeredConfiguration,
/// all added configurations are searched, from the first added to the last added.
/// all added configurations are searched, in order of their priority.
/// Configurations with lower priority values have precedence.
///
/// When setting a property, the property is always written to the last configuration
/// added. If no configurations have been added to the LayeredConfiguration, and an
/// When setting a property, the property is always written to the first writeable
/// configuration (see addWriteable()).
/// If no writeable configuration has been added to the LayeredConfiguration, and an
/// attempt is made to set a property, a RuntimeException is thrown.
///
/// Every configuration added to the LayeredConfiguration has a priority value.
/// The priority determines the position where the configuration is inserted,
/// with lower priority values coming before higher priority values.
///
/// If no priority is specified, a priority of 0 is assumed.
{
public:
LayeredConfiguration();
/// Creates the LayeredConfiguration.
void add(AbstractConfiguration* pConfig);
/// Adds a configuration to the back of the LayeredConfiguration.
/// Adds a read-only configuration to the back of the LayeredConfiguration.
/// The LayeredConfiguration does not take ownership of the given
/// configuration. In other words, the configuration's reference
/// count is incremented.
void add(AbstractConfiguration* pConfig, bool shared);
/// Adds a configuration to the back of the LayeredConfiguration.
/// Adds a read-only configuration to the back of the LayeredConfiguration.
/// If shared is false, the LayeredConfiguration takes ownership
/// of the given configuration (and the configuration's reference
/// count remains unchanged).
void addFront(AbstractConfiguration* pConfig);
/// Adds a configuration to the front of the LayeredConfiguration.
void add(AbstractConfiguration* pConfig, int priority);
/// Adds a read-only configuration to the LayeredConfiguration.
/// The LayeredConfiguration does not take ownership of the given
/// configuration. In other words, the configuration's reference
/// count is incremented.
void add(AbstractConfiguration* pConfig, int priority, bool shared);
/// Adds a read-only configuration the LayeredConfiguration.
/// If shared is false, the LayeredConfiguration takes ownership
/// of the given configuration (and the configuration's reference
/// count remains unchanged).
void add(AbstractConfiguration* pConfig, int priority, bool writeable, bool shared);
/// Adds a configuration to the LayeredConfiguration.
/// If shared is false, the LayeredConfiguration takes ownership
/// of the given configuration (and the configuration's reference
/// count remains unchanged).
void addWriteable(AbstractConfiguration* pConfig, int priority);
/// Adds a writeable configuration to the LayeredConfiguration.
/// The LayeredConfiguration does not take ownership of the given
/// configuration. In other words, the configuration's reference
/// count is incremented.
void addWriteable(AbstractConfiguration* pConfig, int priority, bool shared);
/// Adds a writeable configuration to the LayeredConfiguration.
/// If shared is false, the LayeredConfiguration takes ownership
/// of the given configuration (and the configuration's reference
/// count remains unchanged).
//@ deprecated
void addFront(AbstractConfiguration* pConfig);
/// Adds a read-only configuration to the front of the LayeredConfiguration.
/// The LayeredConfiguration does not take ownership of the given
/// configuration. In other words, the configuration's reference
/// count is incremented.
//@ deprecated
void addFront(AbstractConfiguration* pConfig, bool shared);
/// Adds a configuration to the front of the LayeredConfiguration.
/// Adds a read-only configuration to the front of the LayeredConfiguration.
/// If shared is true, the LayeredConfiguration takes ownership
/// of the given configuration.
protected:
typedef Poco::AutoPtr<AbstractConfiguration> ConfigPtr;
struct ConfigItem
{
ConfigPtr pConfig;
int priority;
bool writeable;
};
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;
int lowest() const;
int highest() const;
void insert(const ConfigItem& item);
~LayeredConfiguration();
private:
LayeredConfiguration(const LayeredConfiguration&);
LayeredConfiguration& operator = (const LayeredConfiguration&);
typedef Poco::AutoPtr<AbstractConfiguration> ConfigPtr;
typedef std::vector<ConfigPtr> ConfigVec;
typedef std::list<ConfigItem> ConfigList;
ConfigVec _configs;
ConfigList _configs;
};

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

@ -1,7 +1,7 @@
//
// Option.h
//
// $Id: //poco/1.3/Util/include/Poco/Util/Option.h#1 $
// $Id: //poco/1.3/Util/include/Poco/Util/Option.h#2 $
//
// Library: Util
// Package: Options
@ -50,6 +50,7 @@ namespace Util {
class Application;
class Validator;
class AbstractConfiguration;
class Util_API Option
@ -147,6 +148,12 @@ public:
///
/// The configuration will automatically receive the option's argument.
Option& binding(const std::string& propertyName, AbstractConfiguration* pConfig);
/// Binds the option to the configuration property with the given name,
/// using the given AbstractConfiguration.
///
/// The configuration will automatically receive the option's argument.
Option& callback(const AbstractOptionCallback& cb);
/// Binds the option to the given method.
///
@ -204,6 +211,9 @@ public:
/// Returns the option's Validator, if one has been specified,
/// or NULL otherwise.
AbstractConfiguration* config() const;
/// Returns the configuration, if specified, or NULL otherwise.
bool matchesShort(const std::string& option) const;
/// Returns true if the given option string matches the
/// short name.
@ -251,6 +261,7 @@ private:
std::string _binding;
Validator* _pValidator;
AbstractOptionCallback* _pCallback;
AbstractConfiguration* _pConfig;
};
@ -331,6 +342,12 @@ inline Validator* Option::validator() const
}
inline AbstractConfiguration* Option::config() const
{
return _pConfig;
}
} } // namespace Poco::Util

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

@ -128,6 +128,124 @@
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="debug_static|Win32"
OutputDirectory="obj\debug_static"
IntermediateDirectory="obj\debug_static"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationmtd.lib PocoXMLmtd.lib PocoUtilmtd.lib advapi32.lib"
OutputFile="bin/SampleAppmtd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="bin/SampleAppmtd.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="release_static|Win32"
OutputDirectory="obj\release_static"
IntermediateDirectory="obj\release_static"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationmt.lib PocoXMLmt.lib PocoUtilmt.lib advapi32.lib"
OutputFile="bin/SampleAppmt.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="FALSE"
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>

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

@ -128,6 +128,124 @@
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="debug_static|Win32"
OutputDirectory="obj\debug_static"
IntermediateDirectory="obj\debug_static"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationmtd.lib PocoXMLmtd.lib PocoUtilmtd.lib advapi32.lib"
OutputFile="bin/SampleServermtd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="bin/SampleServermtd.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="release_static|Win32"
OutputDirectory="obj\release_static"
IntermediateDirectory="obj\release_static"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationmt.lib PocoXMLmt.lib PocoUtilmt.lib advapi32.lib"
OutputFile="bin/SampleServermt.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="FALSE"
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>

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

@ -10,17 +10,29 @@ EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
debug_shared = debug_shared
debug_static = debug_static
release_shared = release_shared
release_static = release_static
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared.ActiveCfg = debug_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared.Build.0 = debug_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_static.ActiveCfg = debug_static|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_static.Build.0 = debug_static|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared.ActiveCfg = release_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared.Build.0 = release_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_static.ActiveCfg = release_static|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_static.Build.0 = release_static|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared.ActiveCfg = debug_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared.Build.0 = debug_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_static.ActiveCfg = debug_static|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_static.Build.0 = debug_static|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared.ActiveCfg = release_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared.Build.0 = release_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_static.ActiveCfg = release_static|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_static.Build.0 = release_static|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection

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

@ -1,7 +1,7 @@
//
// Application.cpp
//
// $Id: //poco/1.3/Util/src/Application.cpp#1 $
// $Id: //poco/1.3/Util/src/Application.cpp#2 $
//
// Library: Util
// Package: Application
@ -121,8 +121,9 @@ void Application::setup()
{
poco_assert (_pInstance == 0);
_pConfig->add(new SystemConfiguration, false);
_pConfig->add(new MapConfiguration, false);
_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)
@ -238,7 +239,7 @@ void Application::setUnixOptions(bool flag)
}
int Application::loadConfiguration()
int Application::loadConfiguration(int priority)
{
int n = 0;
Path appPath;
@ -246,17 +247,17 @@ int Application::loadConfiguration()
Path cfgPath;
if (findAppConfigFile(appPath.getBaseName(), "properties", cfgPath))
{
_pConfig->addFront(new PropertyFileConfiguration(cfgPath.toString()), false);
_pConfig->add(new PropertyFileConfiguration(cfgPath.toString()), priority, false, false);
++n;
}
if (findAppConfigFile(appPath.getBaseName(), "ini", cfgPath))
{
_pConfig->addFront(new IniFileConfiguration(cfgPath.toString()), false);
_pConfig->add(new IniFileConfiguration(cfgPath.toString()), priority, false, false);
++n;
}
if (findAppConfigFile(appPath.getBaseName(), "xml", cfgPath))
{
_pConfig->addFront(new XMLConfiguration(cfgPath.toString()), false);
_pConfig->add(new XMLConfiguration(cfgPath.toString()), priority, false, false);
++n;
}
if (n > 0)
@ -267,16 +268,16 @@ int Application::loadConfiguration()
}
void Application::loadConfiguration(const std::string& path)
void Application::loadConfiguration(const std::string& path, int priority)
{
Path confPath(path);
std::string ext = confPath.getExtension();
if (icompare(ext, "properties") == 0)
_pConfig->addFront(new PropertyFileConfiguration(confPath.toString()), false);
_pConfig->add(new PropertyFileConfiguration(confPath.toString()), priority, false, false);
else if (icompare(ext, "ini") == 0)
_pConfig->addFront(new IniFileConfiguration(confPath.toString()), false);
_pConfig->add(new IniFileConfiguration(confPath.toString()), priority, false, false);
else if (icompare(ext, "xml") == 0)
_pConfig->addFront(new XMLConfiguration(confPath.toString()), false);
_pConfig->add(new XMLConfiguration(confPath.toString()), priority, false, false);
else
throw Poco::InvalidArgumentException("Unsupported configuration file type", ext);
}
@ -480,7 +481,9 @@ void Application::handleOption(const std::string& name, const std::string& value
}
if (!option.binding().empty())
{
config().setString(option.binding(), value);
AbstractConfiguration* pConfig = option.config();
if (!pConfig) pConfig = &config();
pConfig->setString(option.binding(), value);
}
if (option.callback())
{

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

@ -1,7 +1,7 @@
//
// LayeredConfiguration.cpp
//
// $Id: //poco/1.3/Util/src/LayeredConfiguration.cpp#1 $
// $Id: //poco/1.3/Util/src/LayeredConfiguration.cpp#2 $
//
// Library: Util
// Package: Configuration
@ -59,37 +59,72 @@ LayeredConfiguration::~LayeredConfiguration()
void LayeredConfiguration::add(AbstractConfiguration* pConfig)
{
add(pConfig, true);
add(pConfig, highest(), false, true);
}
void LayeredConfiguration::add(AbstractConfiguration* pConfig, bool shared)
{
poco_check_ptr (pConfig);
add(pConfig, highest(), false, shared);
}
_configs.push_back(ConfigPtr(pConfig, shared));
void LayeredConfiguration::add(AbstractConfiguration* pConfig, int priority)
{
add(pConfig, priority, false, true);
}
void LayeredConfiguration::add(AbstractConfiguration* pConfig, int priority, bool shared)
{
add(pConfig, priority, false, shared);
}
void LayeredConfiguration::addFront(AbstractConfiguration* pConfig)
{
addFront(pConfig, true);
add(pConfig, lowest(), false, true);
}
void LayeredConfiguration::addFront(AbstractConfiguration* pConfig, bool shared)
{
poco_check_ptr (pConfig);
add(pConfig, lowest(), false, shared);
}
_configs.insert(_configs.begin(), ConfigPtr(pConfig, shared));
void LayeredConfiguration::addWriteable(AbstractConfiguration* pConfig, int priority)
{
add(pConfig, priority, true, true);
}
void LayeredConfiguration::addWriteable(AbstractConfiguration* pConfig, int priority, bool shared)
{
add(pConfig, priority, true, shared);
}
void LayeredConfiguration::add(AbstractConfiguration* pConfig, int priority, bool writeable, bool shared)
{
ConfigItem item;
item.pConfig = ConfigPtr(pConfig, shared);
item.priority = priority;
item.writeable = writeable;
ConfigList::iterator it = _configs.begin();
while (it != _configs.end() && it->priority < priority)
++it;
_configs.insert(it, item);
}
bool LayeredConfiguration::getRaw(const std::string& key, std::string& value) const
{
for (ConfigVec::const_iterator it = _configs.begin(); it != _configs.end(); ++it)
for (ConfigList::const_iterator it = _configs.begin(); it != _configs.end(); ++it)
{
if ((*it)->getRaw(key, value))
if (it->pConfig->getRaw(key, value))
return true;
}
return false;
@ -98,20 +133,25 @@ bool LayeredConfiguration::getRaw(const std::string& key, std::string& value) co
void LayeredConfiguration::setRaw(const std::string& key, const std::string& value)
{
if (!_configs.empty())
_configs.back()->setRaw(key, value);
else
throw RuntimeException("No configuration object to store the property", key);
for (ConfigList::iterator it = _configs.begin(); it != _configs.end(); ++it)
{
if (it->writeable)
{
it->pConfig->setRaw(key, value);
return;
}
}
throw RuntimeException("No writeable configuration object to store the property", key);
}
void LayeredConfiguration::enumerate(const std::string& key, Keys& range) const
{
std::set<std::string> keys;
for (ConfigVec::const_iterator itc = _configs.begin(); itc != _configs.end(); ++itc)
for (ConfigList::const_iterator itc = _configs.begin(); itc != _configs.end(); ++itc)
{
Keys partRange;
(*itc)->enumerate(key, partRange);
itc->pConfig->enumerate(key, partRange);
for (Keys::const_iterator itr = partRange.begin(); itr != partRange.end(); ++itr)
{
if (keys.find(*itr) == keys.end())
@ -124,4 +164,22 @@ void LayeredConfiguration::enumerate(const std::string& key, Keys& range) const
}
int LayeredConfiguration::lowest() const
{
if (_configs.empty())
return 0;
else
return _configs.front().priority - 1;
}
int LayeredConfiguration::highest() const
{
if (_configs.empty())
return 0;
else
return _configs.back().priority + 1;
}
} } // namespace Poco::Util

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

@ -1,7 +1,7 @@
//
// Option.cpp
//
// $Id: //poco/1.3/Util/src/Option.cpp#1 $
// $Id: //poco/1.3/Util/src/Option.cpp#2 $
//
// Library: Util
// Package: Options
@ -37,6 +37,7 @@
#include "Poco/Util/Option.h"
#include "Poco/Util/OptionException.h"
#include "Poco/Util/Validator.h"
#include "Poco/Util/AbstractConfiguration.h"
#include "Poco/String.h"
#include <algorithm>
@ -53,7 +54,8 @@ Option::Option():
_repeatable(false),
_argRequired(false),
_pValidator(0),
_pCallback(0)
_pCallback(0),
_pConfig(0)
{
}
@ -69,10 +71,12 @@ Option::Option(const Option& option):
_group(option._group),
_binding(option._binding),
_pValidator(option._pValidator),
_pCallback(option._pCallback)
_pCallback(option._pCallback),
_pConfig(option._pConfig)
{
if (_pValidator) _pValidator->duplicate();
if (_pCallback) _pCallback = _pCallback->clone();
if (_pConfig) _pConfig->duplicate();
}
@ -83,7 +87,8 @@ Option::Option(const std::string& fullName, const std::string& shortName):
_repeatable(false),
_argRequired(false),
_pValidator(0),
_pCallback(0)
_pCallback(0),
_pConfig(0)
{
}
@ -96,7 +101,8 @@ Option::Option(const std::string& fullName, const std::string& shortName, const
_repeatable(false),
_argRequired(false),
_pValidator(0),
_pCallback(0)
_pCallback(0),
_pConfig(0)
{
}
@ -110,7 +116,8 @@ Option::Option(const std::string& fullName, const std::string& shortName, const
_argName(argName),
_argRequired(argOptional),
_pValidator(0),
_pCallback(0)
_pCallback(0),
_pConfig(0)
{
}
@ -118,6 +125,7 @@ Option::Option(const std::string& fullName, const std::string& shortName, const
Option::~Option()
{
if (_pValidator) _pValidator->release();
if (_pConfig) _pConfig->release();
delete _pCallback;
}
@ -146,6 +154,7 @@ void Option::swap(Option& option)
std::swap(_binding, option._binding);
std::swap(_pValidator, option._pValidator);
std::swap(_pCallback, option._pCallback);
std::swap(_pConfig, option._pConfig);
}
@ -208,8 +217,17 @@ Option& Option::group(const std::string& group)
Option& Option::binding(const std::string& propertyName)
{
return binding(propertyName, 0);
}
Option& Option::binding(const std::string& propertyName, AbstractConfiguration* pConfig)
{
_binding = propertyName;
if (_pConfig) _pConfig->release();
_pConfig = pConfig;
if (_pConfig) _pConfig->duplicate();
return *this;
}

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

@ -1,7 +1,7 @@
//
// ServerApplication.cpp
//
// $Id: //poco/1.3/Util/src/ServerApplication.cpp#1 $
// $Id: //poco/1.3/Util/src/ServerApplication.cpp#2 $
//
// Library: Util
// Package: Application
@ -403,14 +403,18 @@ void ServerApplication::waitForTerminationRequest()
int ServerApplication::run(int argc, char** argv)
{
if (isDaemon(argc, argv))
bool runAsDaemon = isDaemon(argc, argv);
if (runAsDaemon)
{
beDaemon();
}
try
{
init(argc, argv);
chdir("/");
if (runAsDaemon)
{
chdir("/");
}
}
catch (Exception& exc)
{

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

@ -1,7 +1,7 @@
//
// WinRegistryConfiguration.cpp
//
// $Id: //poco/1.3/Util/src/WinRegistryConfiguration.cpp#1 $
// $Id: //poco/1.3/Util/src/WinRegistryConfiguration.cpp#2 $
//
// Library: Util
// Package: Windows
@ -47,7 +47,8 @@ namespace Util {
WinRegistryConfiguration::WinRegistryConfiguration(const std::string& rootPath): _rootPath(rootPath)
{
// rootPath must end with backslash
if (*(--_rootPath.end()) != '\\')
std::string::iterator it = _rootPath.end();
if (*(--it) != '\\')
_rootPath.append("\\");
}

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

@ -128,6 +128,124 @@
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="debug_static|Win32"
OutputDirectory="obj\debug_static"
IntermediateDirectory="obj\debug_static"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\XML\include;..\..\Util\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="CppUnitmtd.lib WinTestRunnermtd.lib PocoUtilmtd.lib PocoFoundationmtd.lib PocoXMLmtd.lib winmm.lib"
OutputFile="bin/TestSuitemtd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="bin/TestSuitemtd.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="release_static|Win32"
OutputDirectory="obj\release_static"
IntermediateDirectory="obj\release_static"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\XML\include;..\..\Util\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="CppUnitmt.lib WinTestRunnermt.lib PocoUtilmt.lib PocoFoundationmt.lib PocoXMLmt.lib winmm.lib"
OutputFile="bin/TestSuitemt.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="FALSE"
ProgramDatabaseFile=""
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>

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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="TestSuite"
ProjectGUID="{E40E738C-447B-40F4-A878-EBA9A2459270}"
Keyword="Win32Proj"
@ -191,6 +191,183 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="release_static|Win32"
OutputDirectory="obj\release_static"
IntermediateDirectory="obj\release_static"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\XML\include;..\..\Util\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="CppUnitmt.lib WinTestRunnermt.lib PocoUtilmt.lib PocoFoundationmt.lib PocoXMLmt.lib winmm.lib"
OutputFile="bin/TestSuitemt.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="false"
ProgramDatabaseFile=""
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="debug_static|Win32"
OutputDirectory="obj\debug_static"
IntermediateDirectory="obj\debug_static"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\XML\include;..\..\Util\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="CppUnitmtd.lib WinTestRunnermtd.lib PocoUtilmtd.lib PocoFoundationmtd.lib PocoXMLmtd.lib winmm.lib"
OutputFile="bin/TestSuitemtd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="bin/TestSuitemtd.pdb"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>

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

@ -1,7 +1,7 @@
//
// LayeredConfigurationTest.cpp
//
// $Id: //poco/1.3/Util/testsuite/src/LayeredConfigurationTest.cpp#1 $
// $Id: //poco/1.3/Util/testsuite/src/LayeredConfigurationTest.cpp#2 $
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
@ -95,7 +95,7 @@ void LayeredConfigurationTest::testOneLayer()
pMC->setString("prop1", "value1");
pMC->setString("prop2", "value2");
pLC->add(pMC);
pLC->addWriteable(pMC, 0);
AbstractConfiguration::Keys keys;
pLC->keys(keys);
@ -122,8 +122,8 @@ void LayeredConfigurationTest::testTwoLayers()
pMC2->setString("prop2", "value3");
pMC2->setString("prop3", "value4");
pLC->add(pMC1);
pLC->add(pMC2);
pLC->add(pMC1, 0);
pLC->addWriteable(pMC2, 1);
AbstractConfiguration::Keys keys;
pLC->keys(keys);
@ -148,6 +148,33 @@ void LayeredConfigurationTest::testTwoLayers()
}
void LayeredConfigurationTest::testThreeLayers()
{
AutoPtr<LayeredConfiguration> pLC = new LayeredConfiguration;
AutoPtr<MapConfiguration> pMC1 = new MapConfiguration;
AutoPtr<MapConfiguration> pMC2 = new MapConfiguration;
AutoPtr<MapConfiguration> pMC3 = new MapConfiguration;
pMC1->setString("prop1", "value1");
pMC1->setString("prop2", "value2");
pMC1->setString("prop3", "value3");
pMC2->setString("prop2", "value4");
pMC2->setString("prop4", "value5");
pMC3->setString("prop5", "value6");
pMC3->setString("prop1", "value7");
pLC->add(pMC1, 0);
pLC->add(pMC2, 1);
pLC->add(pMC3, -1);
assert (pLC->getString("prop1") == "value7");
assert (pLC->getString("prop2") == "value2");
assert (pLC->getString("prop3") == "value3");
assert (pLC->getString("prop4") == "value5");
assert (pLC->getString("prop5") == "value6");
}
void LayeredConfigurationTest::setUp()
{
}
@ -165,6 +192,7 @@ CppUnit::Test* LayeredConfigurationTest::suite()
CppUnit_addTest(pSuite, LayeredConfigurationTest, testEmpty);
CppUnit_addTest(pSuite, LayeredConfigurationTest, testOneLayer);
CppUnit_addTest(pSuite, LayeredConfigurationTest, testTwoLayers);
CppUnit_addTest(pSuite, LayeredConfigurationTest, testThreeLayers);
return pSuite;
}

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

@ -1,7 +1,7 @@
//
// LayeredConfigurationTest.h
//
// $Id: //poco/1.3/Util/testsuite/src/LayeredConfigurationTest.h#1 $
// $Id: //poco/1.3/Util/testsuite/src/LayeredConfigurationTest.h#2 $
//
// Definition of the LayeredConfigurationTest class.
//
@ -49,6 +49,7 @@ public:
void testEmpty();
void testOneLayer();
void testTwoLayers();
void testThreeLayers();
void setUp();
void tearDown();

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

@ -1,7 +1,7 @@
//
// UtilTestSuite.cpp
//
// $Id: //poco/1.3/Util/testsuite/src/UtilTestSuite.cpp#1 $
// $Id: //poco/1.3/Util/testsuite/src/UtilTestSuite.cpp#2 $
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
@ -40,7 +40,7 @@
CppUnit::Test* UtilTestSuite::suite()
{
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ConfigurationTestSuite");
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("UtilTestSuite");
pSuite->addTest(ConfigurationTestSuite::suite());
pSuite->addTest(OptionsTestSuite::suite());