本文整理汇总了C++中FileName::highestVersionNum方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::highestVersionNum方法的具体用法?C++ FileName::highestVersionNum怎么用?C++ FileName::highestVersionNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::highestVersionNum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: highestVersion
FileName FileName::highestVersion() const {
validateVersioningState();
FileName result = *this;
if (!isVersioned()) {
throw IException(IException::Unknown,
QObject::tr("Asked for highest version of file named [%1] in [%2] but there "
"are no version sequences in the name")
.arg(name()).arg(originalPath()),
_FILEINFO_);
}
// Look for dates
if (isDateVersioned()) {
result = result.version(result.highestVersionDate());
}
// Look for number's
if (isNumericallyVersioned()) {
result = result.version(result.highestVersionNum());
}
return result;
}
示例2: newVersion
FileName FileName::newVersion() const {
validateVersioningState();
FileName result = *this;
if (!isVersioned()) {
throw IException(IException::Unknown,
QObject::tr("Asked for new version of file named [%1] in [%2] but there "
"are no version sequences in the name")
.arg(name()).arg(originalPath()),
_FILEINFO_);
}
// Look for date
if (isDateVersioned()) {
result = result.version(QDate::currentDate());
}
// Look for #'s
if (isNumericallyVersioned()) {
try {
result = result.version(result.highestVersionNum() + 1);
}
catch (IException &) {
result = result.version(1);
}
}
if (result.fileExists()) {
throw IException(IException::Unknown,
QObject::tr("Could not generate unique new version of file named [%1] in "
"[%2] because the file [%3] exists")
.arg(name()).arg(originalPath()).arg(result.name()),
_FILEINFO_);
}
return result;
}