darwin: Simplify conversion function declarations in headers

We don't need to include Q_QDOC in the forward-declarations of the native
types, and Q_FORWARD_DECLARE_OBJC_CLASS works in non-Objective-C mode as
well, which means we can declare the Objective-C versions of the functions
without guards.

Change-Id: I32089c496b4f7ce47f0388ba3f65e0b091d1e9ee
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
bb10
Tor Arne Vestbø 2016-05-02 18:45:59 +02:00
parent 5a76a3fb03
commit 597df79c27
5 changed files with 5 additions and 25 deletions

View File

@ -48,11 +48,9 @@
#include <QtCore/qpair.h>
#include <QtCore/qglobal.h>
#if defined(Q_OS_MAC) || defined(Q_QDOC)
#if defined(Q_OS_MAC)
Q_FORWARD_DECLARE_CF_TYPE(CFURL);
# if defined(__OBJC__) || defined(Q_QDOC)
Q_FORWARD_DECLARE_OBJC_CLASS(NSURL);
# endif
#endif
QT_BEGIN_NAMESPACE
@ -280,10 +278,8 @@ public:
#if defined(Q_OS_MAC) || defined(Q_QDOC)
static QUrl fromCFURL(CFURLRef url);
CFURLRef toCFURL() const Q_DECL_CF_RETURNS_RETAINED;
# if defined(__OBJC__) || defined(Q_QDOC)
static QUrl fromNSURL(const NSURL *url);
NSURL *toNSURL() const Q_DECL_NS_RETURNS_AUTORELEASED;
# endif
#endif
#if QT_DEPRECATED_SINCE(5,0)

View File

@ -55,11 +55,9 @@ typedef struct _GUID
#endif
#endif
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
#if defined(Q_OS_DARWIN)
Q_FORWARD_DECLARE_CF_TYPE(CFUUID);
# if defined(__OBJC__) || defined(Q_QDOC)
Q_FORWARD_DECLARE_OBJC_CLASS(NSUUID);
# endif
#endif
QT_BEGIN_NAMESPACE
@ -210,10 +208,8 @@ public:
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
static QUuid fromCFUUID(CFUUIDRef uuid);
CFUUIDRef toCFUUID() const Q_DECL_CF_RETURNS_RETAINED;
# if defined(__OBJC__) || defined(Q_QDOC)
static QUuid fromNSUUID(const NSUUID *uuid);
NSUUID *toNSUUID() const Q_DECL_NS_RETURNS_AUTORELEASED;
# endif
#endif
uint data1;

View File

@ -56,11 +56,9 @@
#error qbytearray.h must be included before any header file that defines truncate
#endif
#if defined(Q_OS_MAC) || defined(Q_QDOC)
#if defined(Q_OS_MAC)
Q_FORWARD_DECLARE_CF_TYPE(CFData);
# if defined(__OBJC__) || defined(Q_QDOC)
Q_FORWARD_DECLARE_OBJC_CLASS(NSData);
# endif
#endif
QT_BEGIN_NAMESPACE
@ -389,12 +387,10 @@ public:
static QByteArray fromRawCFData(CFDataRef data);
CFDataRef toCFData() const Q_DECL_CF_RETURNS_RETAINED;
CFDataRef toRawCFData() const Q_DECL_CF_RETURNS_RETAINED;
# if defined(__OBJC__) || defined(Q_QDOC)
static QByteArray fromNSData(const NSData *data);
static QByteArray fromRawNSData(const NSData *data);
NSData *toNSData() const Q_DECL_NS_RETURNS_AUTORELEASED;
NSData *toRawNSData() const Q_DECL_NS_RETURNS_AUTORELEASED;
# endif
#endif
typedef char *iterator;

View File

@ -46,11 +46,9 @@
#include <limits>
#if defined(Q_OS_MAC) || defined(Q_QDOC)
#if defined(Q_OS_MAC)
Q_FORWARD_DECLARE_CF_TYPE(CFDate);
# if defined(__OBJC__) || defined(Q_QDOC)
Q_FORWARD_DECLARE_OBJC_CLASS(NSDate);
# endif
#endif
QT_BEGIN_NAMESPACE
@ -316,10 +314,8 @@ public:
#if defined(Q_OS_MAC) || defined(Q_QDOC)
static QDateTime fromCFDate(CFDateRef date);
CFDateRef toCFDate() const Q_DECL_CF_RETURNS_RETAINED;
# if defined(__OBJC__) || defined(Q_QDOC)
static QDateTime fromNSDate(const NSDate *date);
NSDate *toNSDate() const Q_DECL_NS_RETURNS_AUTORELEASED;
# endif
#endif
private:

View File

@ -68,11 +68,9 @@ namespace std
#error qstring.h must be included before any header file that defines truncate
#endif
#if defined(Q_OS_MAC) || defined(Q_QDOC)
#if defined(Q_OS_MAC)
Q_FORWARD_DECLARE_CF_TYPE(CFString);
# if defined(__OBJC__) || defined(Q_QDOC)
Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
# endif
#endif
QT_BEGIN_NAMESPACE
@ -783,10 +781,8 @@ public:
#if defined(Q_OS_MAC) || defined(Q_QDOC)
static QString fromCFString(CFStringRef string);
CFStringRef toCFString() const Q_DECL_CF_RETURNS_RETAINED;
# if defined(__OBJC__) || defined(Q_QDOC)
static QString fromNSString(const NSString *string);
NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED;
# endif
#endif
// compatibility
struct Null { };