当前位置: 首页>>代码示例>>C++>>正文


C++ QStack::pop方法代码示例

本文整理汇总了C++中QStack::pop方法的典型用法代码示例。如果您正苦于以下问题:C++ QStack::pop方法的具体用法?C++ QStack::pop怎么用?C++ QStack::pop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QStack的用法示例。


在下文中一共展示了QStack::pop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: advance

/*!
    \internal
*/
void QDirIteratorPrivate::advance()
{
    // Store the current entry
    if (!fileEngineIterators.isEmpty())
        currentFilePath = fileEngineIterators.top()->currentFilePath();

    // Advance to the next entry
    if (followNextDir) {
        // Start by navigating into the current directory.
        followNextDir = false;

        QAbstractFileEngineIterator *it = fileEngineIterators.top();

        QString subDir = it->currentFilePath();
#ifdef Q_OS_WIN
        if (currentFileInfo.isSymLink())
            subDir = currentFileInfo.canonicalFilePath();
#endif
        pushSubDirectory(subDir, it->nameFilters(), it->filters());
    }

    while (!fileEngineIterators.isEmpty()) {
        QAbstractFileEngineIterator *it = fileEngineIterators.top();

        // Find the next valid iterator that matches the filters.
        bool foundDirectory = false;
        while (it->hasNext()) {
            it->next();
            if (matchesFilters(it)) {
                currentFileInfo = nextFileInfo;
                nextFileInfo = it->currentFileInfo();
                // Signal that we want to follow this entry.
                followNextDir = shouldFollowDirectory(nextFileInfo);
                //We found a matching entry.
                return;

            } else if (iteratorFlags & QDirIterator::Subdirectories) {
                QFileInfo fileInfo = it->currentFileInfo();

                if (!shouldFollowDirectory(fileInfo))
                    continue;
                QString subDir = it->currentFilePath();
#ifdef Q_OS_WIN
                if (fileInfo.isSymLink())
                    subDir = fileInfo.canonicalFilePath();
#endif
                pushSubDirectory(subDir, it->nameFilters(), it->filters());
                
                foundDirectory = true;
                break;
            }
        }
        if (!foundDirectory)
            delete fileEngineIterators.pop();
    }
    currentFileInfo = nextFileInfo;
    done = true;
}
开发者ID:Fale,项目名称:qtmoko,代码行数:61,代码来源:qdiriterator.cpp

示例2: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
	QStack<QString> files;

	// Command Line setup
	QCommandLineParser parser;
	// Process options
	parser.process( a );

	int incorrectFiles = 0;
	// Files were passed
	for ( const QString & arg : parser.positionalArguments() ) {
		QFileInfo finfo( arg );

		QRegularExpression ext( "^(bsa|ba2)$", QRegularExpression::CaseInsensitiveOption );
		if ( finfo.exists() && finfo.suffix().contains( ext ) ) {
			files.push( arg );
		} else {
			incorrectFiles++;
		}
	}

    MainWindow w;

	a.setApplicationName( "Bethesda Archive Extractor" );
	a.setApplicationDisplayName( "B.A.E." );

	QDir::setCurrent( qApp->applicationDirPath() );

    w.show();

	if ( files.count() && !incorrectFiles ) {
		w.openFile( files.pop() );

		while ( !files.isEmpty()  ) {
			w.appendFile( files.pop() );
		}
	} else if ( incorrectFiles ) {
		// Incorrect files passed
		return 0;
	}

    return a.exec();
}
开发者ID:jonwd7,项目名称:bae,代码行数:45,代码来源:main.cpp

示例3: runCleanupFunctions

void runCleanupFunctions()
{
    //PySide::DestroyListener::instance()->destroy();
    while (!cleanupFunctionList.isEmpty()) {
        CleanupFunction f = cleanupFunctionList.pop();
        f();
    }
    PySide::DestroyListener::destroy();
}
开发者ID:BadSingleton,项目名称:pyside2,代码行数:9,代码来源:pyside.cpp

