MattKings Changes:

1) New feature of Meter=String
StringCase= [NONE | LOWER | UPPER | PROPER]
2) Changes to SetVariable to allow mathematical formulas and functions to be used in setting a variable.
This commit is contained in:
jsmorley
2010-03-18 19:48:14 +00:00
parent 65bfaa31f0
commit 3166c5d5f2
5 changed files with 165 additions and 20 deletions

View File

@ -604,6 +604,27 @@ double CConfigParser::ReadFormula(LPCTSTR section, LPCTSTR key, double defValue)
return ParseDouble(result, defValue);
}
// Returns an int if the formula was read successfully, -1 for failure.
// Pass a pointer to a double.
int CConfigParser::ReadFormula(std::wstring& result, double* resultValue)
{
// Formulas must be surrounded by parenthesis
if (!result.empty() && result[0] == L'(' && result[result.size() - 1] == L')')
{
char* errMsg = MathParser_Parse(m_Parser, ConvertToAscii(result.substr(1, result.size() - 2).c_str()).c_str(), resultValue);
if (errMsg != NULL)
{
DebugLog(ConvertToWide(errMsg).c_str());
return -1;
}
return 1;
}
return -1;
}
Color CConfigParser::ReadColor(LPCTSTR section, LPCTSTR key, Color defValue)
{
TCHAR buffer[256];