diff options
author | Jake Petroules <jake.petroules@petroules.com> | 2014-09-26 05:32:30 -0400 |
---|---|---|
committer | Jake Petroules <jake.petroules@petroules.com> | 2014-10-07 18:54:21 +0200 |
commit | 1cc079c29b68d08b5c83c5a323fb0512cb7bb0db (patch) | |
tree | 32939c10c820175d57e17e4b3b8ab0819d8cf976 /src/corelib/tools/qdatetime.h | |
parent | 10e3ce9e169d9c38c9cfd15a8729fa091694bf60 (diff) |
Add Objective-C specific type converters to QDateTime
This patch adds the Objective-C NSDate/CDateRef converters to
QDateTime
[ChangeLog][QtCore][Objective-C] Added NSDate/CDateRef converters for
QDateTime
Task-number: QTBUG-37116
Change-Id: I937ea927083a2767b5b17f10a48bf453c9ff8b01
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/corelib/tools/qdatetime.h')
-rw-r--r-- | src/corelib/tools/qdatetime.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 597655f557..4ef94f72d7 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -40,6 +40,13 @@ #include <limits> +#ifdef Q_OS_MAC +Q_FORWARD_DECLARE_CF_TYPE(CFDate); +# ifdef __OBJC__ +Q_FORWARD_DECLARE_OBJC_CLASS(NSDate); +# endif +#endif + QT_BEGIN_NAMESPACE class QTimeZone; @@ -295,6 +302,15 @@ public: #endif static qint64 currentMSecsSinceEpoch() Q_DECL_NOTHROW; +#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: friend class QDateTimePrivate; void detach(); |