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


C++ QXmlItem::isNull方法代码示例

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


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

示例1: toNodeModelIndex

void tst_QXmlItem::toNodeModelIndex() const
{
    /* Check default value. */
    {
        const QXmlItem item;
        QVERIFY(item.toNodeModelIndex().isNull());
    }

    /* On valid atomic value. */
    {
        const QXmlItem item(QVariant(3));
        QVERIFY(item.toNodeModelIndex().isNull());
    }

    /* On a QXmlItem constructed from a null QVariant. */
    {
        const QXmlItem item((QVariant()));
        QVERIFY(item.isNull());
    }

    /* On a QXmlItem constructed from a null QXmlNodeModelIndex. */
    {
        const QXmlItem item((QXmlNodeModelIndex()));
        QVERIFY(item.isNull());
    }
}
开发者ID:KDE,项目名称:android-qt,代码行数:26,代码来源:tst_qxmlitem.cpp

示例2: qtToXDMType

ItemType::Ptr AtomicValue::qtToXDMType(const QXmlItem &item)
{
    Q_ASSERT(!item.isNull());

    if(item.isNull())
        return ItemType::Ptr();

    if(item.isNode())
        return BuiltinTypes::node;

    Q_ASSERT(item.isAtomicValue());
    const QVariant v(item.toAtomicValue());

    switch(int(v.type()))
    {
        case QVariant::Char:
        /* Fallthrough. */
        case QVariant::String:
        /* Fallthrough. */
        case QVariant::Url:
            return BuiltinTypes::xsString;
        case QVariant::Bool:
            return BuiltinTypes::xsBoolean;
        case QVariant::ByteArray:
            return BuiltinTypes::xsBase64Binary;
        case QVariant::Int:
        /* Fallthrough. */
        case QVariant::LongLong:
            return BuiltinTypes::xsInteger;
        case QVariant::ULongLong:
            return BuiltinTypes::xsUnsignedLong;
        case QVariant::Date:
            return BuiltinTypes::xsDate;
        case QVariant::DateTime:
        /* Fallthrough. */
        case QVariant::Time:
            return BuiltinTypes::xsDateTime;
        case QMetaType::Float:
	    return BuiltinTypes::xsFloat;
        case QVariant::Double:
            return BuiltinTypes::xsDouble;
        default:
            return ItemType::Ptr();
    }
}
开发者ID:husninazer,项目名称:qt,代码行数:45,代码来源:qatomicvalue.cpp

示例3: constCorrectness

/*!
  Check that the functions that should be const, are.
 */
void tst_QXmlItem::constCorrectness() const
{
    const QXmlItem item;
    item.isNull();
    item.isNode();
    item.isAtomicValue();

    item.toAtomicValue();
    item.toNodeModelIndex();
}
开发者ID:KDE,项目名称:android-qt,代码行数:13,代码来源:tst_qxmlitem.cpp

示例4: copyConstructorFromQXmlNodeModelIndex

void tst_QXmlItem::copyConstructorFromQXmlNodeModelIndex() const
{
    // TODO copy a valid model index.

    /* Construct from a null QXmlNodeModelIndex. */
    {
        const QXmlItem item((QXmlNodeModelIndex()));
        QVERIFY(item.isNull());
    }
}
开发者ID:KDE,项目名称:android-qt,代码行数:10,代码来源:tst_qxmlitem.cpp

示例5: copyConstructorFromQVariant

void tst_QXmlItem::copyConstructorFromQVariant() const
{
    /* Construct & destruct a single value. */
    {
        const QXmlItem item(QVariant(QString::fromLatin1("dummy")));
    }

    /* Copy a null QVariant. */
    {
        const QXmlItem item((QVariant()));
        QVERIFY(item.isNull());
    }

}
开发者ID:KDE,项目名称:android-qt,代码行数:14,代码来源:tst_qxmlitem.cpp

示例6: bindVariable

/*!
  Binds the variable \a name to the \a value so that $\a name can be
  used from within the query to refer to the \a value.

  \a name must not be \e null. \a {name}.isNull() must return false.
  If \a name has already been bound by a previous bindVariable() call,
  its previous binding will be overridden.

  If \a {value} is null so that \a {value}.isNull() returns true, and
  \a {name} already has a binding, the effect is to remove the
  existing binding for \a {name}.

  To bind a value of type QString or QUrl, wrap the value in a
  QVariant such that QXmlItem's QVariant constructor is called.

  All strings processed by the query must be valid XQuery strings,
  which means they must contain only XML 1.0 characters. However,
  this requirement is not checked. If the query processes an invalid
  string, the behavior is undefined.

  \sa QVariant::isValid(), {QtXDM}{How QVariant maps to XQuery's Data Model},
   QXmlItem::isNull()
 */
