資源簡介
pugixml 一個很好用的XML類,里面提供了頭文件,lib,使用例子,下載下來就可以直接在你的工程中使用??戳死泳椭涝趺从昧恕?img width=510 src=http://www.sh-liguang.com/pic/126106.jpg />
代碼片段和文件信息
#include?“pugixml.hpp“
//cfg_file?xml文件名
//cfg?保存的參數結構體
int?GetCfg(const?char?*cfg_file?DataServerCfg&?cfg)
{
????pugi::xml_document?doc;
????pugi::xml_parse_result?result?=?doc.load_file(cfg_file);
????if?(result)
????{
????????pugi::xml_node?cfg_node?=?doc.child(“QDadaServerCfg“);
????????std::string?str_host?=?cfg_node.child_value(“RouterHost“);
????????std::string?str_port?=?cfg_node.child_value(“RouterPort“);
????????std::vector?vecSegTag;
????????boost::split(vecSegTag?str_port?boost::is_any_of(““));
????????if?(vecSegTag.size()?!=?3)
????????{
????????????return?QDATA_CONFIG_ERROR;
????????}
????????cfg.pull?=?“tcp://“?+?str_host?+?“:“?+?vecSegTag[0];
????????cfg.reply?=?“tcp://“?+?str_host?+?“:“?+?vecSegTag[1];
????????cfg.push?=?“tcp://“?+?str_host?+?“:“?+?vecSegTag[2];
????????cfg.mem_size?=?atoi(cfg_node.child_value(“MemPool“));
????????pugi::xml_node?plugin_node?=?cfg_node.child(“Plugin“);
????????cfg.plugin_file?=?plugin_node.attribute(“file“).as_string();
????????for?(pugi::xml_node?para?=?plugin_node.first_child();?para;?para?=?para.next_sibling())
????????{
????????????cfg.plugin_paras[para.attribute(“name“).as_string()]?=?para.attribute(“value“).as_string();
????????}
????????if?(cfg.pull.empty()?||?cfg.push.empty()?||cfg.plugin_file.empty()?||?cfg.mem_size?<=?0)
????????{
????????????LOG_ERROR(“Get?cfg?error“);
????????????return?QDATA_CONFIG_ERROR;
????????}
????}
????else
????{
????????LOG_ERROR(“error:?%s“result.description());
????????return?QDATA_CONFIG_ERROR;
????}
????return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2736??2013-08-26?10:54??pugixm
?????文件??????45559??2013-08-26?10:54??pugixm
?????文件????1502190??2013-08-26?11:05??pugixm
?????文件????1213116??2013-08-26?11:05??pugixm
?????文件????1506812??2013-08-26?11:06??pugixm
?????文件????1751572??2013-08-26?11:06??pugixm
?????文件???????1610??2014-03-06?17:22??pugixm
?????文件????????953??2014-03-06?17:26??pugixm
?????目錄??????????0??2014-03-06?17:38??pugixm
?????目錄??????????0??2014-03-06?17:38??pugixm
?????目錄??????????0??2014-03-06?17:16??pugixm
?????目錄??????????0??2014-03-06?17:18??pugixm
?????目錄??????????0??2014-03-06?17:24??pugixm
?????目錄??????????0??2014-03-06?17:19??pugixm
-----------?---------??----------?-----??----
??????????????6024548????????????????????14
- 上一篇:ReFox X 破解版
- 下一篇:多普達手機RUU刷機工具
評論
共有 條評論