Code cleanup

This commit is contained in:
spx
2013-02-06 19:12:16 +09:00
parent 1c8b798928
commit 95aacda3cb
9 changed files with 71 additions and 51 deletions

View File

@ -18,6 +18,7 @@
#include "StdAfx.h"
#include "Section.h"
#include "ConfigParser.h"
#include "Rainmeter.h"
extern CRainmeter* Rainmeter;
@ -41,6 +42,40 @@ CSection::~CSection()
{
}
/*
** Read the common options specified in the ini file. The inherited classes must
** call this base implementation if they overwrite this method.
**
*/
void CSection::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
int updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
if (updateDivider != m_UpdateDivider)
{
m_UpdateCounter = m_UpdateDivider = updateDivider;
}
m_DynamicVariables = 0!=parser.ReadInt(section, L"DynamicVariables", 0);
m_OnUpdateAction = parser.ReadString(section, L"OnUpdateAction", L"", false);
const std::wstring& group = parser.ReadString(section, L"Group", L"");
InitializeGroup(group);
}
/*
** Updates the counter value
**
*/
bool CSection::UpdateCounter()
{
++m_UpdateCounter;
if (m_UpdateCounter < m_UpdateDivider) return false;
m_UpdateCounter = 0;
return true;
}
/*
** Execute OnUpdateAction if action is set
**