本文整理汇总了C++中QXmlName::toClarkName方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlName::toClarkName方法的具体用法?C++ QXmlName::toClarkName怎么用?C++ QXmlName::toClarkName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlName
的用法示例。
在下文中一共展示了QXmlName::toClarkName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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"));
}
示例2: argumentConstructorDefaultArguments
/*!
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"));
}
示例3: toClarkName_data
void tst_QXmlName::toClarkName_data() const
{
QTest::addColumn<QString>("produced");
QTest::addColumn<QString>("expected");
QXmlNamePool np;
/* A null QXmlName. */
{
const QXmlName n;
QTest::newRow("") << n.toClarkName(np)
<< QString::fromLatin1("QXmlName(null)");
}
{
const QXmlName n(np, QLatin1String("localName"));
QTest::newRow("") << n.toClarkName(np)
<< QString::fromLatin1("localName");
}
/* Local name with namespace URI, empty prefix. */
{
const QXmlName n(np, QLatin1String("localName"),
QLatin1String("http://example.com/"));
QTest::newRow("") << n.toClarkName(np)
<< QString::fromLatin1("{http://example.com/}localName");
}
/* Local name with namespace URI and prefix. */
{
const QXmlName n(np, QLatin1String("localName"),
QLatin1String("http://example.com/"),
QLatin1String("p"));
QTest::newRow("") << n.toClarkName(np)
<< QString::fromLatin1("{http://example.com/}p:localName");
}
}
示例4: operatorEqual_data
void tst_QXmlName::operatorEqual_data() const
{
QTest::addColumn<QXmlName>("op1");
QTest::addColumn<QXmlName>("op2");
QTest::addColumn<bool>("expected");
QXmlNamePool namePool;
const QXmlName n1(namePool, QString::fromLatin1("localName1"),
QString::fromLatin1("http://example.com/Namespace1"),
QString::fromLatin1("prefix1"));
const QXmlName n2(namePool, QString::fromLatin1("localName2"),
QString::fromLatin1("http://example.com/Namespace1"),
QString::fromLatin1("prefix1"));
const QXmlName n3(namePool, QString::fromLatin1("localName2"),
QString::fromLatin1("http://example.com/Namespace1"),
QString::fromLatin1("prefix2"));
const QXmlName n4(namePool, QString::fromLatin1("localName3"),
QString::fromLatin1("http://example.com/Namespace2"));
const QXmlName n5(namePool, QString::fromLatin1("localName4"),
QString::fromLatin1("http://example.com/Namespace2"));
const QXmlName n6(namePool, QString::fromLatin1("localName4"),
QString::fromLatin1("http://example.com/Namespace2"),
QString::fromLatin1("prefix3"));
const QXmlName n7(namePool, QString::fromLatin1("localName2"),
QString::fromLatin1("http://example.com/Namespace2"),
QString::fromLatin1("prefix3"));
QTest::newRow(qPrintable(n1.toClarkName(namePool)))
<< n1
<< n1
<< true;
QTest::newRow(qPrintable(n2.toClarkName(namePool)))
<< n2
<< n2
<< true;
QTest::newRow(qPrintable(n3.toClarkName(namePool)))
<< n3
<< n3
<< true;
QTest::newRow(qPrintable(n4.toClarkName(namePool)))
<< n4
<< n4
<< true;
QTest::newRow(qPrintable(n5.toClarkName(namePool)))
<< n5
<< n5
<< true;
QTest::newRow(qPrintable(n6.toClarkName(namePool)))
<< n6
<< n6
<< true;
QTest::newRow(qPrintable(n7.toClarkName(namePool)))
<< n7
<< n7
<< true;
QTest::newRow("Prefix differs")
<< n2
<< n3
<< true;
QTest::newRow("No prefix vs. prefix")
<< n5
<< n6
<< true;
QTest::newRow("Local name differs")
<< n1
<< n2
<< false;
QTest::newRow("Namespace differs")
<< n2
<< n7
<< false;
}