summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns/utils
diff options
context:
space:
mode:
authorTobias Koenig <tokoe@kde.org>2009-05-16 10:30:25 (GMT)
committerTobias Koenig <tokoe@kde.org>2009-05-16 10:30:25 (GMT)
commit456463169c6d00b9938f0d975dbd7f398edea39d (patch)
tree13c1b245cffa15828ef1b12ac24c271c301221f2 /src/xmlpatterns/utils
parent135a028d9dc9a28a0a072665a7dc43b7e9e187be (diff)
downloadQt-456463169c6d00b9938f0d975dbd7f398edea39d.zip
Qt-456463169c6d00b9938f0d975dbd7f398edea39d.tar.gz
Qt-456463169c6d00b9938f0d975dbd7f398edea39d.tar.bz2
Various api, documentation and code cleanups
Diffstat (limited to 'src/xmlpatterns/utils')
-rw-r--r--src/xmlpatterns/utils/qxpathhelper.cpp12
-rw-r--r--src/xmlpatterns/utils/qxpathhelper_p.h5
2 files changed, 17 insertions, 0 deletions
diff --git a/src/xmlpatterns/utils/qxpathhelper.cpp b/src/xmlpatterns/utils/qxpathhelper.cpp
index 127e21f..5b32906 100644
--- a/src/xmlpatterns/utils/qxpathhelper.cpp
+++ b/src/xmlpatterns/utils/qxpathhelper.cpp
@@ -125,4 +125,16 @@ ItemType::Ptr XPathHelper::typeFromKind(const QXmlNodeModelIndex::NodeKind nodeK
}
}
+QUrl XPathHelper::normalizeQueryURI(const QUrl &uri)
+{
+ Q_ASSERT_X(uri.isEmpty() || uri.isValid(), Q_FUNC_INFO,
+ "The URI passed to QXmlQuery::setQuery() must be valid or empty.");
+ if(uri.isEmpty())
+ return QUrl::fromLocalFile(QCoreApplication::applicationFilePath());
+ else if(uri.isRelative())
+ return QUrl::fromLocalFile(QCoreApplication::applicationFilePath()).resolved(uri);
+ else
+ return uri;
+}
+
QT_END_NAMESPACE
diff --git a/src/xmlpatterns/utils/qxpathhelper_p.h b/src/xmlpatterns/utils/qxpathhelper_p.h
index 7bf33e6..e36b8cb 100644
--- a/src/xmlpatterns/utils/qxpathhelper_p.h
+++ b/src/xmlpatterns/utils/qxpathhelper_p.h
@@ -128,6 +128,11 @@ namespace QPatternist
static QPatternist::ItemTypePtr typeFromKind(const QXmlNodeModelIndex::NodeKind nodeKind);
/**
+ * Normalizes an @p uri by resolving it to the application directory if empty.
+ */
+ static QUrl normalizeQueryURI(const QUrl &uri);
+
+ /**
* @short Determines whether @p consists only of whitespace. Characters
* considered whitespace are the ones for which QChar::isSpace() returns @c true for.
*