本文整理汇总了C++中Meter::GetW方法的典型用法代码示例。如果您正苦于以下问题:C++ Meter::GetW方法的具体用法?C++ Meter::GetW怎么用?C++ Meter::GetW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Meter
的用法示例。
在下文中一共展示了Meter::GetW方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSectionVariable
/*
** Gets the value of a section variable. Returns true if strValue is set.
** The selector is stripped from strVariable.
**
*/
bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& strValue)
{
size_t colonPos = strVariable.find_last_of(L':');
if (colonPos == std::wstring::npos)
{
return false;
}
const std::wstring selector = strVariable.substr(colonPos + 1);
const WCHAR* selectorSz = selector.c_str();
strVariable.resize(colonPos);
bool isKeySelector = (!selector.empty() && iswalpha(selectorSz[0]));
if (isKeySelector)
{
// [Meter:X], [Meter:Y], [Meter:W], [Meter:H]
Meter* meter = m_MeterWindow->GetMeter(strVariable);
if (meter)
{
WCHAR buffer[32];
if (_wcsicmp(selectorSz, L"X") == 0)
{
_itow_s(meter->GetX(), buffer, 10);
}
else if (_wcsicmp(selectorSz, L"Y") == 0)
{
_itow_s(meter->GetY(), buffer, 10);
}
else if (_wcsicmp(selectorSz, L"W") == 0)
{
_itow_s(meter->GetW(), buffer, 10);
}
else if (_wcsicmp(selectorSz, L"H") == 0)
{
_itow_s(meter->GetH(), buffer, 10);
}
else
{
return false;
}
strValue = buffer;
return true;
}
}
// Number: [Measure:], [Measure:dec]
// Percentual: [Measure:%], [Measure:%, dec]
// Scale: [Measure:/scale], [Measure:/scale, dec]
// Max/Min: [Measure:MaxValue], [Measure:MaxValue:/scale, dec] ('%' cannot be used)
enum VALUETYPE
{
RAW = 0,
PERCENTUAL = 1,
MAX = 2,
MIN = 3
} valueType = RAW;
if (isKeySelector)
{
if (_wcsicmp(selectorSz, L"MaxValue") == 0)
{
valueType = MAX;
}
else if (_wcsicmp(selectorSz, L"MinValue") == 0)
{
valueType = MIN;
}
else
{
return false;
}
selectorSz = L"";
}
else
{
colonPos = strVariable.find_last_of(L':');
if (colonPos != std::wstring::npos)
{
do
{
const WCHAR* keySelectorSz = strVariable.c_str() + colonPos + 1;
if (_wcsicmp(keySelectorSz, L"MaxValue") == 0)
{
valueType = MAX;
}
else if (_wcsicmp(keySelectorSz, L"MinValue") == 0)
{
valueType = MIN;
}
else
{
//.........这里部分代码省略.........
示例2: GetSectionVariable
/*
** Gets the value of a section variable. Returns true if strValue is set.
** The selector is stripped from strVariable.
**
*/
bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& strValue)
{
size_t colonPos = strVariable.find_last_of(L':');
if (colonPos == std::wstring::npos)
{
return false;
}
const std::wstring selector = strVariable.substr(colonPos + 1);
const WCHAR* selectorSz = selector.c_str();
strVariable.resize(colonPos);
bool isKeySelector = (!selector.empty() && iswalpha(selectorSz[0]));
if (isKeySelector)
{
// [Meter:X], [Meter:Y], [Meter:W], [Meter:H]
Meter* meter = m_Skin->GetMeter(strVariable);
if (meter)
{
WCHAR buffer[32];
if (_wcsicmp(selectorSz, L"X") == 0)
{
_itow_s(meter->GetX(), buffer, 10);
}
else if (_wcsicmp(selectorSz, L"Y") == 0)
{
_itow_s(meter->GetY(), buffer, 10);
}
else if (_wcsicmp(selectorSz, L"W") == 0)
{
_itow_s(meter->GetW(), buffer, 10);
}
else if (_wcsicmp(selectorSz, L"H") == 0)
{
_itow_s(meter->GetH(), buffer, 10);
}
else
{
return false;
}
strValue = buffer;
return true;
}
}
// Number: [Measure:], [Measure:dec]
// Percentual: [Measure:%], [Measure:%, dec]
// Scale: [Measure:/scale], [Measure:/scale, dec]
// Max/Min: [Measure:MaxValue], [Measure:MaxValue:/scale, dec] ('%' cannot be used)
// EscapeRegExp: [Measure:EscapeRegExp] (Escapes regular expression syntax, used for 'IfMatch')
// EncodeUrl: [Measure:EncodeUrl] (Escapes URL reserved characters)
// TimeStamp: [TimeMeasure:TimeStamp] (ONLY for Time measures, returns the Windows timestamp of the measure)
enum class ValueType
{
Raw,
Percentual,
Max,
Min,
EscapeRegExp,
EncodeUrl,
TimeStamp
} valueType = ValueType::Raw;
if (isKeySelector)
{
if (_wcsicmp(selectorSz, L"MaxValue") == 0)
{
valueType = ValueType::Max;
}
else if (_wcsicmp(selectorSz, L"MinValue") == 0)
{
valueType = ValueType::Min;
}
else if (_wcsicmp(selectorSz, L"EscapeRegExp") == 0)
{
valueType = ValueType::EscapeRegExp;
}
else if (_wcsicmp(selectorSz, L"EncodeUrl") == 0)
{
valueType = ValueType::EncodeUrl;
}
else if (_wcsicmp(selectorSz, L"TimeStamp") == 0)
{
valueType = ValueType::TimeStamp;
}
else
{
return false;
}
selectorSz = L"";
}
else
//.........这里部分代码省略.........