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


C++ QXmlResultItems::hasError方法代码示例

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


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

示例1: hasError

void tst_QXmlResultItems::hasError() const
{
    /* Check default value. */
    {
        QXmlResultItems result;
        QVERIFY(!result.hasError());
    }

    /* Stress it on a default constructed value. */
    {
        QXmlResultItems result;
        QVERIFY(!result.hasError());
        QVERIFY(!result.hasError());
        QVERIFY(!result.hasError());
    }
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:16,代码来源:tst_qxmlresultitems.cpp

示例2: evaluate

void tst_QXmlResultItems::evaluate() const
{
    QFETCH(QString, queryString);

    QXmlQuery query;
    query.setQuery(queryString);

    QVERIFY(query.isValid());

    QXmlResultItems result;
    query.evaluateTo(&result);
    QXmlItem item(result.next());

    while(!item.isNull())
    {
        QVERIFY(!result.current().isNull());
        QVERIFY(!result.hasError());
        item = result.next();
    }

    /* Now, stress beyond the end. */
    for(int i = 0; i < 3; ++i)
    {
        QVERIFY(result.current().isNull());
        QVERIFY(result.next().isNull());
    }
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:27,代码来源:tst_qxmlresultitems.cpp

示例3: constCorrectness

void tst_QXmlResultItems::constCorrectness() const
{
    const QXmlResultItems result;

    /* These functions should be const. */
    result.current();
    result.hasError();
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:8,代码来源:tst_qxmlresultitems.cpp

示例4: evalateWithQueryError

void tst_QXmlResultItems::evalateWithQueryError() const
{
    /* This query is invalid. */
    const QXmlQuery query;

    QXmlResultItems result;
    query.evaluateTo(&result);

    QVERIFY(result.hasError());
    QVERIFY(result.next().isNull());
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:11,代码来源:tst_qxmlresultitems.cpp

示例5: evalateWithInstantError

/*!
 What's special about this is that it's not the QAbstractXmlForwardIterator::next()
 that triggers the error, it's QPatternist::Expression::evaluateSingleton() directly.
 */
void tst_QXmlResultItems::evalateWithInstantError() const
{
    QXmlQuery query;
    MessageSilencer silencer;
    query.setMessageHandler(&silencer);
    query.setQuery(QLatin1String("fn:error()"));

    QXmlResultItems result;
    query.evaluateTo(&result);

    /* Check the values, and stress it. */
    for(int i = 0; i < 3; ++i)
    {
        QVERIFY(result.current().isNull());
        QVERIFY(result.next().isNull());
        QVERIFY(result.hasError());
    }
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:22,代码来源:tst_qxmlresultitems.cpp

示例6: setFocusHelper

bool setFocusHelper(QXmlQuery *const queryInstance,
                    const TInputType &focusValue)
{
    /* We call resourceLoader(), so we have ensured that we have a resourceLoader
     * that we will share in our copy. */
    queryInstance->d->resourceLoader();

    QXmlQuery focusQuery(*queryInstance);

    /* Now we use the same, so we own the loaded document. */
    focusQuery.d->m_resourceLoader = queryInstance->d->m_resourceLoader;

    /* The copy constructor doesn't allow us to copy an existing QXmlQuery and
     * changing the language at the same time so we need to use private API. */
    focusQuery.d->queryLanguage = QXmlQuery::XQuery10;

    Q_ASSERT(focusQuery.queryLanguage() == QXmlQuery::XQuery10);
    focusQuery.bindVariable(QChar::fromLatin1('u'), focusValue);
    focusQuery.setQuery(QLatin1String("doc($u)"));
    Q_ASSERT(focusQuery.isValid());

    QXmlResultItems focusResult;

    queryInstance->d->m_resourceLoader = focusQuery.d->m_resourceLoader;

    focusQuery.evaluateTo(&focusResult);
    const QXmlItem focusItem(focusResult.next());

    if(focusItem.isNull() || focusResult.hasError())
    {
        /* The previous focus must be cleared in error situations.
         * Otherwise the query may be left in an inconsistent state. */
        queryInstance->setFocus(QXmlItem());
        return false;
    }
    else
    {
        queryInstance->setFocus(focusItem);
        return true;
    }
}
开发者ID:maxxant,项目名称:qt,代码行数:41,代码来源:qxmlquery.cpp

示例7: parseFeatures

void WfsCapabilitiesParser::parseFeatures(std::vector<Resource> &wfsFeatures)
{
    qDebug() << "WfsCapabilitiesParser::parseFeatures()";

    QXmlResultItems results;
    UPXmlQuery& query = _parser->queryFromRoot("//wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType");

    if (query->isValid()) {
        query->evaluateTo( &results);
        QXmlItem item(results.next());
        while (!item.isNull()) {
            WfsFeature feature;
            parseFeature(item, feature);
            wfsFeatures.push_back(feature);
            item = results.next();
        }
        if (results.hasError()) {
            ERROR0(TR(QString("XPath evaluation failed.")));
        }
    }
}
开发者ID:52North,项目名称:IlwisConnectors,代码行数:21,代码来源:wfscapabilitiesparser.cpp

示例8: testXmlQuery

void TestSimulationMaker::testXmlQuery()
{
	writeQuery("/simulation/model", 1);
	writeQuery("/simulation//model[@type='LifeCycle']", 2);
	writeQuery("/simulation/model[@name='wasp']/model[@name='egg']/parameter[@name='k']", 3);
	writeQuery("/simulation/output[@name='butterflyOutput']/"
	               "presentation[@name='butterflyPlot']/xyvariables[@name='butterflyXY']", 4);
	
	QXmlQuery query;
	query.setQuery("<e/>, 1, 'two'");
	QXmlResultItems result;
	
	if (query.isValid()) {
		query.evaluateTo(&result);
		QXmlItem item(result.next());
		while (!item.isNull()) {
			// use item
			item = result.next();
		}
		if (result.hasError())
	 /* Runtime error! */;
	}
}
开发者ID:ZhaoweiDing,项目名称:UniSim,代码行数:23,代码来源:test_simulation_maker.cpp


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