1 Star 0 Fork 0

houmingzhang/CovAnalysisTool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ConfigCenter.cpp 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
Administrator 提交于 2021-10-05 19:06 +08:00 . 协相关分析工具
#include "ConfigCenter.h"
#include "tinyxml/tinyxml.h"
#include "GlobalMacroDef.h"
#include "GlobalHeader.h"
#include "SharedFuncs.h"
ConfigCenter::ConfigCenter():m_timer(QTime::currentTime())
{
if(!loadConfigureFile(PROGRAM_CONFIG_FILE))
{
derf("Load configure file failed:%s\n",PROGRAM_CONFIG_FILE);
abort();
}
}
bool ConfigCenter::loadConfigureFile(const char * configfile)
{
TiXmlDocument * pXmlDoc = new TiXmlDocument(configfile);
if(!pXmlDoc->LoadFile())
{
derf("Load configure file failed:%s\n",configfile);
goto err;
}
TiXmlElement *pXmlRootElement=NULL,*pconfigChild=NULL;
pXmlRootElement = pXmlDoc->RootElement();//就是config配置结点
pconfigChild = pXmlRootElement->FirstChildElement();
for(;pconfigChild!=NULL;pconfigChild=pconfigChild->NextSiblingElement())
{
// printf("[%s:%d]解析配置文件标签:[%s]\n",__FILE__,__LINE__,pconfigChild->Value());
if(0==mystricmp(pconfigChild->Value(),"serviceport"))
{
m_serviceport=atoi(pconfigChild->FirstChild()->Value());
}else{
derf("错误配置文件标签:[%s]\n",pconfigChild->Value());
goto err;
}
}
if(pXmlDoc!=NULL)
delete pXmlDoc,pXmlDoc=NULL;
return true;
err:
if(pXmlDoc!=NULL)
delete pXmlDoc,pXmlDoc=NULL;
derf("配置文件:%s 解析出错",configfile);
return false;
}
ConfigCenter::~ConfigCenter()
{
}
int ConfigCenter::get_serviceport()
{
return m_serviceport;
}
double ConfigCenter::get_time_elapsed()
{
return m_timer.elapsed()/1000.0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dtrylzhm/cov-analysis-tool.git
git@gitee.com:dtrylzhm/cov-analysis-tool.git
dtrylzhm
cov-analysis-tool
CovAnalysisTool
master

搜索帮助