本文整理汇总了C++中MyMoneyFile::checkNoUsed方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMoneyFile::checkNoUsed方法的具体用法?C++ MyMoneyFile::checkNoUsed怎么用?C++ MyMoneyFile::checkNoUsed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMoneyFile
的用法示例。
在下文中一共展示了MyMoneyFile::checkNoUsed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateLastNumberUsed
void KMyMoneyUtils::updateLastNumberUsed(const MyMoneyAccount& acc, const QString& number)
{
MyMoneyAccount accnt = acc;
QString num = number;
// now check if this number has been used already
MyMoneyFile* file = MyMoneyFile::instance();
if (file->checkNoUsed(accnt.id(), num)) {
// if a number has been entered which is immediately prior to
// an existing number, the next new number produced would clash
// so need to look ahead for free next number
bool free = false;
for (int i = 0; i < 10; i++) {
// find next unused number - 10 tries (arbitrary)
if (file->checkNoUsed(accnt.id(), num)) {
// increment and try again
num = getAdjacentNumber(num);
} else {
// found a free number
free = true;
break;
}
}
if (!free) {
qDebug() << "No free number found - set to '1'";
num = '1';
}
setLastNumberUsed(getAdjacentNumber(num, - 1));
}
}