void write_info_internal(std::basic_ostream<typename Ptree::char_type> &stream, const Ptree &pt, const std::string &filename) { write_info_helper(stream, pt, -1); if (!stream.good()) throw info_parser_error("write error", filename, 0); }
void write_info_internal(std::basic_ostream<typename Ptree::key_type::value_type> &stream, const Ptree &pt, const std::string &filename, const info_writer_settings<typename Ptree::key_type::value_type> &settings) { write_info_helper(stream, pt, -1, settings); if (!stream.good()) BOOST_PROPERTY_TREE_THROW(info_parser_error("write error", filename, 0)); }
void read_info(const std::string &filename, Ptree &pt, const std::locale &loc = std::locale()) { std::basic_ifstream<typename Ptree::key_type::value_type> stream(filename.c_str()); if (!stream) { BOOST_PROPERTY_TREE_THROW(info_parser_error( "cannot open file for reading", filename, 0)); } stream.imbue(loc); Ptree local; read_info_internal(stream, local, filename, 0); pt.swap(local); }
void write_info(const std::string &filename, const Ptree &pt, const std::locale &loc = std::locale(), const info_writer_settings< typename Ptree::key_type::value_type > &settings = info_writer_make_settings< typename Ptree::key_type::value_type>()) { std::basic_ofstream<typename Ptree::key_type::value_type> stream(filename.c_str()); if (!stream) { BOOST_PROPERTY_TREE_THROW(info_parser_error( "cannot open file for writing", filename, 0)); } stream.imbue(loc); write_info_internal(stream, pt, filename, settings); }