summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qurl.h
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2013-09-02 10:12:07 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-21 05:09:41 +0200
commit2b65bba77d4705d49a01a25350de64d153808504 (patch)
tree02de52c8dc6be51af70221beed24a1819cc0dd62 /src/corelib/io/qurl.h
parentdd7bfffa77c231296ca977d6c7d487962f7ebae9 (diff)
Add Mac type conversion functions to QtCore
New API: static QString QString::fromCFString(CFStringRef string); CFStringRef QString::toCFString() const; static QString QString::fromNSString(const NSString *string); NSString *QString::toNSString() const; static QUrl QUrl::fromCFURL(CFURLRef url); CFURLRef QUrl::toCFURL() const; static QUrl QUrl::fromNSURL(const NSURL *url); NSURL * QUrl::toNSURL() const; Add Q_OS_MAC-protected function declarations to header files, add implementation to _mm files. CF and NS types are forward-declared in the header files to avoid including the CoreFoundation and Foundation headers. This prevents accidental use of native types in application code. Add helper macros for forward- declaration to qglobal.h Add cf_returns_retained/ns_returns_autoreleased attributes to toCFString() and toNSURL(). These attributes assists the clang static analyzer. Add Q_DECL_ helper macros to qcompilerdetection.h. Add test functions (in _mac.mm files) to the QString and QUrl tests. Split out the test class declarations into a separate headers files. Change-Id: I60fd5e93f042316196284c3db0595835fe8c4ad4 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/corelib/io/qurl.h')
-rw-r--r--src/corelib/io/qurl.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index abb7df0056..e7edb4365e 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -50,6 +50,11 @@
#include <QtCore/qpair.h>
#include <QtCore/qglobal.h>
+#ifdef Q_OS_MAC
+Q_FORWARD_DECLARE_OBJC_CLASS(NSURL);
+Q_FORWARD_DECLARE_CF_TYPE(CFURL);
+#endif
+
QT_BEGIN_NAMESPACE
@@ -257,6 +262,13 @@ public:
static QByteArray toPercentEncoding(const QString &,
const QByteArray &exclude = QByteArray(),
const QByteArray &include = QByteArray());
+#if defined(Q_OS_MAC) || defined(Q_QDOC)
+ static QUrl fromCFURL(CFURLRef url);
+ CFURLRef toCFURL() const Q_DECL_CF_RETURNS_RETAINED;
+ static QUrl fromNSURL(const NSURL *url);
+ NSURL *toNSURL() const Q_DECL_NS_RETURNS_AUTORELEASED;
+#endif
+
#if QT_DEPRECATED_SINCE(5,0)
QT_DEPRECATED static QString fromPunycode(const QByteArray &punycode)
{ return fromAce(punycode); }