You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iBase/iUtils/IniFileTool.h

45 lines
1.1 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include "LlUtils_global.h"
#include "Defines.h"
/// @brief Ini文件解析类的封装
class I_UTILSSHARED_EXPORT IniFileTool
{
public:
// 如果sIni不是全路径则默认从Config/[Module]下面查找
// 如下三种模式均可
// E:\Run\mWTAI\Bin\Config\WTAI\WTAIConfig.ini
// WTAIConfig.ini
// WTAIConfig
IniFileTool(QString sIni, bool bRead = true);
~IniFileTool();
// 直取String
QString getValue(QString sKey);
// 直取StringList
QStringList getValueList(QString sKey);
// 如果bParseFromStr=true
// 先以Sring取然后parse类似{}{}{}格式的ini
QStringList getValueList(QString sKey, bool bParseFromStr);
// 设置数值
void setValue(QString sKey, QVariant o);
// 这是QSetting的本身的函数
QStringList allKeys() const;
QStringList childKeys() const;
QStringList childGroups() const;
// 对于其它的可以直接通过QSetting处理
QSettings* getSettings();
private:
QSettings* m_pSettings;
bool m_bRead; //读写标识,目前基本都是读
};