Skip to content
Snippets Groups Projects
Commit e9a218df authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[BL] Move propertyTreeToString into ConfigTree.

parent e4de70b3
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
}
......@@ -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_
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment