本文整理汇总了C++中KKStr::ToInt32方法的典型用法代码示例。如果您正苦于以下问题:C++ KKStr::ToInt32方法的具体用法?C++ KKStr::ToInt32怎么用?C++ KKStr::ToInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KKStr
的用法示例。
在下文中一共展示了KKStr::ToInt32方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parser
FeatureNumList::VectorIntType* FeatureNumList::StrToUInt16Vetor (const KKStr& s)
{
bool valid = true;
VectorIntType* results = new VectorUint16 ();
KKStrParser parser (s);
parser.TrimWhiteSpace (" ");
while (parser.MoreTokens ())
{
KKStr field = parser.GetNextToken (",\t");
if (field.Empty ())
continue;
auto dashPos = field.LocateCharacter ('-');
if (!dashPos)
{
kkint32 n = field.ToInt32 ();
if ((n < 0) || ((kkuint32)n > maxIntType))
{
valid = false;
break;
}
results->push_back ((IntType)n);
}
else
{
// We are looking at a range
kkint32 startNum = field.SubStrSeg (0, dashPos).ToInt32 ();
kkint32 endNum = field.SubStrPart (dashPos + 1).ToInt32 ();
if ((startNum > endNum) || (startNum < 0) || ((kkuint32)endNum > maxIntType))
{
valid = false;
break;
}
for (kkint32 z = startNum; z <= endNum; ++z)
results->push_back ((IntType)z);
}
}
if (!valid)
{
delete results;
results = NULL;
}
else
{
sort (results->begin (), results->end ());
}
return results;
} /* StrToUInt16Vetor */
示例2: ExtractHeaderField
void ScannerFile::ExtractHeaderField (const KKStr& fieldName,
const KKStr& fieldValue
)
{
if (fieldName.EqualIgnoreCase ("FrameHeight"))
{
kkuint32 fieldValueUint = fieldValue.ToInt32 ();
if ((fieldValueUint > 0) && (fieldValueUint < (1024 * 1024)))
frameHeight = fieldValue.ToInt32 ();
}
else if (fieldName.EqualIgnoreCase ("PixelsPerScanLine"))
pixelsPerScanLine = fieldValue.ToInt ();
else if (fieldName.EqualIgnoreCase ("ScanRate"))
scanRate = fieldValue.ToFloat ();
else if (fieldName.EqualIgnoreCase ("FlatFieldCorrectionEnabled"))
flatFieldEnabled = fieldValue.ToBool ();
} /* ExtractHeaderField */