代码拉取完成,页面将自动刷新
#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;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。