70 lines
1.5 KiB
C++
70 lines
1.5 KiB
C++
|
|
#include "stringex.h"
|
|
#include "Defines.h"
|
|
#include "Common.h"
|
|
#include "Object.h"
|
|
#include "String.h"
|
|
#include "File.h"
|
|
#include "Config.h"
|
|
|
|
#include "inifile.h"
|
|
|
|
|
|
|
|
HConfig::HConfig()
|
|
{
|
|
m_pIniFile = new HIniFile;
|
|
}
|
|
|
|
HConfig::~HConfig()
|
|
{
|
|
delete m_pIniFile;
|
|
}
|
|
|
|
bool HConfig::OpenConfig(const char * pszPathName)
|
|
{
|
|
HFile file;
|
|
if (file.Open(pszPathName, HFile::FMODE_RDONLY) == false)
|
|
return false;
|
|
|
|
m_pIniFile->SetIniFile(pszPathName);
|
|
|
|
m_strConfigFile = pszPathName;
|
|
|
|
return true;
|
|
}
|
|
|
|
void HConfig::CloseConfig()
|
|
{
|
|
}
|
|
|
|
HString HConfig::ReadString(const char * pszSetionName, const char * pszKeyName, const char * pszDefault)
|
|
{
|
|
return m_pIniFile->ReadString(pszSetionName, pszKeyName, pszDefault);
|
|
}
|
|
|
|
bool HConfig::WriteString(const char * pszSetionName, const char * pszKeyName, const char * pszString)
|
|
{
|
|
return m_pIniFile->WriteString(pszSetionName, pszKeyName, pszString);
|
|
}
|
|
|
|
int HConfig::ReadNumber(const char * pszSetionName, const char * pszKeyName, int nDefault)
|
|
{
|
|
return m_pIniFile->ReadNumber(pszSetionName, pszKeyName, nDefault);
|
|
}
|
|
|
|
bool HConfig::WriteNumber(const char * pszSetionName, const char * pszKeyName, int nNumber)
|
|
{
|
|
return m_pIniFile->WriteNumber(pszSetionName, pszKeyName, nNumber);
|
|
}
|
|
|
|
bool HConfig::ReadBoolean(const char * pszSetionName, const char * pszKeyName, bool bDefault)
|
|
{
|
|
return m_pIniFile->ReadBoolean(pszSetionName, pszKeyName, bDefault);
|
|
}
|
|
|
|
bool HConfig::WriteBoolean(const char * pszSetionName, const char * pszKeyName, bool bValue)
|
|
{
|
|
return m_pIniFile->WriteBoolean(pszSetionName, pszKeyName, bValue);
|
|
}
|