summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlpatterns/utils')
-rw-r--r--src/xmlpatterns/utils/qpatternistlocale_p.h13
-rw-r--r--src/xmlpatterns/utils/qxpathhelper.cpp12
-rw-r--r--src/xmlpatterns/utils/qxpathhelper_p.h5
3 files changed, 29 insertions, 1 deletions
diff --git a/src/xmlpatterns/utils/qpatternistlocale_p.h b/src/xmlpatterns/utils/qpatternistlocale_p.h
index 5dcd917..d8288c7 100644
--- a/src/xmlpatterns/utils/qpatternistlocale_p.h
+++ b/src/xmlpatterns/utils/qpatternistlocale_p.h
@@ -93,7 +93,8 @@ namespace QPatternist
Q_DISABLE_COPY(QtXmlPatterns)
};
- static inline QString formatKeyword(const QString &keyword)
+ // don't make this function static, otherwise xlC 7 cannot find it
+ inline QString formatKeyword(const QString &keyword)
{
return QLatin1String("<span class='XQuery-keyword'>") +
escape(keyword) +
@@ -168,6 +169,16 @@ namespace QPatternist
}
/**
+ * @short Formats name of any type.
+ */
+ static inline QString formatType(const NamePool::Ptr &np, const QXmlName &name)
+ {
+ return QLatin1String("<span class='XQuery-type'>") +
+ escape(np->displayName(name)) +
+ QLatin1String("</span>");
+ }
+
+ /**
* @short Formats Cardinality.
*/
static inline QString formatType(const Cardinality &type)
diff --git a/src/xmlpatterns/utils/qxpathhelper.cpp b/src/xmlpatterns/utils/qxpathhelper.cpp
index 377d097..69f5494 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 8b7dc6e..4a37bb6 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.
*