Skip to content

Commit 4c593db

Browse files
committed
GH pocoproject#134: Fixed problem in Util::Application with xml or inifile no config
GH pocoproject#134: Fixed problem in Util::Application with xml or inifile no config
1 parent 3abf1cc commit 4c593db

7 files changed

Lines changed: 42 additions & 20 deletions

File tree

‎Util/include/Poco/Util/IniFileConfiguration.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141

4242

4343
#include "Poco/Util/Util.h"
44+
45+
46+
#ifndef POCO_UTIL_NO_INIFILECONFIGURATION
47+
48+
4449
#include "Poco/Util/AbstractConfiguration.h"
4550
#include <map>
4651
#include <istream>
@@ -110,4 +115,7 @@ class Util_API IniFileConfiguration: public AbstractConfiguration
110115
} } // namespace Poco::Util
111116

112117

118+
#endif // POCO_UTIL_NO_INIFILECONFIGURATION
119+
120+
113121
#endif // Util_IniFileConfiguration_INCLUDED

‎Util/include/Poco/Util/JSONConfiguration.h‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@
3636
//
3737

3838

39-
// Avoid accidental linking of JSON library when JSONConfiguration
40-
// is not desired.
41-
#ifndef POCO_UTIL_NO_JSONCONFIGURATION
42-
43-
4439
#ifndef Util_JSONConfiguration_INCLUDED
4540
#define Util_JSONConfiguration_INCLUDED
4641

4742

43+
#include "Poco/Util/Util.h"
44+
45+
46+
#ifndef POCO_UTIL_NO_JSONCONFIGURATION
47+
48+
4849
#include "Poco/Util/AbstractConfiguration.h"
4950
#include "Poco/JSON/Object.h"
5051
#include <istream>
@@ -164,6 +165,8 @@ class Util_API JSONConfiguration : public AbstractConfiguration
164165
} } // namespace Poco::Util
165166

166167

168+
#endif // POCO_UTIL_NO_JSONCONFIGURATION
169+
170+
167171
#endif // Util_JSONConfiguration_INCLUDED
168172

169-
#endif // POCO_UTIL_NO_JSONCONFIGURATION

‎Util/include/Poco/Util/XMLConfiguration.h‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
//
3737

3838

39-
// Avoid accidental linking of XML library when XMLConfiguration
40-
// is not desired.
41-
#ifndef POCO_UTIL_NO_XMLCONFIGURATION
42-
43-
4439
#ifndef Util_XMLConfiguration_INCLUDED
4540
#define Util_XMLConfiguration_INCLUDED
4641

4742

4843
#include "Poco/Util/Util.h"
44+
45+
46+
#ifndef POCO_UTIL_NO_XMLCONFIGURATION
47+
48+
4949
#include "Poco/Util/MapConfiguration.h"
5050
#include "Poco/DOM/Document.h"
5151
#include "Poco/DOM/AutoPtr.h"
@@ -219,6 +219,7 @@ class Util_API XMLConfiguration: public AbstractConfiguration
219219
} } // namespace Poco::Util
220220

221221

222-
#endif // Util_XMLConfiguration_INCLUDED
223-
224222
#endif // POCO_UTIL_NO_XMLCONFIGURATION
223+
224+
225+
#endif // Util_XMLConfiguration_INCLUDED

‎Util/src/Application.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void Application::loadConfiguration(const std::string& path, int priority)
284284
else if (icompare(ext, "ini") == 0)
285285
_pConfig->add(new IniFileConfiguration(confPath.toString()), priority, false, false);
286286
#endif
287-
#ifndef POCO_UTIL_NO_JSONONFIGURATION
287+
#ifndef POCO_UTIL_NO_JSONCONFIGURATION
288288
else if (icompare(ext, "json") == 0)
289289
_pConfig->add(new JSONConfiguration(confPath.toString()), priority, false, false);
290290
#endif

‎Util/src/IniFileConfiguration.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535

3636

3737
#include "Poco/Util/IniFileConfiguration.h"
38+
39+
40+
#ifndef POCO_UTIL_NO_INIFILECONFIGURATION
41+
42+
3843
#include "Poco/Exception.h"
3944
#include "Poco/String.h"
4045
#include "Poco/Path.h"
@@ -202,3 +207,6 @@ void IniFileConfiguration::parseLine(std::istream& istr)
202207

203208

204209
} } // namespace Poco::Util
210+
211+
212+
#endif // POCO_UTIL_NO_INIFILECONFIGURATION

‎Util/src/JSONConfiguration.cpp‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@
3434
//
3535

3636

37-
// Avoid accidental linking of JSON library when JSONConfiguration
38-
// is not desired.
37+
38+
#include "Poco/Util/JSONConfiguration.h"
39+
40+
3941
#ifndef POCO_UTIL_NO_JSONCONFIGURATION
4042

4143

4244
#include "Poco/FileStream.h"
4345
#include "Poco/StringTokenizer.h"
44-
#include "Poco/Util/JSONConfiguration.h"
4546
#include "Poco/JSON/Parser.h"
4647
#include "Poco/JSON/Query.h"
4748
#include "Poco/JSON/DefaultHandler.h"
@@ -410,4 +411,5 @@ void JSONConfiguration::removeRaw(const std::string& key)
410411

411412
} } // namespace Poco::Util
412413

414+
413415
#endif // POCO_UTIL_NO_JSONCONFIGURATION

‎Util/src/XMLConfiguration.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
//
3535

3636

37-
// Avoid accidental linking of XML library when XMLConfiguration
38-
// is not desired.
37+
#include "Poco/Util/XMLConfiguration.h"
38+
39+
3940
#ifndef POCO_UTIL_NO_XMLCONFIGURATION
4041

4142

42-
#include "Poco/Util/XMLConfiguration.h"
4343
#include "Poco/SAX/InputSource.h"
4444
#include "Poco/DOM/DOMParser.h"
4545
#include "Poco/DOM/Element.h"

0 commit comments

Comments
 (0)