Functions | |
template<class Ptree > | |
void | read_json (std::basic_istream< typename Ptree::key_type::value_type > &stream, Ptree &pt) |
Read JSON from a the given stream and translate it to a property tree. More... | |
template<class Ptree > | |
void | read_json (const std::string &filename, Ptree &pt, const std::locale &loc=std::locale()) |
Read JSON from a the given file and translate it to a property tree. More... | |
template<class Ptree > | |
void | write_json (std::basic_ostream< typename Ptree::key_type::value_type > &stream, const Ptree &pt, bool pretty=true) |
Translates the property tree to JSON and writes it the given output stream. More... | |
template<class Ptree > | |
void | write_json (const std::string &filename, const Ptree &pt, const std::locale &loc=std::locale(), bool pretty=true) |
Translates the property tree to JSON and writes it the given file. More... | |
void boost::property_tree::json_parser::read_json | ( | std::basic_istream< typename Ptree::key_type::value_type > & | stream, |
Ptree & | pt | ||
) |
Read JSON from a the given stream and translate it to a property tree.
json_parser_error | In case of error deserializing the property tree. |
stream | Stream from which to read in the property tree. | |
[out] | pt | The property tree to populate. |
References boost::expressions::stream.
void boost::property_tree::json_parser::read_json | ( | const std::string & | filename, |
Ptree & | pt, | ||
const std::locale & | loc = std::locale() |
||
) |
Read JSON from a the given file and translate it to a property tree.
json_parser_error | In case of error deserializing the property tree. |
filename | Name of file from which to read in the property tree. | |
[out] | pt | The property tree to populate. |
loc | The locale to use when reading in the file contents. |
References BOOST_PROPERTY_TREE_THROW, and boost::expressions::stream.
void boost::property_tree::json_parser::write_json | ( | std::basic_ostream< typename Ptree::key_type::value_type > & | stream, |
const Ptree & | pt, | ||
bool | pretty = true |
||
) |
Translates the property tree to JSON and writes it the given output stream.
json_parser_error | In case of error translating the property tree to JSON or writing to the output stream. |
stream | The stream to which to write the JSON representation of the property tree. |
pt | The property tree to tranlsate to JSON and output. |
pretty | Whether to pretty-print. Defaults to true for backward compatibility. |
References boost::expressions::stream.
void boost::property_tree::json_parser::write_json | ( | const std::string & | filename, |
const Ptree & | pt, | ||
const std::locale & | loc = std::locale() , |
||
bool | pretty = true |
||
) |
Translates the property tree to JSON and writes it the given file.
json_parser_error | In case of error translating the property tree to JSON or writing to the file. |
filename | The name of the file to which to write the JSON representation of the property tree. |
pt | The property tree to translate to JSON and output. |
loc | The locale to use when writing out to the output file. |
pretty | Whether to pretty-print. Defaults to true and last place for backward compatibility. |
References BOOST_PROPERTY_TREE_THROW, and boost::expressions::stream.