1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-16 13:57:11 +02:00

Update POCO library.

This commit is contained in:
Sandu Liviu Catalin
2023-03-23 20:19:11 +02:00
parent 8d15f4b6e9
commit 233fc103f9
2521 changed files with 257092 additions and 72789 deletions

View File

@ -49,7 +49,7 @@ class Util_API AbstractConfiguration: public Poco::RefCountedObject
public:
using Keys = std::vector<std::string>;
using Ptr = AutoPtr<AbstractConfiguration>;
class KeyValue
/// A key-value pair, used as event argument.
{
@ -59,27 +59,27 @@ public:
_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<KeyValue> propertyChanging;
/// Fired before a property value is changed or
/// a new property is created.
@ -101,7 +101,7 @@ public:
/// Note: This will even be fired if the key
/// does not exist and the remove operation will
/// fail with an exception.
Poco::BasicEvent<const std::string> propertyRemoved;
/// Fired after a property has been removed by
/// a call to remove().
@ -121,13 +121,13 @@ public:
/// Returns true iff the property with the given key exists.
///
/// Same as hasProperty().
std::string getString(const std::string& key) const;
/// Returns the string value of the property with the given name.
/// Throws a NotFoundException if the key does not exist.
/// If the value contains references to other properties (${<property>}), these
/// are expanded.
std::string getString(const std::string& key, const std::string& defaultValue) const;
/// If a property with the given key exists, returns the property's string value,
/// otherwise returns the given default value.
@ -138,12 +138,12 @@ public:
/// Returns the raw string value of the property with the given name.
/// Throws a NotFoundException if the key does not exist.
/// References to other properties are not expanded.
std::string getRawString(const std::string& key, const std::string& defaultValue) const;
/// If a property with the given key exists, returns the property's raw string value,
/// otherwise returns the given default value.
/// References to other properties are not expanded.
int getInt(const std::string& key) const;
/// Returns the int value of the property with the given name.
/// Throws a NotFoundException if the key does not exist.
@ -152,7 +152,7 @@ public:
/// Numbers starting with 0x are treated as hexadecimal.
/// If the value contains references to other properties (${<property>}), these
/// are expanded.
unsigned int getUInt(const std::string& key) const;
/// Returns the unsigned int value of the property with the given name.
/// Throws a NotFoundException if the key does not exist.
@ -161,7 +161,7 @@ public:
/// Numbers starting with 0x are treated as hexadecimal.
/// If the value contains references to other properties (${<property>}), these
/// are expanded.
int getInt(const std::string& key, int defaultValue) const;
/// If a property with the given key exists, returns the property's int value,
/// otherwise returns the given default value.
@ -170,7 +170,7 @@ public:
/// Numbers starting with 0x are treated as hexadecimal.
/// If the value contains references to other properties (${<property>}), these
/// are expanded.
unsigned int getUInt(const std::string& key, unsigned int defaultValue) const;
/// If a property with the given key exists, returns the property's unsigned int
/// value, otherwise returns the given default value.
@ -227,7 +227,7 @@ public:
/// to a double.
/// If the value contains references to other properties (${<property>}), these
/// are expanded.
double getDouble(const std::string& key, double defaultValue) const;
/// If a property with the given key exists, returns the property's double value,
/// otherwise returns the given default value.
@ -243,7 +243,7 @@ public:
/// to a boolean.
/// If the value contains references to other properties (${<property>}), these
/// are expanded.
bool getBool(const std::string& key, bool defaultValue) const;
/// If a property with the given key exists, returns the property's boolean value,
/// otherwise returns the given default value.
@ -255,15 +255,15 @@ public:
/// Case does not matter.
/// If the value contains references to other properties (${<property>}), these
/// are expanded.
virtual void setString(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.
virtual void setInt(const std::string& key, int value);
/// Sets the property with the given key to the given value.
/// An already existing value for the key is overwritten.
virtual void setUInt(const std::string& key, unsigned int value);
/// Sets the property with the given key to the given value.
/// An already existing value for the key is overwritten.
@ -287,19 +287,25 @@ public:
virtual void setBool(const std::string& key, bool value);
/// Sets the property with the given key to the given value.
/// An already existing value for the key is overwritten.
void keys(Keys& range) const;
/// Returns in range the names of all keys at root level.
void keys(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.
const Ptr createView(const std::string& prefix) const;
/// Creates a non-mutable view (see ConfigurationView) into the configuration.
Ptr createView(const std::string& prefix);
/// Creates a view (see ConfigurationView) into the configuration.
const Ptr createLocalView(const std::string& prefix) const;
/// Creates a non-mutable view (see LocalConfigurationView) into the configuration.
Ptr createLocalView(const std::string& prefix);
/// Creates a view (see LocalConfigurationView) into the configuration.
std::string expand(const std::string& value) const;
/// Replaces all occurrences of ${<property>} in value with the
@ -313,13 +319,13 @@ public:
/// Removes the property with the given key.
///
/// Does nothing if the key does not exist.
void enableEvents(bool enable = true);
/// Enables (or disables) events.
bool eventsEnabled() const;
/// Returns true iff events are enabled.
protected:
virtual bool getRaw(const std::string& key, std::string& value) const = 0;
/// If the property with the given key exists, stores the property's value
@ -332,11 +338,11 @@ protected:
/// An already existing value for the key is overwritten.
///
/// Must be overridden by subclasses.
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.
///
@ -367,7 +373,7 @@ protected:
static bool parseBool(const std::string& value);
void setRawWithEvent(const std::string& key, std::string value);
virtual ~AbstractConfiguration();
private:
@ -380,9 +386,10 @@ private:
mutable int _depth;
bool _eventsEnabled;
mutable Poco::Mutex _mutex;
friend class LayeredConfiguration;
friend class ConfigurationView;
friend class LocalConfigurationView;
friend class ConfigurationMapper;
};

View File

@ -520,7 +520,7 @@ inline Poco::Timespan Application::uptime() const
} \
return pApp->run(); \
}
#elif defined(POCO_VXWORKS)
#elif defined(POCO_VXWORKS) && !defined(POCO_VXWORKS_RTP)
#define POCO_APP_MAIN(App) \
int pocoAppMain(const char* appName, ...) \
{ \

View File

@ -29,7 +29,7 @@ namespace Util {
class Util_API ConfigurationMapper: public AbstractConfiguration
/// This configuration maps a property hierarchy into another
/// hierarchy.
///
///
/// For example, given a configuration with the following properties:
/// config.value1
/// config.value2
@ -73,9 +73,9 @@ protected:
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;
~ConfigurationMapper();
private:

View File

@ -27,9 +27,9 @@ namespace Util {
class Util_API ConfigurationView: public AbstractConfiguration
/// This configuration implements a "view" into a sub-hierarchy
/// This configuration implements a "view" into a sub-hierarchy
/// of another configuration.
///
///
/// For example, given a configuration with the following properties:
/// config.value1
/// config.value2
@ -62,9 +62,9 @@ protected:
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;
~ConfigurationView();
private:

View File

@ -38,7 +38,7 @@ class Util_API FilesystemConfiguration: public AbstractConfiguration
/// All changes to properties are immediately persisted in the filesystem.
///
/// For example, a configuration consisting of the properties
///
///
/// logging.loggers.root.channel.class = ConsoleChannel
/// logging.loggers.app.name = Application
/// logging.loggers.app.channel = c1
@ -63,7 +63,7 @@ class Util_API FilesystemConfiguration: public AbstractConfiguration
/// class/
/// data ("PatternFormatter")
/// pattern/
/// data ("[%p] %t")
/// data ("[%p] %t")
{
public:
FilesystemConfiguration(const std::string& path);

View File

@ -36,7 +36,7 @@ class Util_API HelpFormatter
public:
HelpFormatter(const OptionSet& options);
/// Creates the HelpFormatter, using the given
/// options.
/// options.
///
/// The HelpFormatter just stores a reference
/// to the given OptionSet, so the OptionSet must not
@ -47,34 +47,34 @@ public:
void setCommand(const std::string& command);
/// Sets the command name.
const std::string& getCommand() const;
/// Returns the command name.
void setUsage(const std::string& usage);
/// Sets the usage string.
const std::string& getUsage() const;
/// Returns the usage string.
void setHeader(const std::string& header);
/// Sets the header string.
const std::string& getHeader() const;
/// Returns the header string.
void setFooter(const std::string& footer);
/// Sets the footer string.
const std::string& getFooter() const;
/// Returns the footer string.
void format(std::ostream& ostr) const;
/// Writes the formatted help text to the given stream.
void setWidth(int width);
/// Sets the line width for the formatted help text.
int getWidth() const;
/// Returns the line width for the formatted help text.
///
@ -85,10 +85,10 @@ public:
int getIndent() const;
/// Returns the indentation for description continuation lines.
void setAutoIndent();
/// Sets the indentation for description continuation lines so that
/// the description text is left-aligned.
/// the description text is left-aligned.
void setUnixStyle(bool flag);
/// Enables Unix-style options. Both short and long option names
@ -97,14 +97,14 @@ public:
///
/// After calling setUnixStyle(), setAutoIndent() should be called
/// as well to ensure proper help text formatting.
bool isUnixStyle() const;
/// Returns if Unix-style options are set.
std::string shortPrefix() const;
/// Returns the platform-specific prefix for short options.
/// "-" on Unix, "/" on Windows and OpenVMS.
std::string longPrefix() const;
/// Returns the platform-specific prefix for long options.
/// "--" on Unix, "/" on Windows and OpenVMS.
@ -129,10 +129,10 @@ protected:
void formatWord(std::ostream& ostr, int& pos, const std::string& word, int indent) const;
/// Formats the given word.
void clearWord(std::ostream& ostr, int& pos, std::string& word, int indent) const;
/// Formats and then clears the given word.
private:
HelpFormatter(const HelpFormatter&);
HelpFormatter& operator = (const HelpFormatter&);
@ -145,7 +145,7 @@ private:
std::string _header;
std::string _footer;
bool _unixStyle;
static const int TAB_WIDTH;
static const int LINE_WIDTH;
};

View File

@ -56,17 +56,17 @@ public:
IniFileConfiguration(std::istream& istr);
/// Creates an IniFileConfiguration and loads the configuration data
/// from the given stream, which must be in initialization file format.
IniFileConfiguration(const std::string& path);
/// Creates an IniFileConfiguration and loads the configuration data
/// from the given file, which must be in initialization file format.
void load(std::istream& istr);
/// Loads the configuration data from the given stream, which
/// Loads the configuration data from the given stream, which
/// must be in initialization file format.
void load(const std::string& path);
/// Loads the configuration data from the given file, which
/// Loads the configuration data from the given file, which
/// must be in initialization file format.
protected:
@ -84,7 +84,7 @@ private:
bool operator () (const std::string& s1, const std::string& s2) const;
};
typedef std::map<std::string, std::string, ICompare> IStringMap;
IStringMap _map;
std::string _sectionKey;
};

View File

@ -108,10 +108,10 @@ public:
virtual void setString(const std::string& key, const std::string& value);
virtual void removeRaw(const std::string& key);
virtual void removeRaw(const std::string& key);
protected:

View File

@ -35,8 +35,8 @@ class Util_API LayeredConfiguration: public AbstractConfiguration
/// 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 first writeable
/// configuration (see addWriteable()).
/// 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.
///
@ -51,7 +51,7 @@ public:
LayeredConfiguration();
/// Creates the LayeredConfiguration.
void add(AbstractConfiguration::Ptr pConfig);
/// Adds a read-only configuration to the back of the LayeredConfiguration.
/// The LayeredConfiguration takes shared ownership of the given configuration.
@ -92,8 +92,8 @@ public:
///
/// Does nothing if the given configuration is not part of the
/// LayeredConfiguration.
protected:
protected:
struct ConfigItem
{
typedef AbstractConfiguration::Ptr ACPtr;
@ -107,11 +107,11 @@ protected:
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;
void insert(const ConfigItem& item);
~LayeredConfiguration();
private:
@ -119,7 +119,7 @@ private:
LayeredConfiguration& operator = (const LayeredConfiguration&);
typedef std::list<ConfigItem> ConfigList;
ConfigList _configs;
};

View File

@ -0,0 +1,71 @@
//
// LocalConfigurationView.h
//
// Library: Util
// Package: Configuration
// Module: LocalConfigurationView
//
// Definition of the ConfigurationView class.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Util_LocalConfigurationView_INCLUDED
#define Util_LocalConfigurationView_INCLUDED
#include "Poco/Util/AbstractConfiguration.h"
#include "Poco/Util/Util.h"
namespace Poco {
namespace Util {
class Util_API LocalConfigurationView : public AbstractConfiguration
/// This configuration implements a "view" into a sub-hierarchy
/// of another configuration.
///
/// For example, given a configuration with the following properties:
/// config.value1
/// config.value2
/// config.sub.value1
/// config.sub.value2
/// and a LocalConfigurationView with the prefix "config", then
/// the above properties will be available via the view as
/// value1
/// value2
/// sub.value1
/// sub.value2
///
/// A LocalConfigurationView is most useful in combination with a
/// LayeredConfiguration.
///
/// The LocalConfigurationView only searches for the properties in the viewed Space.
{
public:
LocalConfigurationView(const std::string& prefix, AbstractConfiguration::Ptr pConfig);
/// Creates the LocalConfigurationView. The LocalConfigurationView
/// retains (shared) ownership of the passed configuration.
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;
~LocalConfigurationView();
private:
LocalConfigurationView(const LocalConfigurationView&);
LocalConfigurationView& operator=(const LocalConfigurationView&);
std::string _prefix;
AbstractConfiguration::Ptr _pConfig;
};
}} // namespace Poco::Util
#endif // Util_LocalConfigurationView_INCLUDED

View File

@ -32,17 +32,17 @@ class Util_API LoggingConfigurator
/// This utility class uses a configuration object to configure the
/// logging subsystem of an application.
///
/// The LoggingConfigurator sets up and connects formatters, channels
/// The LoggingConfigurator sets up and connects formatters, channels
/// and loggers. To accomplish its work, the LoggingConfigurator relies on the
/// functionality provided by the LoggingFactory and LoggingRegistry classes.
///
/// The LoggingConfigurator expects all configuration data to be under a root
/// property named "logging".
///
///
/// Configuring Formatters
///
/// A formatter is configured using the "logging.formatters" property. Every
/// formatter has an internal name, which is only used for referring to it
/// A formatter is configured using the "logging.formatters" property. Every
/// formatter has an internal name, which is only used for referring to it
/// during configuration time. This name becomes part of the property name.
/// Every formatter has a mandatory "class" property, which specifies the actual
/// class implementing the formatter. Any other properties are passed on to
@ -68,11 +68,11 @@ class Util_API LoggingConfigurator
/// formatter definition. In either case, when a "formatter" property is
/// present, the channel is automatically "wrapped" in a FormattingChannel
/// object.
///
///
/// Similarly, a channel supports also a "pattern" property, which results
/// in the automatic instantiation of a FormattingChannel object with a
/// connected PatternFormatter.
///
///
/// Examples:
/// logging.channels.c1.class = ConsoleChannel
/// logging.channels.c1.formatter = f1
@ -109,7 +109,7 @@ public:
~LoggingConfigurator();
/// Destroys the LoggingConfigurator.
void configure(AbstractConfiguration::Ptr pConfig);
/// Configures the logging subsystem based on
/// the given configuration.
@ -125,7 +125,7 @@ private:
Poco::Channel::Ptr createChannel(AbstractConfiguration::Ptr pConfig);
void configureChannel(Channel::Ptr pChannel, AbstractConfiguration::Ptr pConfig);
void configureLogger(AbstractConfiguration::Ptr pConfig);
LoggingConfigurator(const LoggingConfigurator&);
LoggingConfigurator& operator = (const LoggingConfigurator&);
};

