2 Star 4 Fork 2

GreateCoder/Message_Center

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
readconf.cpp 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
GreateCoder 提交于 2015-10-23 17:45 . 第一次提交
#include "readconf.h"
ReadConf::ReadConf(const QString &file) :
m_file (file)
{
}
QString ReadConf::getUrl()
{
QFile fileConf (m_file);
if (fileConf.open(QIODevice::ReadOnly))
{
QTextStream txtInput (&fileConf);
QString lineStr;
while (!txtInput.atEnd())
{
lineStr = txtInput.readLine();
if (lineStr.contains("server"))
{
return lineStr.section(":::", 1, 1);
}
}
fileConf.close();
}
return "";
}
QString ReadConf::getNewsFile()
{
QFile fileConf (m_file);
if (fileConf.open(QIODevice::ReadOnly))
{
QTextStream txtInput (&fileConf);
QString lineStr;
while (!txtInput.atEnd())
{
lineStr = txtInput.readLine();
if (lineStr.contains("news_file"))
{
return lineStr.section(":::", 1, 1);
}
}
fileConf.close();
}
return "";
}
QString ReadConf::getBakFile()
{
QFile fileConf (m_file);
if (fileConf.open(QIODevice::ReadOnly))
{
QTextStream txtInput (&fileConf);
QString lineStr;
while (!txtInput.atEnd())
{
lineStr = txtInput.readLine();
if (lineStr.contains("bak_info"))
{
return QDir::homePath() + lineStr.section(":::", 1, 1);
}
}
fileConf.close();
}
return "";
}
int ReadConf::getLoopTime()
{
QFile fileConf (m_file);
if (fileConf.open(QIODevice::ReadOnly))
{
QTextStream txtInput (&fileConf);
QString lineStr;
while (!txtInput.atEnd())
{
lineStr = txtInput.readLine();
if (lineStr.contains("flush_time"))
{
return lineStr.section(":::", 1, 1).toInt();
}
}
fileConf.close();
}
return 120000;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/GreateCoder/Message_Center.git
[email protected]:GreateCoder/Message_Center.git
GreateCoder
Message_Center
Message_Center
master

搜索帮助