本文整理汇总了C++中CConfigParser::ReadFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfigParser::ReadFloat方法的具体用法?C++ CConfigParser::ReadFloat怎么用?C++ CConfigParser::ReadFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConfigParser
的用法示例。
在下文中一共展示了CConfigParser::ReadFloat方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadOptions
/*
** Read the options specified in the ini file.
**
*/
void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
CMeasure::ReadOptions(parser, section);
double value;
const WCHAR* netName = NULL;
if (m_Net == NET_IN)
{
netName = L"NetInSpeed";
value = Rainmeter->GetGlobalOptions().netInSpeed;
}
else if (m_Net == NET_OUT)
{
netName = L"NetOutSpeed";
value = Rainmeter->GetGlobalOptions().netOutSpeed;
}
else // if (m_Net == NET_TOTAL)
{
netName = L"NetTotalSpeed";
value = Rainmeter->GetGlobalOptions().netInSpeed + Rainmeter->GetGlobalOptions().netOutSpeed;
}
double maxValue = parser.ReadFloat(section, L"MaxValue", -1);
if (maxValue == -1)
{
maxValue = parser.ReadFloat(section, netName, -1);
if (maxValue == -1)
{
maxValue = value;
}
}
m_Interface = parser.ReadInt(section, L"Interface", 0);
m_Cumulative = 0!=parser.ReadInt(section, L"Cumulative", 0);
if (m_Cumulative)
{
Rainmeter->SetNetworkStatisticsTimer();
}
if (maxValue == 0.0)
{
if (!m_LogMaxValue)
{
m_MaxValue = 1.0;
m_LogMaxValue = true;
m_MedianValues.clear();
}
}
else
{
m_MaxValue = maxValue / 8;
m_LogMaxValue = false;
}
}
示例2: ReadOptions
/*
** Read the options specified in the ini file. Base implementation for In/Out/Total.
**
*/
void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section, NET net)
{
double value;
const WCHAR* netName = NULL;
if (net == NET_IN)
{
netName = L"NetInSpeed";
value = Rainmeter->GetGlobalOptions().netInSpeed;
}
else if (net == NET_OUT)
{
netName = L"NetOutSpeed";
value = Rainmeter->GetGlobalOptions().netOutSpeed;
}
else
{
netName = L"NetTotalSpeed";
value = Rainmeter->GetGlobalOptions().netInSpeed + Rainmeter->GetGlobalOptions().netOutSpeed;
}
double maxValue = parser.ReadFloat(section, L"MaxValue", -1);
if (maxValue == -1)
{
maxValue = parser.ReadFloat(section, netName, -1);
if (maxValue == -1)
{
maxValue = value;
}
}
m_Interface = parser.ReadInt(section, L"Interface", 0);
m_Cumulative = 0!=parser.ReadInt(section, L"Cumulative", 0);
if (m_Cumulative)
{
Rainmeter->SetNetworkStatisticsTimer();
}
m_TrafficValue = parser.ReadFloat(section, L"TrafficValue", 0.0);
m_TrafficAction = parser.ReadString(section, L"TrafficAction", L"", false);
if (maxValue == 0)
{
m_MaxValue = 1;
m_LogMaxValue = true;
}
else
{
m_MaxValue = maxValue / 8;
}
}
示例3: ReadConfig
/*
** Read the meter-specific configs from the ini-file.
**
*/
void CMeterRoundLine::ReadConfig(CConfigParser& parser, const WCHAR* section)
{
// Read common configs
CMeter::ReadConfig(parser, section);
m_LineWidth = parser.ReadFormula(section, L"LineWidth", 1.0);
m_LineLength = parser.ReadFormula(section, L"LineLength", 20.0);
m_LineStart = parser.ReadFormula(section, L"LineStart", -1.0);
m_StartAngle = parser.ReadFormula(section, L"StartAngle", 0.0);
m_RotationAngle = parser.ReadFormula(section, L"RotationAngle", 6.2832);
m_ValueRemainder = parser.ReadInt(section, L"ValueReminder", 0); // Typo
m_ValueRemainder = parser.ReadInt(section, L"ValueRemainder", m_ValueRemainder);
m_LineColor = parser.ReadColor(section, L"LineColor", Color::Black);
m_Solid = 0!=parser.ReadInt(section, L"Solid", 0);
m_CntrlAngle = 0!=parser.ReadInt(section, L"ControlAngle", 1);
m_CntrlLineStart = 0!=parser.ReadInt(section, L"ControlStart", 0);
m_CntrlLineLength = 0!=parser.ReadInt(section, L"ControlLength", 0);
m_LineStartShift = parser.ReadFloat(section, L"StartShift", 0.0);
m_LineLengthShift = parser.ReadFloat(section, L"LengthShift", 0.0);
}
示例4: ReadOptions
/*
** Read the options specified in the ini file.
**
*/
void CMeterRotator::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
// Store the current values so we know if the image needs to be updated
std::wstring oldImageName = m_ImageName;
CMeter::ReadOptions(parser, section);
m_ImageName = parser.ReadString(section, L"ImageName", L"");
if (!m_ImageName.empty())
{
m_MeterWindow->MakePathAbsolute(m_ImageName);
// Read tinting options
m_Image.ReadOptions(parser, section);
}
else
{
m_Image.ClearOptionFlags();
}
m_OffsetX = parser.ReadFloat(section, L"OffsetX", 0.0);
m_OffsetY = parser.ReadFloat(section, L"OffsetY", 0.0);
m_StartAngle = parser.ReadFloat(section, L"StartAngle", 0.0);
m_RotationAngle = parser.ReadFloat(section, L"RotationAngle", 6.2832);
m_ValueRemainder = parser.ReadInt(section, L"ValueReminder", 0); // Typo
m_ValueRemainder = parser.ReadInt(section, L"ValueRemainder", m_ValueRemainder);
if (m_Initialized)
{
m_NeedsReload = (wcscmp(oldImageName.c_str(), m_ImageName.c_str()) != 0);
if (m_NeedsReload ||
m_Image.IsOptionsChanged())
{
Initialize(); // Reload the image
}
}
}
示例5: ReadOptions
/*
** Read the options specified in the ini file.
**
*/
void CMeterLine::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
WCHAR tmpName[64];
// Store the current number of lines so we know if the buffer needs to be updated
int oldLineCount = (int)m_Colors.size();
int oldW = m_W;
CMeter::ReadOptions(parser, section);
int lineCount = parser.ReadInt(section, L"LineCount", 1);
m_Colors.clear();
m_ScaleValues.clear();
for (int i = 0; i < lineCount; ++i)
{
if (i == 0)
{
wcsncpy_s(tmpName, L"LineColor", _TRUNCATE);
}
else
{
_snwprintf_s(tmpName, _TRUNCATE, L"LineColor%i", i + 1);
}
m_Colors.push_back(parser.ReadColor(section, tmpName, Color::White));
if (i == 0)
{
wcsncpy_s(tmpName, L"Scale", _TRUNCATE);
}
else
{
_snwprintf_s(tmpName, _TRUNCATE, L"Scale%i", i + 1);
}
m_ScaleValues.push_back(parser.ReadFloat(section, tmpName, 1.0));
if (!m_Initialized && !m_MeasureName.empty())
{
if (i != 0)
{
_snwprintf_s(tmpName, _TRUNCATE, L"MeasureName%i", i + 1);
m_MeasureNames.push_back(parser.ReadString(section, tmpName, L""));
}
}
}
m_Flip = 0!=parser.ReadInt(section, L"Flip", 0);
m_Autoscale = 0!=parser.ReadInt(section, L"AutoScale", 0);
m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0);
m_HorizontalLines = 0!=parser.ReadInt(section, L"HorizontalLines", 0);
ARGB color = parser.ReadColor(section, L"HorizontalColor", Color::Black); // This is left here for backwards compatibility
m_HorizontalColor = parser.ReadColor(section, L"HorizontalLineColor", color); // This is what it should be
if (m_Initialized &&
(oldLineCount != lineCount || oldW != m_W))
{
Initialize();
}
const WCHAR* graph = parser.ReadString(section, L"GraphStart", L"RIGHT").c_str();
if (_wcsicmp(graph, L"RIGHT") == 0)
{
m_GraphStartLeft = false;
}
else if (_wcsicmp(graph, L"LEFT") == 0)
{
m_GraphStartLeft = true;
}
else
{
LogWithArgs(LOG_ERROR, L"StartFrom=%s is not valid in [%s]", graph, m_Name.c_str());
}
graph = parser.ReadString(section, L"GraphOrientation", L"VERTICAL").c_str();
if (_wcsicmp(graph, L"VERTICAL") == 0)
{
// Restart graph
if (m_GraphHorizontalOrientation)
{
m_GraphHorizontalOrientation = false;
m_AllValues.clear();
Initialize();
m_CurrentPos = 0;
}
else
{
m_GraphHorizontalOrientation = false;
}
}
else if (_wcsicmp(graph, L"HORIZONTAL") == 0)
{
// Restart graph
if (!m_GraphHorizontalOrientation)
//.........这里部分代码省略.........
示例6: ReadOptions
/*
** Read the options specified in the ini file.
**
*/
void CMeasureTime::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
CMeasure::ReadOptions(parser, section);
m_Format = parser.ReadString(section, L"Format", L"");
m_TimeStamp = parser.ReadFloat(section, L"TimeStamp", -1);
if (m_TimeStamp < 0.0)
{
const WCHAR* timezone = parser.ReadString(section, L"TimeZone", L"local").c_str();
if (_wcsicmp(L"local", timezone) == 0)
{
SYSTEMTIME sysLocalTime, sysUTCTime;
GetLocalTime(&sysLocalTime);
GetSystemTime(&sysUTCTime);
FILETIME ftLocalTime, ftUTCTime;
SystemTimeToFileTime(&sysLocalTime, &ftLocalTime);
SystemTimeToFileTime(&sysUTCTime, &ftUTCTime);
LARGE_INTEGER largeInt1, largeInt2;
largeInt1.HighPart = ftLocalTime.dwHighDateTime;
largeInt1.LowPart = ftLocalTime.dwLowDateTime;
largeInt2.HighPart = ftUTCTime.dwHighDateTime;
largeInt2.LowPart = ftUTCTime.dwLowDateTime;
m_DeltaTime.QuadPart = largeInt1.QuadPart - largeInt2.QuadPart;
}
else
{
double zone = parser.ParseDouble(timezone, 0.0);
bool dst = 1 == parser.ReadInt(section, L"DaylightSavingTime", 1);
struct tm* today;
time_t now;
time(&now);
today = localtime(&now);
if (dst && today->tm_isdst)
{
// Add DST
TIME_ZONE_INFORMATION tzi;
GetTimeZoneInformation(&tzi);
m_DeltaTime.QuadPart = (LONGLONG)((zone * 3600) - tzi.DaylightBias * 60) * 10000000;
}
else
{
m_DeltaTime.QuadPart = (LONGLONG)(zone * 3600) * 10000000;
}
}
}
else
{
m_DeltaTime.QuadPart = 0;
}
if (!m_Initialized)
{
// Initialize m_Time to avoid causing EINVAL in TimeToString() until calling UpdateValue()
FillCurrentTime();
}
}
示例7: ReadOptions
/*
** Read the options specified in the ini file.
**
*/
void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
// Store the current font values so we know if the font needs to be updated
std::wstring oldFontFace = m_FontFace;
int oldFontSize = m_FontSize;
TEXTSTYLE oldStyle = m_Style;
CMeter::ReadOptions(parser, section);
m_Color = parser.ReadColor(section, L"FontColor", Color::Black);
m_EffectColor = parser.ReadColor(section, L"FontEffectColor", Color::Black);
m_Prefix = parser.ReadString(section, L"Prefix", L"");
m_Postfix = parser.ReadString(section, L"Postfix", L"");
m_Text = parser.ReadString(section, L"Text", L"");
m_Percentual = 0!=parser.ReadInt(section, L"Percentual", 0);
int clipping = parser.ReadInt(section, L"ClipString", 0);
switch (clipping)
{
case 2:
m_ClipType = CLIP_AUTO;
m_ClipStringW = parser.ReadInt(section, L"ClipStringW", -1);
m_ClipStringH = parser.ReadInt(section, L"ClipStringH", -1);
break;
case 1:
m_ClipType = CLIP_ON;
break;
case 0:
m_ClipType = CLIP_OFF;
break;
default:
LogWithArgs(LOG_ERROR, L"ClipString=%s is not valid in [%s]", clipping, m_Name.c_str());
}
m_FontFace = parser.ReadString(section, L"FontFace", L"Arial");
if (m_FontFace.empty())
{
m_FontFace = L"Arial";
}
m_FontSize = parser.ReadInt(section, L"FontSize", 10);
if (m_FontSize < 0)
{
m_FontSize = 10;
}
m_NumOfDecimals = parser.ReadInt(section, L"NumOfDecimals", -1);
m_Angle = (Gdiplus::REAL)parser.ReadFloat(section, L"Angle", 0.0);
const std::wstring& autoscale = parser.ReadString(section, L"AutoScale", L"0");
int autoscaleValue = _wtoi(autoscale.c_str());
if (autoscaleValue == 0)
{
m_AutoScale = AUTOSCALE_OFF;
}
else
{
if (autoscale.find_last_of(L"kK") == std::wstring::npos)
{
m_AutoScale = (autoscaleValue == 2) ? AUTOSCALE_1000 : AUTOSCALE_1024;
}
else
{
m_AutoScale = (autoscaleValue == 2) ? AUTOSCALE_1000K : AUTOSCALE_1024K;
}
}
const std::wstring& scale = parser.ReadString(section, L"Scale", L"1");
m_NoDecimals = (scale.find(L'.') == std::wstring::npos);
m_Scale = parser.ParseDouble(scale.c_str(), 1);
const WCHAR* hAlign = parser.ReadString(section, L"StringAlign", L"LEFT").c_str();
const WCHAR* vAlign = NULL;
if (_wcsnicmp(hAlign, L"LEFT", 4) == 0)
{
m_TextFormat->SetHorizontalAlignment(Gfx::HorizontalAlignment::Left);
vAlign = hAlign + 4;
}
else if (_wcsnicmp(hAlign, L"RIGHT", 5) == 0)
{
m_TextFormat->SetHorizontalAlignment(Gfx::HorizontalAlignment::Right);
vAlign = hAlign + 5;
}
else if (_wcsnicmp(hAlign, L"CENTER", 6) == 0)
{
m_TextFormat->SetHorizontalAlignment(Gfx::HorizontalAlignment::Center);
vAlign = hAlign + 6;
}
//.........这里部分代码省略.........
示例8: ReadOptions
/*
** Read the options specified in the ini file.
**
*/
void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
// Store the current font values so we know if the font needs to be updated
std::wstring oldFontFace = m_FontFace;
int oldFontSize = m_FontSize;
TEXTSTYLE oldStyle = m_Style;
CMeter::ReadOptions(parser, section);
m_Color = parser.ReadColor(section, L"FontColor", Color::Black);
m_EffectColor = parser.ReadColor(section, L"FontEffectColor", Color::Black);
m_Prefix = parser.ReadString(section, L"Prefix", L"");
m_Postfix = parser.ReadString(section, L"Postfix", L"");
m_Text = parser.ReadString(section, L"Text", L"");
m_Percentual = 0!=parser.ReadInt(section, L"Percentual", 0);
m_ClipString = 0!=parser.ReadInt(section, L"ClipString", 0);
m_FontFace = parser.ReadString(section, L"FontFace", L"Arial");
if (m_FontFace.empty())
{
m_FontFace = L"Arial";
}
m_FontSize = (int)parser.ReadFloat(section, L"FontSize", 10);
if (m_FontSize < 0)
{
m_FontSize = 10;
}
m_NumOfDecimals = parser.ReadInt(section, L"NumOfDecimals", -1);
m_Angle = (Gdiplus::REAL)parser.ReadFloat(section, L"Angle", 0.0);
const std::wstring& autoscale = parser.ReadString(section, L"AutoScale", L"0");
int autoscaleValue = _wtoi(autoscale.c_str());
if (autoscaleValue == 0)
{
m_AutoScale = AUTOSCALE_OFF;
}
else
{
if (autoscale.find_last_of(L"kK") == std::wstring::npos)
{
m_AutoScale = (autoscaleValue == 2) ? AUTOSCALE_1000 : AUTOSCALE_1024;
}
else
{
m_AutoScale = (autoscaleValue == 2) ? AUTOSCALE_1000K : AUTOSCALE_1024K;
}
}
const std::wstring& scale = parser.ReadString(section, L"Scale", L"1");
m_NoDecimals = (scale.find(L'.') == std::wstring::npos);
m_Scale = parser.ParseDouble(scale.c_str(), 1);
const WCHAR* align = parser.ReadString(section, L"StringAlign", L"LEFT").c_str();
if (_wcsicmp(align, L"LEFT") == 0 || _wcsicmp(align, L"LEFTTOP") == 0)
{
m_Align = ALIGN_LEFT;
}
else if (_wcsicmp(align, L"RIGHT") == 0 || _wcsicmp(align, L"RIGHTTOP") == 0)
{
m_Align = ALIGN_RIGHT;
}
else if (_wcsicmp(align, L"CENTER") == 0 || _wcsicmp(align, L"CENTERTOP") == 0)
{
m_Align = ALIGN_CENTER;
}
else if (_wcsicmp(align, L"LEFTBOTTOM") == 0)
{
m_Align = ALIGN_LEFTBOTTOM;
}
else if (_wcsicmp(align, L"RIGHTBOTTOM") == 0)
{
m_Align = ALIGN_RIGHTBOTTOM;
}
else if (_wcsicmp(align, L"CENTERBOTTOM") == 0)
{
m_Align = ALIGN_CENTERBOTTOM;
}
else if (_wcsicmp(align, L"LEFTCENTER") == 0)
{
m_Align = ALIGN_LEFTCENTER;
}
else if (_wcsicmp(align, L"RIGHTCENTER") == 0)
{
m_Align = ALIGN_RIGHTCENTER;
}
else if (_wcsicmp(align, L"CENTERCENTER") == 0)
{
m_Align = ALIGN_CENTERCENTER;
}
else
{
//.........这里部分代码省略.........
示例9: ReadOptions
//.........这里部分代码省略.........
{
if (!coord.empty())
{
size_t len = coord.size();
if (coord[len - 1] == L'r')
{
m_RelativeY = POSITION_RELATIVE_TL;
coord.erase(--len);
}
else if (coord[len - 1] == L'R')
{
m_RelativeY = POSITION_RELATIVE_BR;
coord.erase(--len);
}
else
{
m_RelativeY = POSITION_ABSOLUTE;
}
m_Y = parser.ParseInt(coord.c_str(), 0);
}
else
{
m_Y = 0;
m_RelativeY = POSITION_ABSOLUTE;
}
}
m_W = parser.ReadInt(section, L"W", 1);
m_WDefined = parser.GetLastValueDefined();
m_H = parser.ReadInt(section, L"H", 1);
m_HDefined = parser.GetLastValueDefined();
const std::wstring& hidden = parser.ReadString(section, L"Hidden", L"0");
m_StyleHidden = parser.GetLastUsedStyle();
if (!m_Initialized || parser.GetLastReplaced() || wcscmp(m_StyleHidden.c_str(), oldStyleHidden.c_str()) != 0)
{
m_Hidden = 0!=parser.ParseInt(hidden.c_str(), 0);
}
if (!m_Initialized)
{
m_MeasureName = parser.ReadString(section, L"MeasureName", L"");
}
m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", BEVELTYPE_NONE);
m_SolidColor = parser.ReadColor(section, L"SolidColor", Color::MakeARGB(0, 0, 0, 0));
m_SolidColor2 = parser.ReadColor(section, L"SolidColor2", m_SolidColor.GetValue());
m_SolidAngle = (Gdiplus::REAL)parser.ReadFloat(section, L"GradientAngle", 0.0);
m_Mouse.ReadOptions(parser, section, m_MeterWindow);
m_HasMouseAction =
!(m_Mouse.GetLeftUpAction().empty() && m_Mouse.GetLeftDownAction().empty() &&
m_Mouse.GetLeftDoubleClickAction().empty() && m_Mouse.GetMiddleUpAction().empty() &&
m_Mouse.GetMiddleDownAction().empty() && m_Mouse.GetMiddleDoubleClickAction().empty() &&
m_Mouse.GetRightUpAction().empty() && m_Mouse.GetRightDownAction().empty() &&
m_Mouse.GetRightDoubleClickAction().empty());
m_ToolTipText = parser.ReadString(section, L"ToolTipText", L"");
m_ToolTipTitle = parser.ReadString(section, L"ToolTipTitle", L"");
m_ToolTipIcon = parser.ReadString(section, L"ToolTipIcon", L"");
m_ToolTipWidth = (int)parser.ReadFloat(section, L"ToolTipWidth", 1000);
m_ToolTipType = 0!=parser.ReadInt(section, L"ToolTipType", 0);
m_ToolTipHidden = 0!=parser.ReadInt(section, L"ToolTipHidden", m_MeterWindow->GetMeterToolTipHidden());
int updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
if (updateDivider != m_UpdateDivider)
{
m_UpdateCounter = m_UpdateDivider = updateDivider;
}
m_AntiAlias = 0!=parser.ReadInt(section, L"AntiAlias", 0);
m_DynamicVariables = 0!=parser.ReadInt(section, L"DynamicVariables", 0);
std::vector<Gdiplus::REAL> matrix = parser.ReadFloats(section, L"TransformationMatrix");
if (matrix.size() == 6)
{
if (m_Transformation)
{
m_Transformation->SetElements(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
}
else
{
m_Transformation = new Matrix(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
}
}
else if (!matrix.empty())
{
delete m_Transformation;
m_Transformation = NULL;
LogWithArgs(LOG_ERROR, L"Meter: Incorrect number of values in TransformationMatrix=%s", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
}
const std::wstring& group = parser.ReadString(section, L"Group", L"");
InitializeGroup(group);
}
示例10: ReadOptions
/*
** Read the common options specified in the ini file. The inherited classes must
** call this base implementation if they overwrite this method.
**
*/
void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section)
{
// Clear substitutes to prevent from being added more than once.
if (!m_Substitute.empty())
{
m_Substitute.clear();
}
m_Invert = 0!=parser.ReadInt(section, L"InvertMeasure", 0);
if (!m_Initialized)
{
m_Disabled = 0!=parser.ReadInt(section, L"Disabled", 0);
}
else
{
const std::wstring& result = parser.ReadString(section, L"Disabled", L"0");
if (parser.GetLastReplaced())
{
m_Disabled = 0!=parser.ParseInt(result.c_str(), 0);
}
}
int updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
if (updateDivider != m_UpdateDivider)
{
m_UpdateCounter = m_UpdateDivider = updateDivider;
}
m_MinValue = parser.ReadFloat(section, L"MinValue", m_MinValue);
m_MaxValue = parser.ReadFloat(section, L"MaxValue", m_MaxValue);
// The ifabove/ifbelow define actions that are ran when the value goes above/below the given number.
m_IfAboveValue = parser.ReadFloat(section, L"IfAboveValue", 0.0);
m_IfAboveAction = parser.ReadString(section, L"IfAboveAction", L"", false);
m_IfBelowValue = parser.ReadFloat(section, L"IfBelowValue", 0.0);
m_IfBelowAction = parser.ReadString(section, L"IfBelowAction", L"", false);
m_IfEqualValue = parser.ReadFloat(section, L"IfEqualValue", 0.0);
m_IfEqualAction = parser.ReadString(section, L"IfEqualAction", L"", false);
m_AverageSize = parser.ReadUInt(section, L"AverageSize", 0);
m_DynamicVariables = 0!=parser.ReadInt(section, L"DynamicVariables", 0);
m_RegExpSubstitute = 0!=parser.ReadInt(section, L"RegExpSubstitute", 0);
std::wstring subs = parser.ReadString(section, L"Substitute", L"");
if (!subs.empty())
{
if ((subs[0] != L'"' || subs[subs.length() - 1] != L'\'') &&
(subs[0] != L'\'' || subs[subs.length() - 1] != L'"'))
{
// Add quotes since they are removed by the GetProfileString
subs.insert(0, 1, L'"');
subs += L'"';
}
if (!ParseSubstitute(subs))
{
LogWithArgs(LOG_ERROR, L"Measure: Invalid Substitute=%s", subs.c_str());
}
}
const std::wstring& group = parser.ReadString(section, L"Group", L"");
InitializeGroup(group);
}
示例11: ReadOptions
//.........这里部分代码省略.........
m_X = parser.ParseInt(x.c_str(), 0);
}
else
{
m_X = 0;
m_RelativeX = POSITION_ABSOLUTE;
}
int oldY = m_Y;
std::wstring& y = (std::wstring&)parser.ReadString(section, L"Y", L"0");
if (!y.empty())
{
WCHAR lastChar = y[y.size() - 1];
if (lastChar == L'r')
{
m_RelativeY = POSITION_RELATIVE_TL;
y.pop_back();
}
else if (lastChar == L'R')
{
m_RelativeY = POSITION_RELATIVE_BR;
y.pop_back();
}
else
{
m_RelativeY = POSITION_ABSOLUTE;
}
m_Y = parser.ParseInt(y.c_str(), 0);
}
else
{
m_Y = 0;
m_RelativeY = POSITION_ABSOLUTE;
}
bool oldWDefined = m_WDefined;
int w = parser.ReadInt(section, L"W", m_W);
m_WDefined = parser.GetLastValueDefined();
if (IsFixedSize(true)) m_W = w;
if (!m_WDefined && oldWDefined && IsFixedSize())
{
m_W = 0;
}
bool oldHDefined = m_HDefined;
int h = parser.ReadInt(section, L"H", m_H);
m_HDefined = parser.GetLastValueDefined();
if (IsFixedSize(true)) m_H = h;
if (!m_HDefined && oldHDefined && IsFixedSize())
{
m_H = 0;
}
bool oldHidden = m_Hidden;
m_Hidden = 0!=parser.ReadInt(section, L"Hidden", 0);
if (oldX != m_X || oldY != m_Y || oldHidden != m_Hidden)
{
m_MeterWindow->SetResizeWindowMode(RESIZEMODE_CHECK); // Need to recalculate the window size
}
m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", BEVELTYPE_NONE);
m_SolidColor = parser.ReadColor(section, L"SolidColor", Color::MakeARGB(0, 0, 0, 0));
m_SolidColor2 = parser.ReadColor(section, L"SolidColor2", m_SolidColor.GetValue());
m_SolidAngle = (Gdiplus::REAL)parser.ReadFloat(section, L"GradientAngle", 0.0);
m_Mouse.ReadOptions(parser, section);
m_HasMouseAction = m_Mouse.HasButtonAction() || m_Mouse.HasScrollAction();
m_ToolTipText = parser.ReadString(section, L"ToolTipText", L"");
m_ToolTipTitle = parser.ReadString(section, L"ToolTipTitle", L"");
m_ToolTipIcon = parser.ReadString(section, L"ToolTipIcon", L"");
m_ToolTipWidth = parser.ReadInt(section, L"ToolTipWidth", 1000);
m_ToolTipType = 0!=parser.ReadInt(section, L"ToolTipType", 0);
m_ToolTipHidden = 0!=parser.ReadInt(section, L"ToolTipHidden", m_MeterWindow->GetMeterToolTipHidden());
m_AntiAlias = 0!=parser.ReadInt(section, L"AntiAlias", 0);
std::vector<Gdiplus::REAL> matrix = parser.ReadFloats(section, L"TransformationMatrix");
if (matrix.size() == 6)
{
if (m_Transformation)
{
m_Transformation->SetElements(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
}
else
{
m_Transformation = new Matrix(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
}
}
else if (!matrix.empty())
{
delete m_Transformation;
m_Transformation = NULL;
LogWithArgs(LOG_ERROR, L"Meter: Incorrect number of values in TransformationMatrix=%s", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
}
}