May*_*Jha 7 c++ boost c++-standard-library boost-propertytree c++11
有没有“boost/property_tree ”的替代方案?
实际上,我正在尝试删除 C++ 的所有 boost 实现并使用标准库函数。我已经能够找到 boost C++ 的一些其他实现的替代方案,但对于属性树却没有。
不使用 boost 的动机:主要是处理添加的依赖项
bool Processor::init(std::istream& xml, std::istream& rioxml, const std::string& logconfig, const std::string& recoveryConfig) {
boost::property_tree::ptree config;
boost::property_tree::ptree rioconfig;
try {
boost::property_tree::xml_parser::read_xml(xml, config,
boost::property_tree::xml_parser::no_comments);
boost::property_tree::xml_parser::read_xml(rioxml, rioconfig,
boost::property_tree::xml_parser::no_comments);
return Initialize(config, rioconfig, logconfig, recoveryConfig);
}
catch(const boost::property_tree::xml_parser::xml_parser_error& ex){
LOG_ERROR(LOGCAT_DEFAULT, MSGID_UNKNOWN, "Failed to parse business config: " << logconfig);
return false;
}
}
Run Code Online (Sandbox Code Playgroud)