本文整理汇总了C++中QXmlName::localName方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlName::localName方法的具体用法?C++ QXmlName::localName怎么用?C++ QXmlName::localName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlName
的用法示例。
在下文中一共展示了QXmlName::localName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluateSingleton
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;
}
示例2: resetSchemaNamePool
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"));
}
}
示例3: 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;
}
示例4: 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;
}
}
示例5: constCorrectness
/*!
Check that functions have the correct const qualification.
*/
void tst_QXmlName::constCorrectness() const
{
const QXmlName name;
/* isNull() */
QVERIFY(name.isNull());
/* operator==() */
QVERIFY(name == name);
/* operator!=() */
QVERIFY(!(name != name));
QXmlNamePool namePool;
const QXmlName name2(namePool, QLatin1String("localName"), QLatin1String("http://example.com/"), QLatin1String("prefix"));
/* namespaceUri(). */
QCOMPARE(name2.namespaceUri(namePool), QLatin1String("http://example.com/"));
/* localName(). */
QCOMPARE(name2.localName(namePool), QLatin1String("localName"));
/* prefix(). */
QCOMPARE(name2.prefix(namePool), QLatin1String("prefix"));
/* toClarkname(). */
QCOMPARE(name2.toClarkName(namePool), QLatin1String("{http://example.com/}prefix:localName"));
}
示例6: displayName
QString NamePool::displayName(const QXmlName qName) const
{
QReadLocker l(mutableLock());
if(qName.hasNamespace())
{
const QString &p = displayPrefix(qName.namespaceURI());
if(p.isEmpty())
return QLatin1Char('{') + m_namespaces.at(qName.namespaceURI()) + QLatin1Char('}') + toLexical(qName);
else
return p + QLatin1Char(':') + m_localNames.at(qName.localName());
}
else
return m_localNames.at(qName.localName());
}
示例7: attribute
void DirectoryScanner::attribute(const QXmlName &name, const QStringRef &value)
{
QString localName(name.localName(namePool));
if(localName == "name") {
this->name = value.toString();
} else if(localName == "title") {
title = value.toString();
} else if(localName == "type") {
type = value.toString();
fsBaseFinder.setShortcutMode(type == "shortcut");
} else if(localName == "ev") {
fsBaseFinder.setEV(value.toString());
} else if(localName == "path") {
fsBaseFinder.setPath(value.toString());
regBaseFinder.setPath(value.toString());
} else if(localName == "key") {
regBaseFinder.setKey(value.toString());
} else if(localName == "root") {
regBaseFinder.setRoot(value.toString());
} else if(localName == "includepath") {
include << value.toString();
} else if(localName == "excludepath") {
exclude << value.toString();
}
}
示例8: 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();
}
}
示例9: 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();
}
}
示例10: elementById
QXmlNodeModelIndex AccelTree::elementById(const QXmlName &id) const
{
const PreNumber pre = m_IDs.value(id.localName(), -1);
if(pre == -1)
return QXmlNodeModelIndex();
else
return createIndex(pre);
}
示例11: displayName
QString NamePool::displayName(const QXmlName qName) const
{
QReadLocker l(&lock);
if(qName.hasNamespace())
{
if(qName.namespaceURI() == StandardNamespaces::InternalXSLT)
return QLatin1Char('#') + m_localNames.at(qName.localName());
const QString &p = displayPrefix(qName.namespaceURI());
if(p.isEmpty())
return QLatin1Char('{') + m_namespaces.at(qName.namespaceURI()) + QLatin1Char('}') + toLexical(qName);
else
return p + QLatin1Char(':') + m_localNames.at(qName.localName());
}
else
return m_localNames.at(qName.localName());
}
示例12: toClarkName
QString NamePool::toClarkName(const QXmlName &name) const
{
if(name.isNull())
return QLatin1String("QXmlName(null)");
else
{
if(name.hasNamespace())
{
const QString ns(stringForNamespace(name.namespaceURI()));
const QString p(stringForPrefix(name.prefix()));
const QString l(stringForLocalName(name.localName()));
return QChar::fromLatin1('{')
+ ns
+ QChar::fromLatin1('}')
+ (p.isEmpty() ? l : p + QChar::fromLatin1(':') + l);
}
else
return stringForLocalName(name.localName());
}
}
示例13: namePool
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"));
}
示例14: evaluateSingleton
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;
}
示例15: attribute
void FeedEntryListModel::attribute(const QXmlName &name, const QStringRef &value)
{
QString tagName = name.localName(this->namePool);
QString tagValue = value.toString();
if(tagName == "title")
this->current.title = tagValue;
else if(tagName == "summary")
this->current.summary = tagValue;
else if(tagName == "id")
this->current.id = tagValue;
else if(tagName == "read") {
if(tagValue == "true")
this->current.read = true;
else
this->current.read = false;
}
}