diff --git a/BaseLib/ConfigTree.cpp b/BaseLib/ConfigTree.cpp index 82902a4b7bb63d09ae2fa3ca222773b52a6e1520..465245b5c72718a213555d471d2510fa7443bbb6 100644 --- a/BaseLib/ConfigTree.cpp +++ b/BaseLib/ConfigTree.cpp @@ -11,11 +11,13 @@ #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> +#include <boost/property_tree/json_parser.hpp> #include <logog/include/logog.hpp> namespace BaseLib { + boost::property_tree::ptree read_xml_config(boost::filesystem::path const& path) { boost::property_tree::ptree ptree; @@ -28,4 +30,12 @@ boost::property_tree::ptree read_xml_config(boost::filesystem::path const& path) return ptree; } + +std::string propertyTreeToString(boost::property_tree::ptree const& tree) +{ + std::ostringstream ss; + boost::property_tree::write_json(ss, tree); + return ss.str(); +} + } diff --git a/BaseLib/ConfigTree.h b/BaseLib/ConfigTree.h index ec8efcf72ad414b7e63a8475501c17e8f2668f95..a7dde55dd14a1e963393d2d016203bfa10e31e69 100644 --- a/BaseLib/ConfigTree.h +++ b/BaseLib/ConfigTree.h @@ -18,6 +18,9 @@ namespace BaseLib boost::property_tree::ptree read_xml_config( boost::filesystem::path const& path); + +/// Returns the JSON-representation of the given boost::property_tree. +std::string propertyTreeToString(boost::property_tree::ptree const& tree); } #endif // BASELIB_CONFIGTREE_H_ diff --git a/BaseLib/StringTools.cpp b/BaseLib/StringTools.cpp index 0da26d250c090a8ae4d2421c92d8dacfba5e1f8d..2a9ba62638fbb7705c64cf50dcf3236b035c84df 100644 --- a/BaseLib/StringTools.cpp +++ b/BaseLib/StringTools.cpp @@ -20,7 +20,6 @@ #include "logog/include/logog.hpp" -#include <boost/property_tree/json_parser.hpp> #include <boost/algorithm/string/replace.hpp> namespace BaseLib @@ -73,13 +72,6 @@ std::string padLeft(std::string const& str, int maxlen, char ch) return ss.str(); } -std::string propertyTreeToString(boost::property_tree::ptree const& tree) -{ - std::ostringstream ss; - boost::property_tree::write_json(ss, tree); - return ss.str(); -} - } // end namespace BaseLib #ifdef MSVC diff --git a/BaseLib/StringTools.h b/BaseLib/StringTools.h index f887ad56ec252d200f893db8d6274d8a18d2264f..e59032c8f6f625e6aef8a2bdc90770d2d310d47c 100644 --- a/BaseLib/StringTools.h +++ b/BaseLib/StringTools.h @@ -15,7 +15,6 @@ #ifndef STRINGTOOLS_H #define STRINGTOOLS_H -#include <boost/property_tree/ptree.hpp> #include <string> #include <list> @@ -71,11 +70,6 @@ void simplify(std::string &str); */ std::string padLeft(std::string const& str, int maxlen, char ch=' '); -/** - * Returns the JSON-representation of the given boost::property_tree. - */ -std::string propertyTreeToString(boost::property_tree::ptree const& tree); - } // end namespace BaseLib #ifdef MSVC