本文整理汇总了C++中item::List::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ List::isEmpty方法的具体用法?C++ List::isEmpty怎么用?C++ List::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item::List
的用法示例。
在下文中一共展示了List::isEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateState
void ActionStateManager::updateState(const Collection::List &collections, const Item::List &items)
{
const int collectionCount = collections.count();
const bool singleCollectionSelected = (collectionCount == 1);
const bool multipleCollectionsSelected = (collectionCount > 1);
const bool atLeastOneCollectionSelected = (singleCollectionSelected || multipleCollectionsSelected);
const int itemCount = items.count();
const bool singleItemSelected = (itemCount == 1);
const bool multipleItemsSelected = (itemCount > 1);
const bool atLeastOneItemSelected = (singleItemSelected || multipleItemsSelected);
const bool listOfCollectionNotEmpty = collections.isEmpty() ? false : true;
bool canDeleteCollections = listOfCollectionNotEmpty;
if (canDeleteCollections) {
foreach (const Collection &collection, collections) {
// do we have the necessary rights?
if (!(collection.rights() &Collection::CanDeleteCollection)) {
canDeleteCollections = false;
break;
}
if (isRootCollection(collection)) {
canDeleteCollections = false;
break;
}
if (isResourceCollection(collection)) {
canDeleteCollections = false;
break;
}
}
}
bool canCutCollections = canDeleteCollections; // we must be able to delete for cutting
foreach (const Collection &collection, collections) {
if (isSpecialCollection(collection)) {
canCutCollections = false;
break;
}
if (!isFolderCollection(collection)) {
canCutCollections = false;
break;
}
}
const bool canMoveCollections = canCutCollections; // we must be able to cut for moving
bool canCopyCollections = listOfCollectionNotEmpty;
if (canCopyCollections) {
foreach (const Collection &collection, collections) {
if (isRootCollection(collection)) {
canCopyCollections = false;
break;
}
if (!isFolderCollection(collection)) {
canCopyCollections = false;
break;
}
}
}
bool canAddToFavoriteCollections = listOfCollectionNotEmpty;
if (canAddToFavoriteCollections) {
foreach (const Collection &collection, collections) {
if (isRootCollection(collection)) {
canAddToFavoriteCollections = false;
break;
}
if (isFavoriteCollection(collection)) {
canAddToFavoriteCollections = false;
break;
}
if (!isFolderCollection(collection)) {
canAddToFavoriteCollections = false;
break;
}
if (!canContainItems(collection)) {
canAddToFavoriteCollections = false;
break;
}
}
}
bool canRemoveFromFavoriteCollections = listOfCollectionNotEmpty;
foreach (const Collection &collection, collections) {
if (!isFavoriteCollection(collection)) {
canRemoveFromFavoriteCollections = false;
break;
}
}
bool collectionsAreFolders = listOfCollectionNotEmpty;
foreach (const Collection &collection, collections) {
if (!isFolderCollection(collection)) {
collectionsAreFolders = false;
//.........这里部分代码省略.........