本文整理汇总了C++中QXmlNodeModelIndex::stringValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlNodeModelIndex::stringValue方法的具体用法?C++ QXmlNodeModelIndex::stringValue怎么用?C++ QXmlNodeModelIndex::stringValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlNodeModelIndex
的用法示例。
在下文中一共展示了QXmlNodeModelIndex::stringValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendAsNode
/*!
\internal
Treats \a outputItem as a node and calls the appropriate function,
e.g., attribute() or comment(), depending on its
QXmlNodeModelIndex::NodeKind.
This is a helper function that subclasses can use to multiplex
Nodes received via item().
*/
void QAbstractXmlReceiver::sendAsNode(const QPatternist::Item &outputItem)
{
Q_ASSERT(outputItem);
Q_ASSERT(outputItem.isNode());
const QXmlNodeModelIndex asNode = outputItem.asNode();
switch(asNode.kind())
{
case QXmlNodeModelIndex::Attribute:
{
const QString &v = outputItem.stringValue();
attribute(asNode.name(), QStringRef(&v));
return;
}
case QXmlNodeModelIndex::Element:
{
startElement(asNode.name());
/* First the namespaces, then attributes, then the children. */
asNode.sendNamespaces(this);
sendFromAxis<QXmlNodeModelIndex::AxisAttribute>(asNode);
sendFromAxis<QXmlNodeModelIndex::AxisChild>(asNode);
endElement();
return;
}
case QXmlNodeModelIndex::Text:
{
const QString &v = asNode.stringValue();
characters(QStringRef(&v));
return;
}
case QXmlNodeModelIndex::ProcessingInstruction:
{
processingInstruction(asNode.name(), outputItem.stringValue());
return;
}
case QXmlNodeModelIndex::Comment:
{
comment(outputItem.stringValue());
return;
}
case QXmlNodeModelIndex::Document:
{
startDocument();
sendFromAxis<QXmlNodeModelIndex::AxisChild>(asNode);
endDocument();
return;
}
case QXmlNodeModelIndex::Namespace:
Q_ASSERT_X(false, Q_FUNC_INFO, "Not implemented");
}
Q_ASSERT_X(false, Q_FUNC_INFO,
QString::fromLatin1("Unknown node type: %1").arg(asNode.kind()).toUtf8().constData());
}
示例2: attribute
QHash<QXmlName, QString> PullBridge::attributes()
{
Q_ASSERT(m_current == StartElement);
QHash<QXmlName, QString> attributes;
QXmlNodeModelIndex::Iterator::Ptr it = m_index.iterate(QXmlNodeModelIndex::AxisAttribute);
QXmlNodeModelIndex index = it->next();
while (!index.isNull()) {
const Item attribute(index);
attributes.insert(index.name(), index.stringValue());
index = it->next();
}
return attributes;
}