void QXmlQuery::bindVariable(const QXmlName &name, const QXmlItem &value)
{
    if(name.isNull())
    {
        qWarning("The variable name cannot be null.");
        return;
    }

    const QPatternist::VariableLoader::Ptr vl(d->variableLoader());
    const QVariant variant(QVariant::fromValue(value));

    /* If the type of the variable changed(as opposed to only the value),
     * we will have to recompile. */
    if(vl->invalidationRequired(name, variant) || value.isNull())
        d->recompileRequired();

    vl->addBinding(name, variant);
}
开发者ID:maxxant,项目名称:qt,代码行数:41,代码来源:qxmlquery.cpp

示例7: PyBool_FromLong

static PyObject *meth_QXmlItem_isNull(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        QXmlItem *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QXmlItem, &sipCpp))
        {
            bool sipRes;

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->isNull();
            Py_END_ALLOW_THREADS

            return PyBool_FromLong(sipRes);
        }
    }
开发者ID:ClydeMojura,项目名称:android-python27,代码行数:18,代码来源:sipQtXmlPatternsQXmlItem.cpp

示例8: newMessage

Presets *PtzManagement::getPresets()
{
    Presets *presets = NULL;
    Message *msg = newMessage();
    QDomElement getPresets = newElement("wsdl:GetPresets");
    QDomElement profileToken = newElement("wsdl:ProfileToken","profile_CIF");
    getPresets.appendChild(profileToken);
    msg->appendToBody(getPresets);
    MessageParser *result = sendMessage(msg);
    if(result != NULL){
        presets = new Presets();
        QXmlQuery *query = result->query();
        QXmlResultItems items;
        QXmlItem item;
        QString value,xml;
        QDomDocument doc;
        QDomNodeList itemNodeList;
        QDomNode node;
        query->setQuery(result->nameSpace()+"doc($inputDocument)//tptz:Preset");
        query->evaluateTo(&items);
        item = items.next();
        while(!item.isNull()){
            query->setFocus(item);
            query->setQuery(result->nameSpace()+".");
            query->evaluateTo(&xml);
            doc.setContent(xml);
            itemNodeList = doc.elementsByTagName("tptz:Preset");
            for(int i=0; i<itemNodeList.size(); i++)
            {
                node = itemNodeList.at(i);
                value = node.toElement().attribute("token");
                presets->setToken(value.trimmed());
            }
            query->setQuery(result->nameSpace()+"./tt:Name/string()");
            query->evaluateTo(&value);
            presets->setName(value.trimmed());
            item = items.next();
        }
    }
    delete msg;
    delete result;
    return presets;
}
开发者ID:EricChen2013,项目名称:qt-onvif-client,代码行数:43,代码来源:ptzmanagement.cpp

示例9: 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

示例10: execute