示例4: rebuildTree

void Tree::rebuildTree(string maestro){
    QStack<Node*>* arranjador = new QStack<Node*>();
    arranjador->push(root);

    for(int i = 0; i < maestro.length(); i++){

        if(maestro[i] == '$'){
            i++;
            if(arranjador->top()->getqFilhos() == false){
                Node* temp = new Node(0,true,maestro[i]);
                arranjador->top()->setLeftChild(temp);
                arranjador->top()->setqFilhos(true);
            }
            else if(arranjador->top()->getqFilhos() == true){
                Node* temp = new Node(0,true,maestro[i]);
                arranjador->top()->setRightChild(temp);
                arranjador->top()->setqFilhos(false);
            }
        }
        else{
            if(maestro[i] == '('){
                if(arranjador->top()->getqFilhos() == false){
                    Node* temp = new Node(i,false);
                    arranjador->top()->setLeftChild(temp);

                    arranjador->top()->setqFilhos(true);
                    arranjador->push(temp);
                }
                else if(arranjador->top()->getqFilhos() == true){
                    Node* temp = new Node(i,false);
                    arranjador->top()->setRightChild(temp);
                    arranjador->top()->setqFilhos(false);
                    arranjador->push(temp);
                }
            }
            else if(maestro[i] == ')'){
                arranjador->pop();
            }
            else{
                if(arranjador->top()->getqFilhos() == false){
                    Node* temp = new Node(0,true,maestro[i]);
                    arranjador->top()->setLeftChild(temp);
                    arranjador->top()->setqFilhos(true);
                }
                else if(arranjador->top()->getqFilhos() == true){
                    Node* temp = new Node(0,true,maestro[i]);
                    arranjador->top()->setRightChild(temp);
                    arranjador->top()->setqFilhos(false);
                }
            }
        }
    }

    if(arranjador->size()!= 1){
        cout << "TRASH! arvore desequilibrada" << endl;
    }
}
开发者ID:matheus013,项目名称:Huffman-in-Cplusplus,代码行数:57,代码来源:Tree.cpp

示例5: getLinetypeId

/**
 * \copydoc REntityData::getLinetypeId
 */
RLinetype::Id REntity::getLinetypeId(bool resolve,
    const QStack<RBlockReferenceEntity*>& blockRefStack) const {

    QStack<RBlockReferenceEntity*> newBlockRefStack = blockRefStack;
    if (!newBlockRefStack.isEmpty() && this==(REntity*)newBlockRefStack.top()) {
        newBlockRefStack.pop();
    }
    return getData().getLinetypeId(resolve, newBlockRefStack);
}
开发者ID:VixMobile,项目名称:qcad,代码行数:12,代码来源:REntity.cpp

示例6: xRenderPopTarget

