diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2014-02-28 23:48:24 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-08 00:21:53 +0100 |
commit | be81c5884549c3b97ade6e7b97cf75a076d70424 (patch) | |
tree | 578997ce6e1f63ff6d23a2b163772bab9e15b9aa /src/corelib/tools/qbytearray.h | |
parent | 7625c51ef426b73a8bda5853a4bd2e2d9d3aeb55 (diff) |
Add Objective-C specific type converters to QByteArray
This patch adds the Objective-C NSData/CDataRef converters to
QByteArray
This will replace the current converters offered in QMacExtras
[ChangeLog][QtCore][Objective-C] Added NSData/CDataRef converters for
QByteArray
Change-Id: I7a0f14bee4271798db345f3c5efd26ac671a3ea4
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qbytearray.h')
-rw-r--r-- | src/corelib/tools/qbytearray.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index ae8166db81..b0a6971964 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -65,6 +65,12 @@ #endif +#ifdef Q_OS_MAC +Q_FORWARD_DECLARE_CF_TYPE(CFData); +# ifdef __OBJC__ +Q_FORWARD_DECLARE_OBJC_CLASS(NSData); +# endif +#endif QT_BEGIN_NAMESPACE @@ -354,6 +360,18 @@ public: static QByteArray fromHex(const QByteArray &hexEncoded); static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%'); +#if defined(Q_OS_MAC) || defined(Q_QDOC) + static QByteArray fromCFData(CFDataRef data); + 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; typedef const char *const_iterator; |