View File

@ -38,7 +38,7 @@ class Util_API LoggingSubsystem: public Subsystem
public:
LoggingSubsystem();
const char* name() const;
protected:
void initialize(Application& self);
void uninitialize();

View File

@ -53,7 +53,7 @@ protected:
iterator begin() const;
iterator end() const;
private:
private:
StringMap _map;
};

View File

@ -90,19 +90,19 @@ public:
Option& operator = (const Option& option);
/// Assignment operator.
void swap(Option& option);
void swap(Option& option) noexcept;
/// Swaps the option with another one.
Option& shortName(const std::string& name);
/// Sets the short name of the option.
Option& fullName(const std::string& name);
/// Sets the full name of the option.
Option& description(const std::string& text);
/// Sets the description of the option.
Option& required(bool flag);
/// Sets whether the option is required (flag == true)
/// or optional (flag == false).
@ -110,28 +110,28 @@ public:
Option& repeatable(bool flag);
/// Sets whether the option can be specified more than once
/// (flag == true) or at most once (flag == false).
Option& argument(const std::string& name, bool required = true);
/// Specifies that the option takes an (optional or required)
/// argument.
Option& noArgument();
/// Specifies that the option does not take an argument (default).
Option& group(const std::string& group);
/// Specifies the option group the option is part of.
Option& binding(const std::string& propertyName);
/// Binds the option to the configuration property with the given name.
///
/// 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,
Option& binding(const std::string& propertyName, AbstractConfiguration::Ptr 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.
///
@ -149,49 +149,49 @@ public:
const std::string& shortName() const;
/// Returns the short name of the option.
const std::string& fullName() const;
/// Returns the full name of the option.
const std::string& description() const;
/// Returns the description of the option.
bool required() const;
/// Returns true if the option is required, false if not.
bool repeatable() const;
/// Returns true if the option can be specified more than
/// once, or false if at most once.
bool takesArgument() const;
/// Returns true if the options takes an (optional) argument.
bool argumentRequired() const;
/// Returns true if the argument is required.
const std::string& argumentName() const;
/// Returns the argument name, if specified.
const std::string& group() const;
/// Returns the option group the option is part of,
/// or an empty string, if the option is not part of
/// a group.
const std::string& binding() const;
/// Returns the property name the option is bound to,
/// or an empty string in case it is not bound.
AbstractOptionCallback* callback() const;
/// Returns a pointer to the callback method for the option,
/// or NULL if no callback has been specified.
Validator* validator() const;
/// Returns the option's Validator, if one has been specified,
/// or NULL otherwise.
/// or NULL otherwise.
AbstractConfiguration::Ptr 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.
@ -214,7 +214,7 @@ public:
///
/// The option string must partially match the full
/// name (case insensitive).
void process(const std::string& option, std::string& arg) const;
/// Verifies that the given option string matches the
/// requirements of the option, and extracts the option argument,
@ -225,7 +225,7 @@ public:
///
/// Throws a MissingArgumentException if a required argument
/// is missing. Throws an UnexpectedArgumentException if an
/// argument has been found, but none is expected.
/// argument has been found, but none is expected.
private:
std::string _shortName;
@ -253,19 +253,19 @@ inline const std::string& Option::shortName() const
return _shortName;
}
inline const std::string& Option::fullName() const
{
return _fullName;
}
inline const std::string& Option::description() const
{
return _description;
}
inline bool Option::required() const
{
return _required;
@ -277,13 +277,13 @@ inline bool Option::repeatable() const
return _repeatable;
}
inline bool Option::takesArgument() const
{
return !_argName.empty();
}
inline bool Option::argumentRequired() const
{
return _argRequired;

View File

@ -31,7 +31,7 @@ class Util_API AbstractOptionCallback
public:
virtual void invoke(const std::string& name, const std::string& value) const = 0;
/// Invokes the callback member function.
virtual AbstractOptionCallback* clone() const = 0;
/// Creates and returns a copy of the object.
@ -61,7 +61,7 @@ public:
{
poco_check_ptr (pObject);
}
OptionCallback(const OptionCallback& cb):
AbstractOptionCallback(cb),
_pObject(cb._pObject),
@ -69,12 +69,12 @@ public:
/// Creates an OptionCallback from another one.
{
}
~OptionCallback()
/// Destroys the OptionCallback.
{
}
OptionCallback& operator = (const OptionCallback& cb)
{
if (&cb != this)
@ -84,20 +84,20 @@ public:
}
return *this;
}
void invoke(const std::string& name, const std::string& value) const
{
(_pObject->*_method)(name, value);
}
AbstractOptionCallback* clone() const
{
return new OptionCallback(_pObject, _method);
}
private:
OptionCallback();
C* _pObject;
Callback _method;
};

