mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-19 08:46:41 +01:00
Merge pull request #12 from syvex/JSONConfiguration
Add JSONConfiguration to Poco::Util::Application
This commit is contained in:
commit
37f74f919e
@ -120,6 +120,12 @@
|
||||
// #define POCO_UTIL_NO_INIFILECONFIGURATION
|
||||
|
||||
|
||||
// No support for JSON configuration in
|
||||
// Poco::Util::Application. Avoids linking of JSON
|
||||
// library and saves a few 100 Kbytes.
|
||||
// #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.
|
||||
|
@ -36,6 +36,11 @@
|
||||
//
|
||||
|
||||
|
||||
// Avoid accidental linking of JSON library when JSONConfiguration
|
||||
// is not desired.
|
||||
#ifndef POCO_UTIL_NO_JSONCONFIGURATION
|
||||
|
||||
|
||||
#ifndef Util_JSONConfiguration_INCLUDED
|
||||
#define Util_JSONConfiguration_INCLUDED
|
||||
|
||||
@ -160,3 +165,5 @@ private:
|
||||
|
||||
|
||||
#endif // Util_JSONConfiguration_INCLUDED
|
||||
|
||||
#endif // POCO_UTIL_NO_JSONCONFIGURATION
|
||||
|
@ -36,6 +36,11 @@
|
||||
//
|
||||
|
||||
|
||||
// Avoid accidental linking of XML library when XMLConfiguration
|
||||
// is not desired.
|
||||
#ifndef POCO_UTIL_NO_XMLCONFIGURATION
|
||||
|
||||
|
||||
#ifndef Util_XMLConfiguration_INCLUDED
|
||||
#define Util_XMLConfiguration_INCLUDED
|
||||
|
||||
@ -215,3 +220,5 @@ private:
|
||||
|
||||
|
||||
#endif // Util_XMLConfiguration_INCLUDED
|
||||
|
||||
#endif // POCO_UTIL_NO_XMLCONFIGURATION
|
||||
|
@ -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);
|
||||
|
@ -34,6 +34,11 @@
|
||||
//
|
||||
|
||||
|
||||
// Avoid accidental linking of JSON library when JSONConfiguration
|
||||
// is not desired.
|
||||
#ifndef POCO_UTIL_NO_JSONCONFIGURATION
|
||||
|
||||
|
||||
#include "Poco/FileStream.h"
|
||||
#include "Poco/StringTokenizer.h"
|
||||
#include "Poco/Util/JSONConfiguration.h"
|
||||
@ -404,3 +409,5 @@ void JSONConfiguration::removeRaw(const std::string& key)
|
||||
|
||||
|
||||
} } // namespace Poco::Util
|
||||
|
||||
#endif // POCO_UTIL_NO_JSONCONFIGURATION
|
||||
|
@ -34,6 +34,11 @@
|
||||
//
|
||||
|
||||
|
||||
// Avoid accidental linking of XML library when XMLConfiguration
|
||||
// is not desired.
|
||||
#ifndef POCO_UTIL_NO_XMLCONFIGURATION
|
||||
|
||||
|
||||
#include "Poco/Util/XMLConfiguration.h"
|
||||
#include "Poco/SAX/InputSource.h"
|
||||
#include "Poco/DOM/DOMParser.h"
|
||||
@ -484,3 +489,5 @@ Poco::XML::Node* XMLConfiguration::findAttribute(const std::string& name, Poco::
|
||||
|
||||
|
||||
} } // namespace Poco::Util
|
||||
|
||||
#endif // POCO_UTIL_NO_XMLCONFIGURATION
|
||||
|
2
configure
vendored
2
configure
vendored
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user