本文整理汇总了C++中QXmlNodeModelIndex::baseUri方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlNodeModelIndex::baseUri方法的具体用法?C++ QXmlNodeModelIndex::baseUri怎么用?C++ QXmlNodeModelIndex::baseUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlNodeModelIndex
的用法示例。
在下文中一共展示了QXmlNodeModelIndex::baseUri方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: baseUri
QUrl AccelTree::baseUri(const QXmlNodeModelIndex &ni) const
{
switch(kind(toPreNumber(ni)))
{
case QXmlNodeModelIndex::Document:
return baseUri();
case QXmlNodeModelIndex::Element:
{
const QXmlNodeModelIndex::Iterator::Ptr it(iterate(ni, QXmlNodeModelIndex::AxisAttribute));
QXmlNodeModelIndex next(it->next());
while(!next.isNull())
{
if(next.name() == QXmlName(StandardNamespaces::xml, StandardLocalNames::base))
{
const QUrl candidate(next.stringValue());
// TODO. The xml:base spec says to do URI escaping here.
if(!candidate.isValid())
return QUrl();
else if(candidate.isRelative())
{
const QXmlNodeModelIndex par(parent(ni));
if(par.isNull())
return baseUri().resolved(candidate);
else
return par.baseUri().resolved(candidate);
}
else
return candidate;
}
next = it->next();
}
/* We have no xml:base-attribute. Can any parent supply us a base URI? */
const QXmlNodeModelIndex par(parent(ni));
if(par.isNull())
return baseUri();
else
return par.baseUri();
}
case QXmlNodeModelIndex::ProcessingInstruction:
/* Fallthrough. */
case QXmlNodeModelIndex::Comment:
/* Fallthrough. */
case QXmlNodeModelIndex::Attribute:
/* Fallthrough. */
case QXmlNodeModelIndex::Text:
{
const QXmlNodeModelIndex par(ni.iterate(QXmlNodeModelIndex::AxisParent)->next());
if(par.isNull())
return QUrl();
else
return par.baseUri();
}
case QXmlNodeModelIndex::Namespace:
return QUrl();
}
Q_ASSERT_X(false, Q_FUNC_INFO, "This line is never supposed to be reached.");
return QUrl();
}