[Common] Add EntryExists to IniFileClass.cpp
This commit is contained in:
parent
0a161408be
commit
d76a5ce7a2
|
@ -2,14 +2,14 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
CIniFileBase::CIniFileBase(CFileBase & FileObject, const char * FileName) :
|
||||
m_lastSectionSearch(0),
|
||||
m_CurrentSectionFilePos(0),
|
||||
m_LineFeed("\r\n"),
|
||||
m_ReadOnly(true),
|
||||
m_InstantFlush(true),
|
||||
m_File(FileObject),
|
||||
m_FileName(FileName),
|
||||
m_CurrentSectionDirty(false)
|
||||
m_lastSectionSearch(0),
|
||||
m_CurrentSectionFilePos(0),
|
||||
m_LineFeed("\r\n"),
|
||||
m_ReadOnly(true),
|
||||
m_InstantFlush(true),
|
||||
m_File(FileObject),
|
||||
m_FileName(FileName),
|
||||
m_CurrentSectionDirty(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -736,6 +736,26 @@ void CIniFileBase::SaveNumber(const char * lpSectionName, const char * lpKeyName
|
|||
SaveString(lpSectionName, lpKeyName, stdstr_f("%d", Value).c_str());
|
||||
}
|
||||
|
||||
bool CIniFileBase::EntryExists(const char * lpSectionName, const char * lpKeyName)
|
||||
{
|
||||
CGuard Guard(m_CS);
|
||||
|
||||
if (lpSectionName == NULL || strlen(lpSectionName) == 0)
|
||||
{
|
||||
lpSectionName = "default";
|
||||
}
|
||||
|
||||
if (m_File.IsOpen() && MoveToSectionNameData(lpSectionName, true))
|
||||
{
|
||||
KeyValueList::iterator iter = m_CurrentSectionData.find(lpKeyName);
|
||||
if (iter != m_CurrentSectionData.end())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CIniFileBase::FlushChanges(void)
|
||||
{
|
||||
CGuard Guard(m_CS);
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
virtual void SaveNumber(const char * lpSectionName, const char * lpKeyName, uint32_t Value);
|
||||
void SetAutoFlush(bool AutoFlush);
|
||||
void FlushChanges(void);
|
||||
bool EntryExists(const char * lpSectionName, const char * lpKeyName);
|
||||
void GetKeyList(const char * lpSectionName, strlist &List);
|
||||
void GetKeyValueData(const char * lpSectionName, KeyValueData & List);
|
||||
|
||||
|
|
Loading…
Reference in New Issue