This commit is contained in:
Birunthan Mohanathas 2012-07-17 21:26:55 +03:00
parent 2f543e5dcb
commit 4dc5fe0b31
2 changed files with 14 additions and 19 deletions

View File

@ -60,7 +60,6 @@ void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meter
m_Variables.clear();
m_StyleTemplate.clear();
m_LastUsedStyle.clear();
m_LastReplaced = false;
m_LastDefaultUsed = false;
m_LastValueDefined = false;
@ -568,7 +567,6 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT
static std::wstring result;
// Clear last status
m_LastUsedStyle.clear();
m_LastReplaced = false;
m_LastDefaultUsed = false;
m_LastValueDefined = false;
@ -580,9 +578,9 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT
const std::wstring& strValue = GetValue(strSection, strKey, strDefault);
if (&strValue == &strDefault)
{
bool foundStyleValue = false;
// If the template is defined read the value from there.
if (!m_StyleTemplate.empty())
{
std::vector<std::wstring>::const_reverse_iterator iter = m_StyleTemplate.rbegin();
for ( ; iter != m_StyleTemplate.rend(); ++iter)
{
@ -594,13 +592,12 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT
if (&strStyleValue != &strDefault)
{
result = strStyleValue;
m_LastUsedStyle = (*iter);
foundStyleValue = true;
break;
}
}
}
if (m_LastUsedStyle.empty()) // No template found
if (!foundStyleValue)
{
result = strDefault;
m_LastDefaultUsed = true;

View File

@ -61,7 +61,6 @@ public:
void SetStyleTemplate(const std::wstring& strStyle) { static const std::wstring delim(1, L'|'); Tokenize(strStyle, delim).swap(m_StyleTemplate); Shrink(m_StyleTemplate); }
void ClearStyleTemplate() { m_StyleTemplate.clear(); }
const std::wstring& GetLastUsedStyle() { return m_LastUsedStyle; }
bool GetLastReplaced() { return m_LastReplaced; }
bool GetLastDefaultUsed() { return m_LastDefaultUsed; }
bool GetLastKeyDefined() { return !m_LastDefaultUsed; }
@ -125,7 +124,6 @@ private:
std::vector<std::wstring> m_StyleTemplate;
std::wstring m_LastUsedStyle;
bool m_LastReplaced;
bool m_LastDefaultUsed;
bool m_LastValueDefined;