本文整理汇总了C++中qpatternist::AutoPtr::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoPtr::reset方法的具体用法?C++ AutoPtr::reset怎么用?C++ AutoPtr::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qpatternist::AutoPtr
的用法示例。
在下文中一共展示了AutoPtr::reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setQuery
/*!
Sets this QXmlQuery to the XQuery read from the \a queryURI. Use
isValid() after calling this function. If an error occurred reading
\a queryURI, e.g., the query does not exist, cannot be read, or is
invalid, isValid() will return \e false.
The supported URI schemes are the same as those in the XQuery
function \c{fn:doc}, except that queryURI can be the object of
a variable binding.
\a baseURI is the Base URI of the static context, as defined in the
\l {http://www.w3.org/TR/xquery/}{XQuery language}. It is used
internally to resolve relative URIs that appear in the query, and
for message reporting. If \a baseURI is empty, \a queryURI is used.
Otherwise, \a baseURI is used, and it is resolved against the \l
{QCoreApplication::applicationFilePath()} {application file path} if
it is relative.
If \a queryURI is empty or invalid, or if \a baseURI is invalid,
the behavior of this function is undefined.
*/
void QXmlQuery::setQuery(const QUrl &queryURI, const QUrl &baseURI)
{
Q_ASSERT_X(queryURI.isValid(), Q_FUNC_INFO, "The passed URI must be valid.");
const QUrl canonicalURI(QPatternist::XPathHelper::normalizeQueryURI(queryURI));
Q_ASSERT(canonicalURI.isValid());
Q_ASSERT(!canonicalURI.isRelative());
Q_ASSERT(baseURI.isValid() || baseURI.isEmpty());
d->queryURI = QPatternist::XPathHelper::normalizeQueryURI(baseURI.isEmpty() ? queryURI : baseURI);
QPatternist::AutoPtr<QIODevice> result;
try
{
result.reset(QPatternist::AccelTreeResourceLoader::load(canonicalURI, d->m_networkAccessDelegator,
d->staticContext()));
}
catch(const QPatternist::Exception)
{
/* We do nothing, result will be 0. */
}
if(result)
{
setQuery(result.data(), d->queryURI);
result->close();
}
else
d->recompileRequired();
}