- Additional fix for r502. Functions/Measures/Counter in Formula are now case-insensitive in MeasureCalc.

- "[Measure]" is now case-insensitive in DynamicVariables.
This commit is contained in:
spx
2010-08-10 18:23:10 +00:00
parent 99508e090b
commit 3d33a16f9f
4 changed files with 22 additions and 13 deletions

View File

@ -504,12 +504,12 @@ bool CConfigParser::ReplaceMeasures(std::wstring& result)
if (pos2 == std::wstring::npos || end < pos2)
{
std::wstring var(result.begin() + pos + 1, result.begin() + end);
std::map<std::wstring, CMeasure*>::const_iterator iter = m_Measures.find(var);
if (iter != m_Measures.end())
CMeasure* measure = GetMeasure(var);
if (measure)
{
std::wstring value = (*iter).second->GetStringValue(false, 1, 5, false);
std::wstring value = measure->GetStringValue(false, 1, 5, false);
// Measure found, replace it with the value
result.replace(result.begin() + pos, result.begin() + end + 1, value);
start = pos + value.length();
@ -612,6 +612,20 @@ void CConfigParser::AddMeasure(CMeasure* pMeasure)
}
}
CMeasure* CConfigParser::GetMeasure(const std::wstring& name)
{
std::map<std::wstring, CMeasure*>::const_iterator iter = m_Measures.begin();
for ( ; iter != m_Measures.end(); ++iter)
{
if (wcsicmp((*iter).first.c_str(), name.c_str()) == 0)
{
return (*iter).second;
}
}
return NULL;
}
double CConfigParser::ReadFloat(LPCTSTR section, LPCTSTR key, double defValue)
{
TCHAR buffer[256];