From a367294de3e2b3446bf9a72664d97caf44d88cfc Mon Sep 17 00:00:00 2001 From: Mike Naquin Date: Tue, 13 Nov 2012 15:31:08 -0600 Subject: [PATCH 1/2] Add JSONConfiguration to Poco::Util::Application::loadConfiguration. --- Foundation/include/Poco/Config.h | 5 +++++ Util/src/Application.cpp | 12 ++++++++++++ configure | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Foundation/include/Poco/Config.h b/Foundation/include/Poco/Config.h index 978efafb24..eb87ad9823 100644 --- a/Foundation/include/Poco/Config.h +++ b/Foundation/include/Poco/Config.h @@ -120,6 +120,11 @@ // #define POCO_UTIL_NO_INIFILECONFIGURATION +// No support for JSON configuration in +// Poco::Util::Application. +// #define POCO_UTIL_NO_JSONCONFIGURATION + + // No support for XML configuration in // Poco::Util::Application. Avoids linking of XML // library and saves a few 100 Kbytes. diff --git a/Util/src/Application.cpp b/Util/src/Application.cpp index c73056f97d..71580b7493 100644 --- a/Util/src/Application.cpp +++ b/Util/src/Application.cpp @@ -40,6 +40,7 @@ #include "Poco/Util/PropertyFileConfiguration.h" #include "Poco/Util/IniFileConfiguration.h" #include "Poco/Util/XMLConfiguration.h" +#include "Poco/Util/JSONConfiguration.h" #include "Poco/Util/LoggingSubsystem.h" #include "Poco/Util/Option.h" #include "Poco/Util/OptionProcessor.h" @@ -251,6 +252,13 @@ int Application::loadConfiguration(int priority) ++n; } #endif +#ifndef POCO_UTIL_NO_JSONCONFIGURATION + if (findAppConfigFile(appPath.getBaseName(), "json", cfgPath)) + { + _pConfig->add(new JSONConfiguration(cfgPath.toString()), priority, false, false); + ++n; + } +#endif #ifndef POCO_UTIL_NO_XMLCONFIGURATION if (findAppConfigFile(appPath.getBaseName(), "xml", cfgPath)) { @@ -276,6 +284,10 @@ void Application::loadConfiguration(const std::string& path, int priority) else if (icompare(ext, "ini") == 0) _pConfig->add(new IniFileConfiguration(confPath.toString()), priority, false, false); #endif +#ifndef POCO_UTIL_NO_JSONONFIGURATION + else if (icompare(ext, "json") == 0) + _pConfig->add(new JSONConfiguration(confPath.toString()), priority, false, false); +#endif #ifndef POCO_UTIL_NO_XMLCONFIGURATION else if (icompare(ext, "xml") == 0) _pConfig->add(new XMLConfiguration(confPath.toString()), priority, false, false); diff --git a/configure b/configure index ba671ad1a4..8951f982ba 100755 --- a/configure +++ b/configure @@ -174,7 +174,7 @@ while [ $# -ge 1 ]; do flags="$flags -DPOCO_NET_NO_IPv6" ;; --poquito) - flags="$flags -DPOCO_NO_FILECHANNEL -DPOCO_NO_SPLITTERCHANNEL -DPOCO_NO_SYSLOGCHANNEL -DPOCO_UTIL_NO_INIFILECONFIGURATION -DPOCO_UTIL_NO_XMLCONFIGURATION" ;; + flags="$flags -DPOCO_NO_FILECHANNEL -DPOCO_NO_SPLITTERCHANNEL -DPOCO_NO_SYSLOGCHANNEL -DPOCO_UTIL_NO_INIFILECONFIGURATION -DPOCO_UTIL_NO_JSONCONFIGURATION -DPOCO_UTIL_NO_XMLCONFIGURATION" ;; --unbundled) flags="$flags -DPOCO_UNBUNDLED" From a3b527bf4db45527410032a4c770c1c72e20907a Mon Sep 17 00:00:00 2001 From: Mike Naquin Date: Tue, 13 Nov 2012 15:37:29 -0600 Subject: [PATCH 2/2] Update description for POCO_UTIL_NO_JSONCONFIGURATION --- Foundation/include/Poco/Config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Foundation/include/Poco/Config.h b/Foundation/include/Poco/Config.h index eb87ad9823..1973ca20e2 100644 --- a/Foundation/include/Poco/Config.h +++ b/Foundation/include/Poco/Config.h @@ -121,7 +121,8 @@ // No support for JSON configuration in -// Poco::Util::Application. +// Poco::Util::Application. Avoids linking of JSON +// library and saves a few 100 Kbytes. // #define POCO_UTIL_NO_JSONCONFIGURATION