TestResult::List TestCase::execute(const ExecutionStage stage)
{
    ErrorHandler errHandler;
    ErrorHandler::installQtMessageHandler(&errHandler);

    pDebug() << "TestCase::execute()";
    delete m_result;

    QXmlQuery query(language(), Global::namePoolAsPublic());

    query.d->setExpressionFactory(s_exprFact);
    query.setInitialTemplateName(initialTemplateName());

    QXmlQuery openDoc(query.namePool());

    if(contextItemSource().isValid())
    {
        openDoc.setQuery(QString::fromLatin1("doc('") + contextItemSource().toString() + QLatin1String("')"));
        Q_ASSERT(openDoc.isValid());
        QXmlResultItems result;

        openDoc.evaluateTo(&result);
        const QXmlItem item(result.next());
        Q_ASSERT(!item.isNull());
        query.setFocus(item);
    }

    TestResult::List retval;

    const Scenario scen(scenario());
    TestResult::Status resultStatus = TestResult::Unknown;

    bool ok = false;
    const QString queryString(sourceCode(ok));

    if(!ok)
    {
        /* Loading the query file failed, or similar. */
        resultStatus = TestResult::Fail;

        m_result = new TestResult(name(), resultStatus, s_exprFact->astTree(),
                                  errHandler.messages(), QPatternist::Item::List(), QString());
        retval.append(m_result);
        ErrorHandler::installQtMessageHandler(0);
        changed(this);
        return retval;
    }

    query.setMessageHandler(&errHandler);
    QXmlNamePool namePool(query.namePool());

    /* Bind variables. */
    QPatternist::ExternalVariableLoader::Ptr loader(externalVariableLoader());
    if(loader)
    {
        Q_ASSERT(loader);
        const ExternalSourceLoader::VariableMap vMap(static_cast<const ExternalSourceLoader *>(loader.data())->variableMap());
        const QStringList variables(vMap.keys());

        for(int i = 0; i < variables.count(); ++i)
        {
            const QXmlName name(namePool, variables.at(i));
            const QXmlItem val(QPatternist::Item::toPublic(loader->evaluateSingleton(name, QPatternist::DynamicContext::Ptr())));
            query.bindVariable(name, val);
        }
    }

    /* We pass in the testCasePath(), such that the base URI is correct fort
     * XSL-T stylesheets. */
    query.setQuery(queryString, testCasePath());

    if(!query.isValid())
    {
        pDebug() << "Got compilation exception.";
        resultStatus = TestBaseLine::scanErrors(errHandler.messages(), baseLines());

        Q_ASSERT(resultStatus != TestResult::Unknown);
        m_result = new TestResult(name(), resultStatus, s_exprFact->astTree(),
                                  errHandler.messages(), QPatternist::Item::List(), QString());
        retval.append(m_result);
        ErrorHandler::installQtMessageHandler(0);
        changed(this);
        return retval;
    }

    if(stage == CompileOnly)
    {
        m_result = new TestResult(name(), TestResult::Fail, s_exprFact->astTree(),
                                  errHandler.messages(), QPatternist::Item::List(), QString());
        retval.append(m_result);
        return retval;
    }

    Q_ASSERT(stage == CompileAndRun);

    if(scen == ParseError) /* We're supposed to have received an error
                              at this point. */
    {
        m_result = new TestResult(name(), TestResult::Fail, s_exprFact->astTree(),
                                  errHandler.messages(), QPatternist::Item::List(), QString());
//.........这里部分代码省略.........
开发者ID:krysanto,项目名称:steamlink-sdk,代码行数:101,代码来源:TestCase.cpp

示例11: Load


//.........这里部分代码省略.........
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
        SetBboxMode((BoundingBoxMode)item.toAtomicValue().toInt());
    }

    QRect bbox; //Bounding box
    //Bounding Box Left
    query.setQuery("sprite/bbox_left/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
       bbox.setLeft(item.toAtomicValue().toInt());
    }

    //Bounding Box Right
    query.setQuery("sprite/bbox_right/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
       bbox.setRight(item.toAtomicValue().toInt());
    }

    //Bounding Box Top
    query.setQuery("sprite/bbox_top/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
       bbox.setTop(item.toAtomicValue().toInt());
    }

    //Bounding Box Bottom
    query.setQuery("sprite/bbox_bottom/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
       bbox.setBottom(item.toAtomicValue().toInt());
    }

    SetBbox(bbox); //Set the bounding box

    //Horizontal Tile?
    query.setQuery("sprite/HTile/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
       SetHTile(item.toAtomicValue().toBool());
    }

    //Vertical Tile?
    query.setQuery("sprite/VTile/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
       SetVTile(item.toAtomicValue().toBool());
    }

    //For 3D?
    query.setQuery("sprite/For3D/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
       SetFor3D(item.toAtomicValue().toBool());
    }


    QSize size;
    //Width of sprite
    query.setQuery("sprite/width/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
       size.setWidth(item.toAtomicValue().toInt());
    }

    //Height of Sprite
    query.setQuery("sprite/height/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
       size.setHeight(item.toAtomicValue().toInt());
    }

    SetSize(size); //Set the size of the sprite


    //We will now get all of the frames for the sprite (NOTE: This ignores the index attribute and just adds them in order)
    query.setQuery("sprite/frames/frame/string()");
    query.evaluateTo(&result);
    item = result.next();
    while (!item.isNull()) {
        if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
            QString frameFilePath = GetFileInfo().absolutePath().append("/").append(item.toAtomicValue().toString());
            frames.push_back(QFileInfo(frameFilePath));
        }
        item = result.next();
    }

    spriteFile.close(); //Close the XML File
    return true;
}
开发者ID:TrieBr,项目名称:GMIDE,代码行数:101,代码来源:GMAsset_Sprite.cpp


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