本文整理汇总了C++中dynamiccontext::Ptr::resolveURI方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::resolveURI方法的具体用法?C++ Ptr::resolveURI怎么用?C++ Ptr::resolveURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dynamiccontext::Ptr
的用法示例。
在下文中一共展示了Ptr::resolveURI方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluateSingleton
Item UnparsedTextFN::evaluateSingleton(const DynamicContext::Ptr &context) const
{
Q_ASSERT(m_operands.count() == 1 || m_operands.count() == 2);
const Item href(m_operands.first()->evaluateSingleton(context));
if(!href)
return Item();
const QUrl mayRela(AnyURI::toQUrl<ReportContext::XTDE1170>(href.stringValue(),
context,
this));
const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));
if(uri.hasFragment())
{
context->error(QtXmlPatterns::tr("The URI cannot have a fragment"),
ReportContext::XTDE1170, this);
}
QString encoding;
if(m_operands.count() == 2)
{
const Item encodingArg(m_operands.at(1)->evaluateSingleton(context));
if(encodingArg)
encoding = encodingArg.stringValue();
}
Q_ASSERT(uri.isValid() && !uri.isRelative());
return context->resourceLoader()->openUnparsedText(uri, encoding, context, this);
}
示例2: evaluateEBV
bool UnparsedTextAvailableFN::evaluateEBV(const DynamicContext::Ptr &context) const
{
Q_ASSERT(m_operands.count() == 1 || m_operands.count() == 2);
const Item href(m_operands.first()->evaluateSingleton(context));
if(!href)
return Item();
bool isValid = false;
const QUrl mayRela(AnyURI::toQUrl<ReportContext::XTDE1170>(href.stringValue(),
context,
this,
&isValid));
if(!isValid)
return false;
const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));
/* fn:unparsed-text() will raise an error on this. */
if(uri.hasFragment())
return false;
QString encoding;
if(m_operands.count() == 2)
{
const Item encodingArg(m_operands.at(1)->evaluateSingleton(context));
if(encodingArg)
encoding = encodingArg.stringValue();
}
Q_ASSERT(uri.isValid() && !uri.isRelative());
return context->resourceLoader()->isUnparsedTextAvailable(uri, encoding);
}
示例3: evaluateEBV
bool DocAvailableFN::evaluateEBV(const DynamicContext::Ptr &context) const
{
const Item itemURI(m_operands.first()->evaluateSingleton(context));
/* 15.5.4 fn:doc reads: "If $uri is the empty sequence, the result is an empty sequence."
* Hence, we return false for the empty sequence, because this doesn't hold true:
* "If this function returns true, then calling fn:doc($uri) within
* the same execution scope must return a document node."(15.5.5 fn:doc-available) */
if(!itemURI)
return false;
/* These two lines are duplicated in DocFN::evaluateSingleton(), as part
* of a workaround for solaris-cc-64. */
const QUrl mayRela(AnyURI::toQUrl<ReportContext::FODC0005>(itemURI.stringValue(), context, this));
const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));
Q_ASSERT(!uri.isRelative());
return context->resourceLoader()->isDocumentAvailable(uri);
}
示例4: evaluateSingleton
Item DocFN::evaluateSingleton(const DynamicContext::Ptr &context) const
{
const Item itemURI(m_operands.first()->evaluateSingleton(context));
if(!itemURI)
return Item();
/* These two lines were previously in a separate function but are now duplicated
* in DocAvailableFN::evaluateEBV() and DocFN::typeCheck(),
* as part of a workaround for solaris-cc-64. DocFN::typeCheck() is in qsequencefns.cpp
* as part of that workaround. */
const QUrl mayRela(AnyURI::toQUrl<ReportContext::FODC0005>(itemURI.stringValue(), context, this));
const QUrl uri(context->resolveURI(mayRela, staticBaseURI()));
Q_ASSERT(uri.isValid());
Q_ASSERT(!uri.isRelative());
const Item doc(context->resourceLoader()->openDocument(uri, context));
return doc;
}