本文整理汇总了C++中CConfigParser::ParseDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfigParser::ParseDouble方法的具体用法?C++ CConfigParser::ParseDouble怎么用?C++ CConfigParser::ParseDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConfigParser
的用法示例。
在下文中一共展示了CConfigParser::ParseDouble方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
//.........这里部分代码省略.........
示例2: 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();
}
}
示例3: 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
{
//.........这里部分代码省略.........