committed latest 1.3 snapshot

This commit is contained in:
Guenter Obiltschnig
2007-04-18 16:24:06 +00:00
parent b60344ddcd
commit 965b9458d5
10 changed files with 44 additions and 23 deletions

View File

@@ -1,7 +1,7 @@
// //
// Application.h // Application.h
// //
// $Id: //poco/Main/Util/include/Poco/Util/Application.h#12 $ // $Id: //poco/Main/Util/include/Poco/Util/Application.h#14 $
// //
// Library: Util // Library: Util
// Package: Application // Package: Application
@@ -299,7 +299,8 @@ protected:
/// Called before command line processing begins. /// Called before command line processing begins.
/// If a subclass wants to support command line arguments, /// If a subclass wants to support command line arguments,
/// it must override this method. /// it must override this method.
/// The default implementation does not define any options. /// The default implementation does not define any options itself,
/// but calls defineOptions() on all registered subsystems.
/// ///
/// Overriding implementations should call the base class implementation. /// Overriding implementations should call the base class implementation.
@@ -441,7 +442,7 @@ inline Poco::Timespan Application::uptime() const
// //
// Macro to implement main() // Macro to implement main()
// //
#if defined(POCO_WIN32_UTF8) #if defined(_WIN32) && defined(POCO_WIN32_UTF8)
#define POCO_APP_MAIN(App) \ #define POCO_APP_MAIN(App) \
int wmain(int argc, wchar_t** argv) \ int wmain(int argc, wchar_t** argv) \
{ \ { \

View File

@@ -1,7 +1,7 @@
// //
// ServerApplication.h // ServerApplication.h
// //
// $Id: //poco/Main/Util/include/Poco/Util/ServerApplication.h#3 $ // $Id: //poco/Main/Util/include/Poco/Util/ServerApplication.h#4 $
// //
// Library: Util // Library: Util
// Package: Application // Package: Application
@@ -194,7 +194,7 @@ private:
// //
// Macro to implement main() // Macro to implement main()
// //
#if defined(POCO_WIN32_UTF8) #if defined(_WIN32) && defined(POCO_WIN32_UTF8)
#define POCO_SERVER_MAIN(App) \ #define POCO_SERVER_MAIN(App) \
int wmain(int argc, wchar_t** argv) \ int wmain(int argc, wchar_t** argv) \
{ \ { \

View File

@@ -1,7 +1,7 @@
// //
// Subsystem.h // Subsystem.h
// //
// $Id: //poco/Main/Util/include/Poco/Util/Subsystem.h#2 $ // $Id: //poco/Main/Util/include/Poco/Util/Subsystem.h#3 $
// //
// Library: Util // Library: Util
// Package: Application // Package: Application
@@ -49,6 +49,7 @@ namespace Util {
class Application; class Application;
class OptionSet;
class Util_API Subsystem: public Poco::RefCountedObject class Util_API Subsystem: public Poco::RefCountedObject
@@ -92,6 +93,16 @@ protected:
/// less radical and possibly more performant /// less radical and possibly more performant
/// approach. /// approach.
virtual void defineOptions(OptionSet& options);
/// Called before the Application's command line processing begins.
/// If a subsystem wants to support command line arguments,
/// it must override this method.
/// The default implementation does not define any options.
///
/// To effectively handle options, a subsystem should either bind
/// the option to a configuration property or specify a callback
/// to handle the option.
virtual ~Subsystem(); virtual ~Subsystem();
/// Destroys the Subsystem. /// Destroys the Subsystem.

View File

@@ -1,7 +1,7 @@
// //
// SystemConfiguration.h // SystemConfiguration.h
// //
// $Id: //poco/Main/Util/include/Poco/Util/SystemConfiguration.h#2 $ // $Id: //poco/Main/Util/include/Poco/Util/SystemConfiguration.h#3 $
// //
// Library: Util // Library: Util
// Package: Configuration // Package: Configuration
@@ -66,7 +66,7 @@ class Util_API SystemConfiguration: public AbstractConfiguration
/// InvalidAccessException being thrown. /// InvalidAccessException being thrown.
/// ///
/// Enumerating environment variables is not supported. /// Enumerating environment variables is not supported.
/// An attemp to call keys("system.env") will return an empty range. /// An attempt to call keys("system.env") will return an empty range.
{ {
public: public:
SystemConfiguration(); SystemConfiguration();

View File

@@ -1,7 +1,7 @@
// //
// Application.cpp // Application.cpp
// //
// $Id: //poco/Main/Util/src/Application.cpp#25 $ // $Id: //poco/Main/Util/src/Application.cpp#26 $
// //
// Library: Util // Library: Util
// Package: Application // Package: Application
@@ -469,6 +469,10 @@ bool Application::findAppConfigFile(const std::string& appName, const std::strin
void Application::defineOptions(OptionSet& options) void Application::defineOptions(OptionSet& options)
{ {
for (SubsystemVec::iterator it = _subsystems.begin(); it != _subsystems.end(); ++it)
{
(*it)->defineOptions(options);
}
} }

View File

@@ -1,7 +1,7 @@
// //
// FilesystemConfiguration.cpp // FilesystemConfiguration.cpp
// //
// $Id: //poco/Main/Util/src/FilesystemConfiguration.cpp#7 $ // $Id: //poco/Main/Util/src/FilesystemConfiguration.cpp#8 $
// //
// Library: Util // Library: Util
// Package: Configuration // Package: Configuration
@@ -40,7 +40,7 @@
#include "Poco/DirectoryIterator.h" #include "Poco/DirectoryIterator.h"
#include "Poco/StringTokenizer.h" #include "Poco/StringTokenizer.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include <fstream> #include "Poco/FileStream.h"
using Poco::Path; using Poco::Path;
@@ -81,7 +81,7 @@ bool FilesystemConfiguration::getRaw(const std::string& key, std::string& value)
if (f.exists()) if (f.exists())
{ {
value.reserve((std::string::size_type) f.getSize()); value.reserve((std::string::size_type) f.getSize());
std::ifstream istr(Path::transcode(p.toString()).c_str()); Poco::FileInputStream istr(p.toString());
int c = istr.get(); int c = istr.get();
while (c != std::char_traits<char>::eof()) while (c != std::char_traits<char>::eof())
{ {
@@ -100,7 +100,7 @@ void FilesystemConfiguration::setRaw(const std::string& key, const std::string&
File dir(p); File dir(p);
dir.createDirectories(); dir.createDirectories();
p.setFileName("data"); p.setFileName("data");
std::ofstream ostr(Path::transcode(p.toString()).c_str()); Poco::FileOutputStream ostr(p.toString());
ostr.write(value.data(), (std::streamsize) value.length()); ostr.write(value.data(), (std::streamsize) value.length());
} }

View File

@@ -1,7 +1,7 @@
// //
// IniFileConfiguration.cpp // IniFileConfiguration.cpp
// //
// $Id: //poco/Main/Util/src/IniFileConfiguration.cpp#7 $ // $Id: //poco/Main/Util/src/IniFileConfiguration.cpp#8 $
// //
// Library: Util // Library: Util
// Package: Configuration // Package: Configuration
@@ -38,7 +38,7 @@
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include "Poco/String.h" #include "Poco/String.h"
#include "Poco/Path.h" #include "Poco/Path.h"
#include <fstream> #include "Poco/FileStream.h"
#include <locale> #include <locale>
#include <set> #include <set>
@@ -87,7 +87,7 @@ void IniFileConfiguration::load(std::istream& istr)
void IniFileConfiguration::load(const std::string& path) void IniFileConfiguration::load(const std::string& path)
{ {
std::ifstream istr(Path::transcode(path).c_str()); Poco::FileInputStream istr(path);
if (istr.good()) if (istr.good())
load(istr); load(istr);
else else

View File

@@ -1,7 +1,7 @@
// //
// PropertyFileConfiguration.cpp // PropertyFileConfiguration.cpp
// //
// $Id: //poco/Main/Util/src/PropertyFileConfiguration.cpp#7 $ // $Id: //poco/Main/Util/src/PropertyFileConfiguration.cpp#8 $
// //
// Library: Util // Library: Util
// Package: Configuration // Package: Configuration
@@ -38,7 +38,7 @@
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include "Poco/String.h" #include "Poco/String.h"
#include "Poco/Path.h" #include "Poco/Path.h"
#include <fstream> #include "Poco/FileStream.h"
#include <locale> #include <locale>
@@ -84,7 +84,7 @@ void PropertyFileConfiguration::load(std::istream& istr)
void PropertyFileConfiguration::load(const std::string& path) void PropertyFileConfiguration::load(const std::string& path)
{ {
std::ifstream istr(Path::transcode(path).c_str()); Poco::FileInputStream istr(path);
if (istr.good()) if (istr.good())
load(istr); load(istr);
else else
@@ -106,7 +106,7 @@ void PropertyFileConfiguration::save(std::ostream& ostr) const
void PropertyFileConfiguration::save(const std::string& path) const void PropertyFileConfiguration::save(const std::string& path) const
{ {
std::ofstream ostr(Path::transcode(path).c_str()); Poco::FileOutputStream ostr(path);
if (ostr.good()) if (ostr.good())
{ {
save(ostr); save(ostr);

View File

@@ -1,7 +1,7 @@
// //
// ServerApplication.cpp // ServerApplication.cpp
// //
// $Id: //poco/Main/Util/src/ServerApplication.cpp#18 $ // $Id: //poco/Main/Util/src/ServerApplication.cpp#19 $
// //
// Library: Util // Library: Util
// Package: Application // Package: Application
@@ -70,7 +70,7 @@ namespace Util {
#if defined(POCO_OS_FAMILY_WINDOWS) #if defined(POCO_OS_FAMILY_WINDOWS)
Poco::Event ServerApplication::_terminated; Poco::Event ServerApplication::_terminated;
SERVICE_STATUS ServerApplication::_serviceStatus; SERVICE_STATUS ServerApplication::_serviceStatus;
SERVICE_STATUS_HANDLE ServerApplication::_serviceStatusHandle = 0; SERVICE_STATUS_HANDLE ServerApplication::_serviceStatusHandle = 0;
#endif #endif

View File

@@ -1,7 +1,7 @@
// //
// Subsystem.cpp // Subsystem.cpp
// //
// $Id: //poco/Main/Util/src/Subsystem.cpp#7 $ // $Id: //poco/Main/Util/src/Subsystem.cpp#8 $
// //
// Library: Util // Library: Util
// Package: Application // Package: Application
@@ -58,4 +58,9 @@ void Subsystem::reinitialize(Application& app)
} }
void Subsystem::defineOptions(OptionSet& options)
{
}
} } // namespace Poco::Util } } // namespace Poco::Util