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


C++ QXmlName类代码示例

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


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

示例1: attribute

/*!
  \reimp
 */
void QXmlSerializer::attribute(const QXmlName &name,
                               const QStringRef &value)
{
    Q_D(QXmlSerializer);
    Q_ASSERT(!name.isNull());

    /* Ensure that the namespace URI used in the name gets outputted. */
    {
        /* Since attributes doesn't pick up the default namespace, a
         * namespace declaration would cause trouble if we output it. */
        if(name.prefix() != StandardPrefixes::empty)
            namespaceBinding(name);
    }

    if(atDocumentRoot())
    {
        Q_UNUSED(d);
        d->query.d->staticContext()->error(QtXmlPatterns::tr(
           "Attribute %1 can't be serialized because it appears at "
           "the top level.").arg(formatKeyword(d->np, name)),
                                           ReportContext::SENR0001,
                                           d->query.d->expression().data());
    }
    else
    {
        d->write(' ');
        write(name);
        write("=\"");
        writeEscapedAttribute(value.toString());
        d->write('"');
    }
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:35,代码来源:qxmlserializer.cpp

示例2: retrieveProperty

QString ExternalEnvironment::retrieveProperty(const QXmlName name)
{
    if(name.namespaceURI() != StandardNamespaces::xslt)
        return QString();

    switch(name.localName())
    {
        case StandardLocalNames::version:
            return QString::number(ExternalEnvironment::XSLVersion);
        case StandardLocalNames::vendor:
            return ExternalEnvironment::Vendor;
        case StandardLocalNames::vendor_url:
            return QString(ExternalEnvironment::VendorURL.toString());
        case StandardLocalNames::product_name:
            return ExternalEnvironment::ProductName;
        case StandardLocalNames::product_version:
            return ExternalEnvironment::ProductVersion;
        case StandardLocalNames::is_schema_aware:
            return toString(ExternalEnvironment::IsSchemaAware);
        case StandardLocalNames::supports_serialization:
            return toString(ExternalEnvironment::SupportsSerialization);
        case StandardLocalNames::supports_backwards_compatibility:
            return toString(ExternalEnvironment::SupportsBackwardsCompatibility);
        default:
            return QString();
    }
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:27,代码来源:qexternalenvironment.cpp

示例3: addBinding

void GenericNamespaceResolver::addBinding(const QXmlName nb)
{
    if(nb.namespaceURI() == StandardNamespaces::UndeclarePrefix)
        m_bindings.remove(nb.prefix());
    else
        m_bindings.insert(nb.prefix(), nb.namespaceURI());
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:7,代码来源:qgenericnamespaceresolver.cpp

示例4: retrieveProperty

QString SystemPropertyFN::retrieveProperty(const QXmlName name)
{
    if(name.namespaceURI() != StandardNamespaces::xslt)
        return QString();

    switch(name.localName())
    {
        case StandardLocalNames::version:
            /*
             * The supported XSL-T version.
             *
             * @see <a href="http://www.w3.org/TR/xslt20/#system-property">The Note paragraph
             * at the very end of XSL Transformations (XSLT) Version 2.0,
             * 16.6.5 system-property</a>
             */
            return QString::number(1.20);
        case StandardLocalNames::vendor:
            return QLatin1String("Digia Plc and/or its subsidiary(-ies), a Digia Company");
        case StandardLocalNames::vendor_url:
            return QLatin1String("http://qt.digia.com/");
        case StandardLocalNames::product_name:
            return QLatin1String("QtXmlPatterns");
        case StandardLocalNames::product_version:
            return QLatin1String("0.1");
        case StandardLocalNames::is_schema_aware:
        /* Fallthrough. */
        case StandardLocalNames::supports_backwards_compatibility:
        /* Fallthrough. */
        case StandardLocalNames::supports_serialization:
        /* Fallthrough. */
            return QLatin1String("no");
        default:
            return QString();
    }
}
开发者ID:krysanto,项目名称:steamlink-sdk,代码行数:35,代码来源:qsystempropertyfn.cpp

示例5: Ptr

FunctionSignature::Ptr XSLT10CoreFunctions::retrieveFunctionSignature(const NamePool::Ptr &np, const QXmlName name)
{
    if(StandardNamespaces::fn != name.namespaceURI())
        return FunctionSignature::Ptr();

    FunctionSignature::Ptr s(functionSignatures().value(name));

    if(!s)
    {
        /* Alphabetic order. */
        if(name.localName() == StandardLocalNames::function_available)
        {
            s = addFunction(StandardLocalNames::function_available, 1, 2, CommonSequenceTypes::ExactlyOneBoolean);
            s->appendArgument(argument(np, "function_name"), CommonSequenceTypes::ExactlyOneString);
            s->appendArgument(argument(np, "arity"), CommonSequenceTypes::ExactlyOneInteger);
        }
        else if(name.localName() == StandardLocalNames::system_property)
        {
            s = addFunction(StandardLocalNames::system_property, 1, 1, CommonSequenceTypes::ExactlyOneString);
            s->appendArgument(argument(np, "property_name"), CommonSequenceTypes::ExactlyOneString);
        }
    }

    return s;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:25,代码来源:qxslt10corefunctions.cpp

示例6: startStructure

void AccelTreeBuilder<FromDocument>::startElement(const QXmlName &name, qint64 line, qint64 column)
{
    startStructure();

    AccelTree::BasicNodeData data(currentDepth(), currentParent(), QXmlNodeModelIndex::Element, -1, name);
    m_document->basicData.append(data);
    if (m_features & SourceLocationsFeature)
        m_document->sourcePositions.insert(m_document->maximumPreNumber(), qMakePair(line, column));

    ++m_preNumber;
    m_ancestors.push(m_preNumber);

    ++m_size.top();
    m_size.push(0);

    /* With node constructors, we can receive names for which we have no namespace
     * constructors, such as in the query '<xs:space/>'. Since the 'xs' prefix has no
     * NamespaceConstructor in this case, we synthesize the namespace.
     *
     * In case we're constructing from an XML document we avoid the call because
     * although it's redundant, it's on extra virtual call for each element. */
    if(!FromDocument)
        namespaceBinding(QXmlName(name.namespaceURI(), 0, name.prefix()));

    m_isPreviousAtomic = false;
}
开发者ID:Suneal,项目名称:qt,代码行数:26,代码来源:qacceltreebuilder.cpp

示例7:

void AccelTreeBuilder<FromDocument>::namespaceBinding(const QXmlName &nb)
{
    /* Note, because attribute() sometimes generate namespaceBinding() calls, this function
     * can be called after attributes, in contrast to what the class documentation says. This is ok,
     * as long as we're not dealing with public API. */

    /* If we've received attributes, it means the element's size have changed and m_preNumber have advanced,
     * so "reverse back" to the actual element. */
    const AccelTree::PreNumber pn = m_preNumber - m_size.top();

    QVector<QXmlName> &nss = m_document->namespaces[pn];

    /* "xml" hasn't been declared for each node, AccelTree::namespaceBindings() adds it, so avoid it
     * such that we don't get duplicates. */
    if(nb.prefix() == StandardPrefixes::xml)
        return;

    /* If we already have the binding, skip it. */
    const int len = nss.count();
    for(int i = 0; i < len; ++i)
    {
        if(nss.at(i).prefix() == nb.prefix())
            return;
    }

    nss.append(nb);
}
开发者ID:Suneal,项目名称:qt,代码行数:27,代码来源:qacceltreebuilder.cpp

示例8: n1

/*!
 Ensure that the three last arguments have default values, and that they are null strings.
 */
void tst_QXmlName::argumentConstructorDefaultArguments() const
{
    QXmlNamePool np;
    const QXmlName n1(np, QLatin1String("localName"));
    const QXmlName n2(np, QLatin1String("localName"), QString(), QString());

    QCOMPARE(n1, n2);
    QCOMPARE(n1.toClarkName(np), QString::fromLatin1("localName"));
}
开发者ID:maxxant,项目名称:qt,代码行数:12,代码来源:tst_qxmlname.cpp

示例9: error

void ReportContext::error(const QString &msg,
                          const QXmlName qname,
                          const SourceLocationReflection *const reflection)
{
    Q_ASSERT(!qname.isNull());
    createError(msg, QtFatalMsg,
                QUrl(namePool()->stringForNamespace(qname.namespaceURI()) + QLatin1Char('#') + namePool()->stringForLocalName(qname.localName())),
                lookupSourceLocation(reflection));
}
开发者ID:krysanto,项目名称:steamlink-sdk,代码行数:9,代码来源:qreportcontext.cpp

示例10: name

Item AttributeNameValidator::evaluateSingleton(const DynamicContext::Ptr &context) const
{
    const Item name(m_operand->evaluateSingleton(context));
    const QXmlName qName(name.as<QNameValue>()->qName());

    if(qName.namespaceURI() == StandardNamespaces::xmlns)
    {
        context->error(QtXmlPatterns::tr("The namespace URI in the name for a "
                                         "computed attribute cannot be %1.")
                       .arg(formatURI(CommonNamespaces::XMLNS)),
                       ReportContext::XQDY0044, this);
        return Item(); /* Silence warning. */
    }
    else if(qName.namespaceURI() == StandardNamespaces::empty &&
            qName.localName() == StandardLocalNames::xmlns)
    {
        context->error(QtXmlPatterns::tr("The name for a computed attribute "
                                         "cannot have the namespace URI %1 "
                                         "with the local name %2.")
                          .arg(formatURI(CommonNamespaces::XMLNS))
                          .arg(formatKeyword("xmlns")),
                       ReportContext::XQDY0044, this);
        return Item(); /* Silence warning. */
    }
    else if(!qName.hasPrefix() && qName.hasNamespace())
    {
        return Item(QNameValue::fromValue(context->namePool(),
                                          QXmlName(qName.namespaceURI(), qName.localName(), StandardPrefixes::ns0)));
    }
    else
        return name;
}
开发者ID:husninazer,项目名称:qt,代码行数:32,代码来源:qattributenamevalidator.cpp

示例11: name1

void tst_QXmlSchemaValidator::resetSchemaNamePool() const
{
    QXmlSchema schema1;
    QXmlNamePool np1 = schema1.namePool();

    const QXmlName name1(np1, QLatin1String("localName"),
                              QLatin1String("http://example.com/"),
                              QLatin1String("prefix"));

    QXmlSchemaValidator validator(schema1);

    {
        QXmlNamePool compNamePool(validator.namePool());
        QCOMPARE(name1.namespaceUri(compNamePool), QString::fromLatin1("http://example.com/"));
        QCOMPARE(name1.localName(compNamePool), QString::fromLatin1("localName"));
        QCOMPARE(name1.prefix(compNamePool), QString::fromLatin1("prefix"));
    }

    QXmlSchema schema2;
    QXmlNamePool np2 = schema2.namePool();

    const QXmlName name2(np2, QLatin1String("remoteName"),
                              QLatin1String("http://example.com/"),
                              QLatin1String("suffix"));

    // make sure that after re-setting the schema, the new namepool is used
    validator.setSchema(schema2);

    {
        QXmlNamePool compNamePool(validator.namePool());
        QCOMPARE(name2.namespaceUri(compNamePool), QString::fromLatin1("http://example.com/"));
        QCOMPARE(name2.localName(compNamePool), QString::fromLatin1("remoteName"));
        QCOMPARE(name2.prefix(compNamePool), QString::fromLatin1("suffix"));
    }
}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:35,代码来源:tst_qxmlschemavalidator.cpp

示例12: startElement

void GeogebraTransformer::startElement( const QXmlName& name )
{
  if( name.localName( m_np ) == "Section" )
  {
    m_nsections++;
    m_sections.push_back( GeogebraSection() );

    // Clear stacks
    m_inputObjectLabels.clear();
    m_outputObjectLabels.clear();
    m_currentArgStack.clear();
    m_objectMap.clear();
    return;
  }

  switch( m_currentState )
  {
  case GeogebraTransformer::ReadingObject:
    if( m_currentObject )
    {
      // We are already building an object
      m_currentState = GeogebraTransformer::ReadingArguments;
      startElement( name );
      return;
    }

    {
      resetDrawerVars();
      const QByteArray nameData = name.localName( m_np ).toLatin1();
      m_currentObject = ObjectTypeFactory::instance()->find( nameData );

      if ( !m_currentObject )
      {
        qWarning() << name.localName( m_np ) << " object not found!";
      }
    }

    break;
  case GeogebraTransformer::ReadingArguments:
    if ( name.localName( m_np ) == QLatin1String( "Double" ) )
    {
      m_currentState = GeogebraTransformer::ReadingDouble;
    }

    break;
  default:
    break;
  }
}
开发者ID:KDE,项目名称:kig,代码行数:49,代码来源:geogebratransformer.cpp

示例13: name

void tst_QSimpleXmlNodeModel::namePool() const
{
    /* Check that the name pool we pass in, is what actually is returned. */
    QXmlNamePool np;
    const QXmlName name(np, QLatin1String("localName"),
                        QLatin1String("http://example.com/XYZ"),
                        QLatin1String("prefix432"));
    TestSimpleNodeModel model(np);
    const QXmlNamePool np2(model.namePool());

    /* If it's a bug, this will more or less crash. */
    QCOMPARE(name.namespaceUri(np2), QString::fromLatin1("http://example.com/XYZ"));
    QCOMPARE(name.localName(np2), QString::fromLatin1("localName"));
    QCOMPARE(name.prefix(np2), QString::fromLatin1("prefix432"));
}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:15,代码来源:tst_qsimplexmlnodemodel.cpp

示例14: node

Item LocalNameFN::evaluateSingleton(const DynamicContext::Ptr &context) const
{
    const Item node(m_operands.first()->evaluateSingleton(context));

    if(node)
    {
        const QXmlName name(node.asNode().name());

        if(name.isNull())
            return CommonValues::EmptyString;
        else
            return AtomicString::fromValue(context->namePool()->stringForLocalName(name.localName()));
    }
    else
        return CommonValues::EmptyString;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:16,代码来源:qnodefns.cpp

示例15: create

ItemType::Ptr QNameTest::create(const ItemType::Ptr &primaryType, const QXmlName qName)
{
    Q_ASSERT(!qName.isNull());
    Q_ASSERT(primaryType);

    return ItemType::Ptr(new QNameTest(primaryType, qName));
}
开发者ID:NikhilNJ,项目名称:screenplay-dx,代码行数:7,代码来源:qqnametest.cpp


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