diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index bb988e71..8ec7fd7e 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -672,12 +672,18 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT return result; } -bool CConfigParser::IsValueDefined(LPCTSTR section, LPCTSTR key) +bool CConfigParser::IsKeyDefined(LPCTSTR section, LPCTSTR key) { ReadString(section, key, L"", false); return !m_LastDefaultUsed; } +bool CConfigParser::IsValueDefined(LPCTSTR section, LPCTSTR key) +{ + const std::wstring& result = ReadString(section, key, L"", false); + return (!m_LastDefaultUsed && !result.empty()); +} + void CConfigParser::AddMeasure(CMeasure* pMeasure) { if (pMeasure) diff --git a/Library/ConfigParser.h b/Library/ConfigParser.h index 82cecc2f..9335a1ec 100644 --- a/Library/ConfigParser.h +++ b/Library/ConfigParser.h @@ -52,6 +52,7 @@ public: void ResetMonitorVariables(CMeterWindow* meterWindow = NULL); const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true); + bool IsKeyDefined(LPCTSTR section, LPCTSTR key); bool IsValueDefined(LPCTSTR section, LPCTSTR key); double ReadFloat(LPCTSTR section, LPCTSTR key, double defValue); double ReadFormula(LPCTSTR section, LPCTSTR key, double defValue);