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


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

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


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

示例1: isAtomicValue

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

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

    // TODO on valid node index

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

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

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

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

示例4: Load

//Load the asset from the specified file
bool GMAsset_Sprite::Load(const QFileInfo &file)
{
    this->GMAsset::Load(file);
    QFile spriteFile(file.absoluteFilePath());
    if (!spriteFile.exists()) return false; //File does not exist
    if (!spriteFile.open(QIODevice::ReadOnly | QIODevice::Text))
            return false; //Failed to open the file
    QXmlQuery query;
    QXmlResultItems  result;
    QXmlItem item;
    query.setFocus(&spriteFile);

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

    QPoint origin;
    //X Origin
    query.setQuery("sprite/xorig/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
        origin.setX(item.toAtomicValue().toInt());
    }

    //Y Origin
    query.setQuery("sprite/yorigin/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
        origin.setY(item.toAtomicValue().toInt());
    }
    SetOrigin(origin);

    //Collision Kind
    query.setQuery("sprite/colkind/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
        SetCollisionKind((CollisionKind)item.toAtomicValue().toInt());
    }

    //Color Tolerance
    query.setQuery("sprite/coltolerance/string()");
    query.evaluateTo(&result);
    item = result.next();
    if (item.isAtomicValue()) { //Make sure the item is an atomic value (ie, the node string was returned)
        SetColTolerance(item.toAtomicValue().toInt());
    }

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

    //Bounding Box Mode
    query.setQuery("sprite/bboxmode/string()");
    query.evaluateTo(&result);
    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();
//.........这里部分代码省略.........
开发者ID:TrieBr,项目名称:GMIDE,代码行数:101,代码来源:GMAsset_Sprite.cpp


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