View File

@ -56,7 +56,7 @@ class Util_API OptionProcessor
/// In Unix mode, the option prefix is a dash '-'. A dash must be followed
/// by a short option name, or another dash, followed by a (partial)
/// long option name.
/// In default mode, the option prefix is a slash '/', followed by
/// In default mode, the option prefix is a slash '/', followed by
/// a (partial) long option name.
/// If the special option '--' is encountered in Unix mode, all following
/// options are ignored.
@ -64,7 +64,7 @@ class Util_API OptionProcessor
/// Option arguments can be specified in three ways. If a Unix short option
/// ("-o") is given, the argument directly follows the option name, without
/// any delimiting character or space ("-ovalue"). In default option mode, or if a
/// Unix long option ("--option") is given, the option argument is
/// Unix long option ("--option") is given, the option argument is
/// delimited from the option name with either an equal sign ('=') or
/// a colon (':'), as in "--option=value" or "/option:value". Finally,
/// a required option argument can be specified on the command line after the
@ -97,7 +97,7 @@ public:
/// Examines and processes the given command line argument.
///
/// If the argument begins with an option prefix, the option is processed
/// and true is returned. The full option name is stored in optionName and the
/// and true is returned. The full option name is stored in optionName and the
/// option argument, if present, is stored in optionArg.
///
/// If the option does not begin with an option prefix, false is returned.
@ -112,7 +112,7 @@ private:
bool processUnix(const std::string& argument, std::string& optionName, std::string& optionArg);
bool processDefault(const std::string& argument, std::string& optionName, std::string& optionArg);
bool processCommon(const std::string& option, bool isShort, std::string& optionName, std::string& optionArg);
const OptionSet& _options;
bool _unixStyle;
bool _ignore;

