summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qbytearray_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qbytearray_mac.mm')
-rw-r--r--src/corelib/tools/qbytearray_mac.mm78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/corelib/tools/qbytearray_mac.mm b/src/corelib/tools/qbytearray_mac.mm
index 9386a966f0..aada473f92 100644
--- a/src/corelib/tools/qbytearray_mac.mm
+++ b/src/corelib/tools/qbytearray_mac.mm
@@ -44,6 +44,13 @@
QT_BEGIN_NAMESPACE
+/*! \fn QByteArray QByteArray::fromCFData(CFDataRef data)
+ \since 5.3
+
+ Constructs a new QByteArray containing a copy of the CFData \a data.
+
+ \sa fromRawCFData(), fromRawData(), toRawCFData(), toCFData()
+*/
QByteArray QByteArray::fromCFData(CFDataRef data)
{
if (!data)
@@ -52,6 +59,18 @@ QByteArray QByteArray::fromCFData(CFDataRef data)
return QByteArray(reinterpret_cast<const char *>(CFDataGetBytePtr(data)), CFDataGetLength(data));
}
+/*! \fn QByteArray QByteArray::fromRawCFData(CFDataRef data)
+ \since 5.3
+
+ Constructs a QByteArray that uses the bytes of the CFData \a data.
+
+ The \a data's bytes are not copied.
+
+ The caller guarantees that the CFData will not be deleted
+ or modified as long as this QByteArray object exists.
+
+ \sa fromCFData(), fromRawData(), toRawCFData(), toCFData()
+*/
QByteArray QByteArray::fromRawCFData(CFDataRef data)
{
if (!data)
@@ -60,17 +79,45 @@ QByteArray QByteArray::fromRawCFData(CFDataRef data)
return QByteArray::fromRawData(reinterpret_cast<const char *>(CFDataGetBytePtr(data)), CFDataGetLength(data));
}
+/*! \fn CFDataRef QByteArray::toCFData() const
+ \since 5.3
+
+ Creates a CFData from a QByteArray. The caller owns the CFData object
+ and is responsible for releasing it.
+
+ \sa toRawCFData(), fromCFData(), fromRawCFData(), fromRawData()
+*/
CFDataRef QByteArray::toCFData() const
{
return CFDataCreate(kCFAllocatorDefault, reinterpret_cast<const UInt8 *>(data()), length());
}
+/*! \fn CFDataRef QByteArray::toRawCFData() const
+ \since 5.3
+
+ Constructs a CFData that uses the bytes of the QByteArray.
+
+ The QByteArray's bytes are not copied.
+
+ The caller guarantees that the QByteArray will not be deleted
+ or modified as long as this CFData object exists.
+
+ \sa toCFData(), fromRawCFData(), fromCFData(), fromRawData()
+*/
+
CFDataRef QByteArray::toRawCFData() const
{
return CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8 *>(data()),
length(), kCFAllocatorNull);
}
+/*! \fn QByteArray QByteArray::fromNSData(const NSData *data)
+ \since 5.3
+
+ Constructs a new QByteArray containing a copy of the NSData \a data.
+
+ \sa fromRawNSData(), fromRawData(), toNSData(), toRawNSData()
+*/
QByteArray QByteArray::fromNSData(const NSData *data)
{
if (!data)
@@ -78,6 +125,18 @@ QByteArray QByteArray::fromNSData(const NSData *data)
return QByteArray(reinterpret_cast<const char *>([data bytes]), [data length]);
}
+/*! \fn QByteArray QByteArray::fromRawNSData(const NSData *data)
+ \since 5.3
+
+ Constructs a QByteArray that uses the bytes of the NSData \a data.
+
+ The \a data's bytes are not copied.
+
+ The caller guarantees that the NSData will not be deleted
+ or modified as long as this QByteArray object exists.
+
+ \sa fromNSData(), fromRawData(), toRawNSData(), toNSData()
+*/
QByteArray QByteArray::fromRawNSData(const NSData *data)
{
if (!data)
@@ -85,11 +144,30 @@ QByteArray QByteArray::fromRawNSData(const NSData *data)
return QByteArray::fromRawData(reinterpret_cast<const char *>([data bytes]), [data length]);
}
+/*! \fn NSData QByteArray::toNSData() const
+ \since 5.3
+
+ Creates a NSData from a QByteArray. The NSData object is autoreleased.
+
+ \sa fromNSData(), fromRawNSData(), fromRawData(), toRawNSData()
+*/
NSData *QByteArray::toNSData() const
{
return [NSData dataWithBytes:constData() length:size()];
}
+/*! \fn NSData QByteArray::toRawNSData() const
+ \since 5.3
+
+ Constructs a NSData that uses the bytes of the QByteArray.
+
+ The QByteArray's bytes are not copied.
+
+ The caller guarantees that the QByteArray will not be deleted
+ or modified as long as this NSData object exists.
+
+ \sa fromRawNSData(), fromNSData(), fromRawData(), toNSData()
+*/
NSData *QByteArray::toRawNSData() const
{
// const_cast is fine here because NSData is immutable thus will never modify bytes we're giving it