テストboost::property_tree
したところ、問題はありませんでした。XML の読み込み、要素の抽出、XML の保存などを行うことができます。しかし、XML を生成して印刷することは可能でしょうか? 保存したくありません。
void debug_settings::load(const std::string &filename) {
using boost::property_tree::ptree;
ptree pt;
read_xml(filename, pt);
m_file = pt.get<std::string>("debug.filename");
m_level = pt.get("debug.level", 0);
BOOST_FOREACH(ptree::value_type &v, pt.get_child("debug.modules"))m_modules.insert(v.second.data());
}
void debug_settings::save(const std::string &filename) {
using boost::property_tree::ptree;
ptree pt;
pt.put("debug.filename", m_file);
pt.put("debug.level", m_level);
BOOST_FOREACH(const std::string &name, m_modules)pt.add("debug.modules.module", name);
write_xml(filename, pt);
}
これは、XML の読み込みと保存に使用する関数です。表示する方法はありますか?