View File

@ -48,7 +48,7 @@ public:
void addOption(const Option& option);
/// Adds an option to the collection.
bool hasOption(const std::string& name, bool matchShort = false) const;
/// Returns a true iff an option with the given name exists.
///
@ -58,7 +58,7 @@ public:
/// The name must either match the short or full name of an
/// option. Comparison case sensitive for the short name and
/// not case sensitive for the full name.
const Option& getOption(const std::string& name, bool matchShort = false) const;
/// Returns a reference to the option with the given name.
///
@ -73,11 +73,11 @@ public:
Iterator begin() const;
/// Supports iterating over all options.
Iterator end() const;
/// Supports iterating over all options.
private:
private:
OptionVec _options;
};

View File

@ -61,19 +61,19 @@ public:
PropertyFileConfiguration(std::istream& istr);
/// Creates an PropertyFileConfiguration and loads the configuration data
/// from the given stream, which must be in properties file format.
PropertyFileConfiguration(const std::string& path);
/// Creates an PropertyFileConfiguration and loads the configuration data
/// from the given file, which must be in properties file format.
void load(std::istream& istr);
/// Loads the configuration data from the given stream, which
/// Loads the configuration data from the given stream, which
/// must be in properties file format.
void load(const std::string& path);
/// Loads the configuration data from the given file, which
/// Loads the configuration data from the given file, which
/// must be in properties file format.
void save(std::ostream& ostr) const;
/// Writes the configuration data to the given stream.
///
@ -86,7 +86,7 @@ public:
protected:
~PropertyFileConfiguration();
private:
void parseLine(std::istream& istr);
static int readChar(std::istream& istr);

