本文整理汇总了C++中CFX_ByteStringC::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteStringC::Find方法的具体用法?C++ CFX_ByteStringC::Find怎么用?C++ CFX_ByteStringC::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_ByteStringC
的用法示例。
在下文中一共展示了CFX_ByteStringC::Find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FX_atonum
bool FX_atonum(const CFX_ByteStringC& strc, void* pData) {
if (strc.Find('.') != -1) {
FX_FLOAT* pFloat = static_cast<FX_FLOAT*>(pData);
*pFloat = FX_atof(strc);
return false;
}
// Note, numbers in PDF are typically of the form 123, -123, etc. But,
// for things like the Permissions on the encryption hash the number is
// actually an unsigned value. We use a uint32_t so we can deal with the
// unsigned and then check for overflow if the user actually signed the value.
// The Permissions flag is listed in Table 3.20 PDF 1.7 spec.
pdfium::base::CheckedNumeric<uint32_t> integer = 0;
bool bNegative = false;
bool bSigned = false;
int cc = 0;
if (strc[0] == '+') {
cc++;
bSigned = true;
} else if (strc[0] == '-') {
bNegative = true;
bSigned = true;
cc++;
}
while (cc < strc.GetLength() && std::isdigit(strc[cc])) {
integer = integer * 10 + FXSYS_toDecimalDigit(strc.CharAt(cc));
if (!integer.IsValid())
break;
cc++;
}
// We have a sign, and the value was greater then a regular integer
// we've overflowed, reset to the default value.
if (bSigned) {
if (bNegative) {
if (integer.ValueOrDefault(kDefaultIntValue) >
static_cast<uint32_t>(std::numeric_limits<int>::max()) + 1) {
integer = kDefaultIntValue;
}
} else if (integer.ValueOrDefault(kDefaultIntValue) >
static_cast<uint32_t>(std::numeric_limits<int>::max())) {
integer = kDefaultIntValue;
}
}
// Switch back to the int space so we can flip to a negative if we need.
int value = static_cast<int>(integer.ValueOrDefault(kDefaultIntValue));
if (bNegative)
value = -value;
int* pInt = static_cast<int*>(pData);
*pInt = value;
return true;
}