10 #ifndef BOOST_PROPERTY_TREE_JSON_PARSER_HPP_INCLUDED
11 #define BOOST_PROPERTY_TREE_JSON_PARSER_HPP_INCLUDED
13 #include <boost/property_tree/ptree.hpp>
14 #if BOOST_VERSION < 105900
15 #include <boost/property_tree/detail/json_parser_read.hpp>
16 #include <boost/property_tree/detail/json_parser_error.hpp>
17 #elif BOOST_VERSION > 106000
18 #include <boost/property_tree/json_parser/detail/read.hpp>
19 #include <boost/property_tree/json_parser/error.hpp>
21 #include <boost/property_tree/detail/json_parser/read.hpp>
22 #include <boost/property_tree/detail/json_parser_error.hpp>
24 #include "json_parser_write.h"
31 namespace property_tree {
49 void read_json(std::basic_istream <
50 typename Ptree::key_type::value_type
54 read_json_internal(stream, pt, std::string());
73 void read_json(
const std::string &filename,
75 const std::locale &loc = std::locale())
77 std::basic_ifstream<typename Ptree::key_type::value_type>
78 stream(filename.c_str());
80 BOOST_PROPERTY_TREE_THROW(json_parser_error(
81 "cannot open file", filename, 0));
83 read_json_internal(stream, pt, filename);
100 template<
class Ptree>
101 void write_json(std::basic_ostream <
102 typename Ptree::key_type::value_type
107 write_json_internal(stream, pt, std::string(), pretty);
124 template<
class Ptree>
125 void write_json(
const std::string &filename,
127 const std::locale &loc = std::locale(),
130 std::basic_ofstream<typename Ptree::key_type::value_type>
131 stream(filename.c_str());
133 BOOST_PROPERTY_TREE_THROW(json_parser_error(
134 "cannot open file", filename, 0));
136 write_json_internal(stream, pt, filename, pretty);
143 namespace property_tree
145 using json_parser::read_json;
146 using json_parser::write_json;
147 using json_parser::json_parser_error;
Definition: json_parser.h:30