View File

@ -44,7 +44,7 @@ public:
private:
RegExpValidator();
std::string _regexp;
std::string _regexp;
};

View File

@ -81,7 +81,7 @@ class Util_API ServerApplication: public Application
///
/// An application can determine whether it is running as a service by checking
/// for the "application.runAsService" configuration property.
///
///
/// if (config().getBool("application.runAsService", false))
/// {
/// // do service specific things
@ -103,7 +103,7 @@ class Util_API ServerApplication: public Application
/// command line option. A daemon, when launched, immediately
/// forks off a background process that does the actual work. After launching
/// the background process, the foreground process exits.
///
///
/// After the initialization is complete, but before entering the main() method,
/// the current working directory for the daemon process is changed to the root
/// directory ("/"), as it is common practice for daemon processes. Therefore, be
@ -119,8 +119,8 @@ class Util_API ServerApplication: public Application
/// }
///
/// When running as a daemon, specifying the --pidfile option (e.g.,
/// --pidfile=/var/run/sample.pid) may be useful to record the process ID of
/// the daemon in a file. The PID file will be removed when the daemon process
/// --pidfile=/var/run/sample.pid) may be useful to record the process ID of
/// the daemon in a file. The PID file will be removed when the daemon process
/// terminates (but not, if it crashes).
{
public:
@ -129,7 +129,7 @@ public:
~ServerApplication();
/// Destroys the ServerApplication.
bool isInteractive() const;
/// Returns true if the application runs from the command line.
/// Returns false if the application runs as a Unix daemon
@ -138,7 +138,7 @@ public:
int run(int argc, char** argv);
/// Runs the application by performing additional initializations
/// and calling the main() method.
int run(const std::vector<std::string>& args);
/// Runs the application by performing additional initializations
/// and calling the main() method.
@ -154,10 +154,10 @@ public:
static void terminate();
/// Sends a friendly termination request to the application.
/// If the application's main thread is waiting in
/// 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();
@ -198,16 +198,16 @@ private:
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);
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 SERVICE_STATUS _serviceStatus;
static SERVICE_STATUS_HANDLE _serviceStatusHandle;
static SERVICE_STATUS _serviceStatus;
static SERVICE_STATUS_HANDLE _serviceStatusHandle;
#endif // _WIN32_WCE
static Poco::NamedEvent _terminate;
#endif

View File

@ -27,7 +27,7 @@ namespace Util {
class Util_API SystemConfiguration: public AbstractConfiguration
/// This class implements a Configuration interface to
/// This class implements a Configuration interface to
/// various system properties and environment variables.
///
/// The following properties are supported:
@ -35,7 +35,7 @@ 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")
/// - 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
@ -51,9 +51,9 @@ class Util_API SystemConfiguration: public AbstractConfiguration
///
/// An attempt to set a system variable will result in an
/// InvalidAccessException being thrown.
///
/// Enumerating environment variables is not supported.
/// An attempt to call keys("system.env") will return an empty range.
///
/// 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.

View File

@ -23,6 +23,7 @@
#include "Poco/RefCountedObject.h"
#include "Poco/AutoPtr.h"
#include "Poco/Timestamp.h"
#include "Poco/Mutex.h"
namespace Poco {
@ -62,6 +63,9 @@ public:
///
/// Returns 0 if the timer has never been executed.
void updateLastExecution();
/// Updates the last execution of the timer task.
protected:
~TimerTask();
/// Destroys the TimerTask.
@ -71,9 +75,8 @@ private:
TimerTask& operator = (const TimerTask&);
Poco::Timestamp _lastExecution;
bool _isCancelled;
friend class TaskNotification;
std::atomic<bool> _isCancelled;
mutable FastMutex _mutex;
};
@ -114,10 +117,18 @@ inline bool TimerTask::isCancelled() const
inline Poco::Timestamp TimerTask::lastExecution() const
{
FastMutex::ScopedLock l(_mutex);
return _lastExecution;
}
inline void TimerTask::updateLastExecution()
{
FastMutex::ScopedLock l(_mutex);
_lastExecution.update();
}
} } // namespace Poco::Util

View File

@ -30,31 +30,31 @@ template <class C>
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.
/// 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
/// 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();

View File