void xRenderPopTarget()
{
    s_scene_offscreenTargetStack.pop();
    --s_renderOffscreen;
    if (s_renderOffscreen < 0) {
        s_renderOffscreen = 0;
        qWarning("*** SOMETHING IS MESSED UP WITH YOUR xRenderPopTarget() USAGE ***");
    }
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:9,代码来源:kwinxrenderutils.cpp

示例7: nodevisited

QList<ListDigraph::Node> ProcessModel::topolSortReachableFrom(const QList<ListDigraph::Node>& s) {
	ListDigraph::NodeMap<bool > nodevisited(graph, false);
	QList<ListDigraph::Node> res;
	QStack<ListDigraph::Node> stack;
	ListDigraph::Node curnode;
	ListDigraph::Node pnode;
	ListDigraph::Node snode;
	QList<ListDigraph::Node> reachable = reachableFrom(s);

	// Reserve memory
	res.reserve(countNodes(graph));
	stack.reserve(countNodes(graph));

	for (int i = 0; i < s.size(); i++) {
		if (s[i] != INVALID) {
			stack.push(s[i]);
		}
	}

	bool psched;
	while (!stack.empty()) {
		curnode = stack.pop();

		if (!nodevisited[curnode]) { // This node has not been visited yet

			// Check whether all predecessors in reachable are scheduled
			psched = true;
			for (ListDigraph::InArcIt iait(graph, curnode); iait != INVALID; ++iait) {
				pnode = graph.source(iait);
				if (reachable.contains(pnode)) { // Consider only nodes which can be reached from s
					if (!nodevisited[pnode]) {
						psched = false;
						break;
					}
				}
			}

			if (psched) { // All predecessors have been visited
				res.append(curnode);
				nodevisited[curnode] = true;

				// Push the succeeding nodes
				for (ListDigraph::OutArcIt oait(graph, curnode); oait != INVALID; ++oait) {
					snode = graph.target(oait);
					if (!nodevisited[snode]) {
						stack.push(snode);
					}
				}
			} else {
				stack.prepend(curnode);
			}

		} // Else ignore the visited node
	}

	return res;
}
开发者ID:DrSobik,项目名称:IPPS,代码行数:57,代码来源:ProcessModel.cpp

示例8: getColor

/**
 * \copydoc REntityData::getColor
 */
RColor REntity::getColor(bool resolve, const QStack<REntity*>& blockRefStack) {

    QStack<REntity*> newBlockRefStack = blockRefStack;
    if (!newBlockRefStack.isEmpty() && this==(REntity*)newBlockRefStack.top()) {
        newBlockRefStack.pop();
    }

    return getData().getColor(resolve, newBlockRefStack);
}
开发者ID:seem-sky,项目名称:qcad,代码行数:12,代码来源:REntity.cpp

示例9: JO

QString Stringify::JO(Object *o)
{
    if (stack.contains(o)) {
        ctx->throwTypeError();
        return QString();
    }

    Scope scope(ctx);

    QString result;
    stack.push(o);
    QString stepback = indent;
    indent += gap;

    QStringList partial;
    if (propertyList.isEmpty()) {
        ObjectIterator it(scope, o, ObjectIterator::EnumerableOnly);
        ScopedValue name(scope);

        ScopedValue val(scope);
        while (1) {
            name = it.nextPropertyNameAsString(val);
            if (name->isNull())
                break;
            QString key = name->toQString();
            QString member = makeMember(key, val);
            if (!member.isEmpty())
                partial += member;
        }
    } else {
        ScopedString s(scope);
        for (int i = 0; i < propertyList.size(); ++i) {
            bool exists;
            s = propertyList.at(i);
            ScopedValue v(scope, o->get(s.getPointer(), &exists));
            if (!exists)
                continue;
            QString member = makeMember(s->toQString(), v);
            if (!member.isEmpty())
                partial += member;
        }
    }

    if (partial.isEmpty()) {
        result = QStringLiteral("{}");
    } else if (gap.isEmpty()) {
        result = QStringLiteral("{") + partial.join(QLatin1Char(',')) + QStringLiteral("}");
    } else {
        QString separator = QStringLiteral(",\n") + indent;
        result = QStringLiteral("{\n") + indent + partial.join(separator) + QStringLiteral("\n") + stepback + QStringLiteral("}");
    }

    indent = stepback;
    stack.pop();
    return result;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:56,代码来源:qv4jsonobject.cpp

示例10: getLineweight

/**
 * \copydoc REntityData::getLineweight
 */
RLineweight::Lineweight REntity::getLineweight(bool resolve,
    const QStack<REntity*>& blockRefStack) const {

    QStack<REntity*> newBlockRefStack = blockRefStack;
    if (!newBlockRefStack.isEmpty() && this==(REntity*)newBlockRefStack.top()) {
        newBlockRefStack.pop();
    }

    return getData().getLineweight(resolve, newBlockRefStack);
}
开发者ID:seem-sky,项目名称:qcad,代码行数:13,代码来源:REntity.cpp

示例11: main

int main(int argc, char *argv[])
{
//! [0]
    QStack<int> stack;
    stack.push(1);
    stack.push(2);
    stack.push(3);
    while (!stack.isEmpty())
        cout << stack.pop() << endl;
//! [0]
}
开发者ID:HughMacdonald,项目名称:gafferDependencies,代码行数:11,代码来源:main.cpp

示例12: main

int main ()
{

  QStack<int> first;    
  first.push(1);
  assert(first.top() == 1);
  first.pop();
  first.push(2);
  assert(first.top() == 2);

  return 0;
}
开发者ID:xsery,项目名称:benchmarks-esbmc-qt,代码行数:12,代码来源:main.cpp

示例13: stream

void
BookmarkModel::setBookmarks(const QByteArray &bookmarks)
{
    beginResetModel();

    delete rootItem;
    folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon);
    bookmarkIcon = QIcon(QLatin1String(":/trolltech/assistant/images/bookmark.png"));

    rootItem = new BookmarkItem(DataVector() << tr("Name") << tr("Address")
        << true);

    QStack<BookmarkItem*> parents;
    QDataStream stream(bookmarks);

    qint32 version;
    stream >> version;
    if (version < VERSION) {
        stream.device()->seek(0);
        BookmarkItem* toolbar = new BookmarkItem(DataVector() << tr("Toolbar Menu")
            << QLatin1String("Folder") << true);
        rootItem->addChild(toolbar);

        BookmarkItem* menu = new BookmarkItem(DataVector() << tr("Bookmarks Menu")
            << QLatin1String("Folder") << true);
        rootItem->addChild(menu);
        parents.push(menu);
    } else {
        parents.push(rootItem);
    }

    qint32 depth;
    bool expanded;
    QString name, url;
    while (!stream.atEnd()) {
        stream >> depth >> name >> url >> expanded;
        while ((parents.count() - 1) != depth)
            parents.pop();

        BookmarkItem *item = new BookmarkItem(DataVector() << name << url << expanded);
        if (url == QLatin1String("Folder")) {
            parents.top()->addChild(item);
            parents.push(item);
        } else {
            parents.top()->addChild(item);
        }
    }

    cache.clear();
    setupCache(index(0,0, QModelIndex().parent()));
    endResetModel();
}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:52,代码来源:bookmarkmodel.cpp

示例14: foreach

/** depth first search of widgets hierarchy, from application topLevelWidgets
 */
static QWidget *search_widget(std::function<bool(QWidget* w)> match) {
    foreach (auto widget, QApplication::topLevelWidgets()) {
        QStack<QObject*> s;
        s.push(widget);
        while (!s.isEmpty()) {
            auto p = qobject_cast<QWidget*>(s.pop());
            if (match(p))
                return p;
            foreach (auto c, p->children())
                if (c->isWidgetType())
                    s.push(c);
        }
    }
开发者ID:xueziwenjin,项目名称:packages-swipl-win,代码行数:15,代码来源:pqConsole.cpp

示例15: scanRecursive

void Scanner::scanRecursive(QDir &d, ReleaseFileList &r, QStack<QString> &dirname)
{
    QDirIterator it(d);
    static QString pathDelim="/";

    while (it.hasNext()) {
        it.next();

        QFileInfo info = it.fileInfo();
        if (info.isDir()) {
            if (info.fileName()[0]=='.') {
                continue;
            }
            QDir nd(info.filePath());
            dirname.push(info.fileName());
            scanRecursive(nd, r,dirname);
            dirname.pop();
        } else {
            QFile file(info.filePath());
            ReleaseFile rf;

            if (file.open(QIODevice::ReadOnly) <0) {
                throw 2;
            }

            rf.sha = hashFile(file);

            

            dirname.push( info.fileName() );
            rf.name = qstackJoin( dirname, pathDelim);
            rf.size = info.size();
            rf.exec = info.isExecutable();
            r.push_back(rf);
            dirname.pop();
            file.close();
        }
    }
}
开发者ID:kdgoup,项目名称:arduinoupdater,代码行数:39,代码来源:scanner.cpp


注:本文中的QStack::pop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。