本文整理汇总了C++中qstring::const_iterator::digitValue方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::digitValue方法的具体用法?C++ const_iterator::digitValue怎么用?C++ const_iterator::digitValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstring::const_iterator
的用法示例。
在下文中一共展示了const_iterator::digitValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setRules
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void elMundo::setRules (QString ruleString)
{
QString::const_iterator it;
int B_bitmask = 0, S_bitmask = 0;
QString digits;
if (reBrule.indexIn(ruleString) >= 0) {
digits = reBrule.cap(1);
for (it = digits.constBegin(); it != digits.constEnd(); it++)
B_bitmask |= (1 << it->digitValue());
}
if (reSrule.indexIn(ruleString) >= 0) {
digits = reSrule.cap(1);
for (it = digits.constBegin(); it != digits.constEnd(); it++)
S_bitmask |= (1 << it->digitValue());
}
fprintf(stderr,"Rules(%s=+%x:%x)\n", ruleString.cStr(), B_bitmask,S_bitmask);
setRules(B_bitmask, S_bitmask);
}
示例2: ParseDecimalPart
static
ParseResult ParseDecimalPart(ParseResult const& begin, QString::const_iterator end)
{
Amount multiplier ("0.1"); //exactly 1 tenth
Amount decrement ("0.1"); //exactly 1 tenth
Amount a = ResultAmount(begin);
QString::const_iterator iter;
for (iter = ResultIter(begin); iter != end; iter++) {
if (iter->isDigit()) {
a += Amount(iter->digitValue())*multiplier;
multiplier *= decrement;
} else {
throw std::runtime_error("Invalid currency string");
}
}
return ParseResult(a,iter);
}
示例3: ParseWholePart
static
ParseResult ParseWholePart(QString::const_iterator begin, QString::const_iterator end)
{
Amount a (0);
QString::const_iterator iter;
for (iter = begin; iter != end; iter++) {
if (iter->isDigit()) {
a *= Amount(10); //scale up
a = a + Amount(iter->digitValue()); //add
} else if (*iter == QLocale().groupSeparator()) {
//eat it
} else if (*iter == QLocale().decimalPoint()) {
iter++; //skip the decimal point
return ParseResult(a, iter);
} else {
throw std::runtime_error("Invalid currency string");
}
}
return ParseResult(a,iter);
}