@ -42,8 +42,8 @@ namespace Units {
namespace Internal
{
template <typename T1, typename T2> struct Convert;
struct None;
template <typename T1, typename T2> struct Convert;
struct None;
template <int Num, int Den, int Div=Num/Den, int Mod=Num%Den>
struct FixedPower;
}
@ -80,7 +80,7 @@ class Value
/// - U is the unit of the Value
///
/// This class is usually not used directly;
/// client code should use the typedef'd
/// client code should use the typedef'd
/// instantiations defined in the Values and
/// Constants namespace.
///
@ -103,25 +103,25 @@ public:
typedef V ValueType;
typedef U Unit;
Value(): _rep()
{
Value(): _rep()
{
}
explicit Value(const ValueType& v): _rep(v)
{
explicit Value(const ValueType& v): _rep(v)
{
}
template <typename OV, typename OU>
Value(const Value<OV, OU>& v):
_rep(Internal::Convert<OU, U>::fn(v.get()))
{
}
const ValueType& get() const
{
return _rep;
const ValueType& get() const
{
return _rep;
}
template <typename OV, typename OU>
Value& operator = (const Value<OV, OU>& other)
{
@ -231,30 +231,30 @@ public:
return get() >= Value(other).get();
}
Value& operator ++ ()
{
++_rep;
return *this;
Value& operator ++ ()
{
++_rep;
return *this;
}
Value operator ++ (int)
{
Value v = *this;
++_rep;
return v;
Value operator ++ (int)
{
Value v = *this;
++_rep;
return v;
}
Value& operator -- ()
{
--_rep;
return *this;
Value& operator -- ()
{
--_rep;
return *this;
}
Value operator -- (int)
{
Value v = *this;
--_rep;
return v;
Value operator -- (int)
{
Value v = *this;
--_rep;
return v;
}
private:
@ -312,7 +312,7 @@ namespace Internal
template <typename U>
struct ScalingFactor;
template <typename T1, typename T2>
template <typename T1, typename T2>
struct Convert3
/// Converts T1 to T2.
/// Stage 3 - performed after Stage 1 and Stage 2.
@ -328,7 +328,7 @@ namespace Internal
}
};
template <typename T1, typename T2>
template <typename T1, typename T2>
struct Convert2
/// Converts T1 to T2.
/// Template matches the first argument (T1),
@ -341,7 +341,7 @@ namespace Internal
}
};
template <typename T1, typename T2>
template <typename T1, typename T2>
struct Convert
/// Converts T1 to T2.
/// If you really want to implement your own conversion routine,
@ -365,7 +365,7 @@ namespace Internal
template <typename U>
static const U& fn(const U& u) { return u; }
};
template <typename T>
struct Convert3<T, T>
// Convert to same type.
@ -384,7 +384,7 @@ namespace Internal
return Convert<T, U>::fn((v * Den)/Num);
}
};
template <typename T, typename U, int Num, int Den>
struct Convert3<T, Scale<U, Num, Den> >
// Convert to a scaled Unit.
@ -433,8 +433,8 @@ namespace Internal
{
static const int num = 1;
static const int den = 1;
};
};
template <typename Term, typename U, int N, int D>
struct CountTerms<Term, Scale<U, N, D> >
// CountTerms ignores scaling factors - that is taken care of by ScalingFactor.
@ -476,7 +476,7 @@ namespace Internal
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",
/// Does a depth-first search of the Unit "Term",
/// or counts the terms in the default case.
{
typedef CountTerms<Term, T1> count1;
@ -526,7 +526,7 @@ namespace Internal
template <int Num, int Den, int Div, int Mod>
struct FixedPower
/// A functor that raises a Value to the power Num/Den.
/// The template is specialised for efficiency
/// The template is specialised for efficiency
/// so that we don't always have to call the std::power function.
{
template <typename T> static T Power(const T& t)
@ -678,7 +678,7 @@ namespace Internal
/// The default Unit formatting mechanism.
{
template <typename Stream>
static void fn(Stream &os)
static void fn(Stream &os)
{
os << "Units";
}
@ -691,7 +691,7 @@ struct OutputUnit
/// Functor to write Unit text to stream.
{
template <typename Stream>
static void fn(Stream &os)
static void fn(Stream &os)
{
Internal::OutputUnit2<U>::fn(os);
}
@ -707,11 +707,11 @@ namespace Internal
struct OutputUnit2< Compose<U1,U2> >
{
template <typename Stream>
static void fn(Stream &os)
{
OutputUnit<U1>::fn(os);
static void fn(Stream &os)
{
OutputUnit<U1>::fn(os);
os << '.';
OutputUnit<U2>::fn(os);
OutputUnit<U2>::fn(os);
}
};
@ -719,10 +719,10 @@ namespace Internal
struct OutputUnit2< Power<U, Num, Den > >
{
template <typename Stream>
static void fn(Stream &os)
{
static void fn(Stream &os)
{
if(Num!=Den) os << '(';
OutputUnit<U>::fn(os);
OutputUnit<U>::fn(os);
if(Num!=Den)
{
os << ')';
@ -739,10 +739,10 @@ namespace Internal
struct OutputUnit2< Translate<U, Num, Den > >
{
template <typename Stream>
static void fn(Stream &os)
{
static void fn(Stream &os)
{
os << '(';
OutputUnit<U>::fn(os);
OutputUnit<U>::fn(os);
os << '+' << Num;
if(Den!=1) os << '/' << Den;
os << ')';
@ -753,13 +753,13 @@ namespace Internal
struct OutputUnit2< Scale<U, Num, Den > >
{
template <typename Stream>
static void fn(Stream &os)
{
static void fn(Stream &os)
{
os << Den;
if(Num != 1)
os << '/' << Num;
os << '.';
OutputUnit<U>::fn(os);
OutputUnit<U>::fn(os);
}
};
} // namespace Internal
@ -893,15 +893,15 @@ namespace Units
{
public:
template <typename T>
Prefix(const T& val, double multiplier = 1, const std::string& prefix = ""):
Prefix(const T& val, double multiplier = 1, const std::string& prefix = ""):
_pHolder(new Holder<T>(val)),
_multiplier(multiplier),
_prefix(prefix)
{
{
}
double value() const
{
{
return _pHolder->get() * _multiplier;
}
@ -931,7 +931,7 @@ namespace Units
{
typedef Value<typename U::ValueType, typename U::Unit> ValueType;
Holder (const U& val): _val(ValueType(val))
Holder (const U& val): _val(ValueType(val))
{
}
@ -997,7 +997,7 @@ namespace Units
typedef Scale<minute, 1, 60> hour;
typedef Scale<hour, 1, 24> day;
typedef Scale<day, 1, 7> week;
struct month; // No fixed ratio with week
struct month; // No fixed ratio with week
typedef Scale<month, 1, 12> year;
typedef Scale<year, 1, 100> century;
typedef Scale<year, 1, 1000> millennium;
@ -1213,7 +1213,7 @@ namespace Values
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 (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")

View File

@ -36,7 +36,7 @@ class Util_API WinRegistryConfiguration: public AbstractConfiguration
{
public:
WinRegistryConfiguration(const std::string& rootPath, REGSAM extraSam = 0);
/// Creates the WinRegistryConfiguration.
/// Creates the WinRegistryConfiguration.
/// The rootPath must start with one of the root key names
/// like HKEY_CLASSES_ROOT, e.g. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services.
/// All further keys are relative to the root path and can be

View File

@ -46,8 +46,8 @@ public:
SVC_MANUAL_START,
SVC_DISABLED
};
enum FailureActionType
enum FailureActionType
{
SVC_NONE,
SVC_REBOOT,
@ -55,7 +55,7 @@ public:
SVC_RUN_COMMAND
};
struct FailureAction
struct FailureAction
{
FailureActionType type;
int delay;
@ -83,7 +83,7 @@ public:
/// Returns the service's display name.
std::string path() const;
/// Returns the path to the service executable.
/// Returns the path to the service executable.
///
/// Throws a NotFoundException if the service has not been registered.
@ -92,7 +92,7 @@ public:
/// and the given displayName.
///
/// Throws a ExistsException if the service has already been registered.
void registerService(const std::string& path);
/// Creates a Windows service with the executable specified by path
/// and the given displayName. The service name is used as display name.
@ -100,7 +100,7 @@ public:
/// Throws a ExistsException if the service has already been registered.
void unregisterService();
/// Deletes the Windows service.
/// Deletes the Windows service.
///
/// Throws a NotFoundException if the service has not been registered.
@ -112,7 +112,7 @@ public:
bool isStopped() const;
/// Returns true if the service is currently stopped.
void start();
/// Starts the service.
/// Does nothing if the service is already running.
@ -127,7 +127,7 @@ public:
void setStartup(Startup startup);
/// Sets the startup mode for the service.
Startup getStartup() const;
/// Returns the startup mode for the service.
@ -138,10 +138,10 @@ public:
FailureActionTypeVector getFailureActions() const;
/// Returns the Failure Actions 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.

View File

@ -41,9 +41,9 @@ 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 the XML document is not significant and ignored.
/// of the XML document is not significant and ignored.
/// Periods in tag names are not supported.
///
///
/// Given the following XML document as an example:
///
/// <config>
@ -120,7 +120,7 @@ public:
XMLConfiguration(const Poco::XML::Document* pDocument, char delim);
/// Creates the XMLConfiguration using the given XML document.
/// Uses the given delimiter char instead of the default '.'.
XMLConfiguration(const Poco::XML::Node* pNode);
/// Creates the XMLConfiguration using the given XML node.
@ -134,18 +134,18 @@ public:
void load(Poco::XML::InputSource* pInputSource, unsigned long namePoolSize);
/// Loads the XML document containing the configuration data
/// from the given InputSource. Uses the give namePoolSize (which
/// from the given InputSource. Uses the give namePoolSize (which
/// should be a suitable prime like 251, 509, 1021, 4093) for the
/// internal DOM Document's name pool.
void load(std::istream& istr);
/// Loads the XML document containing the configuration data
/// from the given stream.
void load(const std::string& path);
/// Loads the XML document containing the configuration data
/// from the given file.
void load(const Poco::XML::Document* pDocument);
/// Loads the XML document containing the configuration data
/// from the given XML document.
@ -153,11 +153,11 @@ public:
void load(const Poco::XML::Node* pNode);
/// Loads the XML document containing the configuration data
/// from the given XML node.
void loadEmpty(const std::string& rootElementName);
/// Loads an empty XML document containing only the
/// root element with the given name.
void save(const std::string& path) const;
/// Writes the XML document containing the configuration data
/// to the file given by path.