From 224db5e6eb07154ba2e974a96ee617bf7d740134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 2 May 2016 19:01:55 +0200 Subject: darwin: Move conversion function documentation to function definition It's easier to maintain the function and the docs when they live together. Change-Id: I1e047b4ac1eb61a36849188da560dd899e05509f Reviewed-by: Jake Petroules --- src/corelib/tools/qbytearray.cpp | 85 ------------------------------------- src/corelib/tools/qbytearray_mac.mm | 78 ++++++++++++++++++++++++++++++++++ src/corelib/tools/qdatetime.cpp | 33 -------------- src/corelib/tools/qdatetime_mac.mm | 29 +++++++++++++ src/corelib/tools/qstring.cpp | 34 --------------- src/corelib/tools/qstring_mac.mm | 29 +++++++++++++ 6 files changed, 136 insertions(+), 152 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 2efe3c1a86..a256b44b1f 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -4375,91 +4375,6 @@ QByteArray QByteArray::fromPercentEncoding(const QByteArray &input, char percent \sa fromStdString(), QString::toStdString() */ -/*! \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() -*/ - -/*! \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() -*/ - -/*! \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() -*/ - -/*! \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() -*/ - -/*! \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() -*/ - -/*! \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() -*/ - -/*! \fn NSData QByteArray::toNSData() const - \since 5.3 - - Creates a NSData from a QByteArray. The NSData object is autoreleased. - - \sa fromNSData(), fromRawNSData(), fromRawData(), toRawNSData() -*/ - -/*! \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() -*/ - static inline bool q_strchr(const char str[], char chr) { if (!str) return false; 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(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(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(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(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([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([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 diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 9aba68eef3..5dbf68fc81 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -4089,39 +4089,6 @@ qint64 QDateTime::currentMSecsSinceEpoch() Q_DECL_NOTHROW #error "What system is this?" #endif -/*! \fn QDateTime QDateTime::fromCFDate(CFDateRef date) - \since 5.5 - - Constructs a new QDateTime containing a copy of the CFDate \a date. - - \sa toCFDate() -*/ - -/*! \fn CFDateRef QDateTime::toCFDate() const - \since 5.5 - - Creates a CFDate from a QDateTime. The caller owns the CFDate object - and is responsible for releasing it. - - \sa fromCFDate() -*/ - -/*! \fn QDateTime QDateTime::fromNSDate(const NSDate *date) - \since 5.5 - - Constructs a new QDateTime containing a copy of the NSDate \a date. - - \sa toNSDate() -*/ - -/*! \fn NSDate QDateTime::toNSDate() const - \since 5.5 - - Creates an NSDate from a QDateTime. The NSDate object is autoreleased. - - \sa fromNSDate() -*/ - /*! \since 4.2 diff --git a/src/corelib/tools/qdatetime_mac.mm b/src/corelib/tools/qdatetime_mac.mm index d61ea28636..c03c57d9f1 100644 --- a/src/corelib/tools/qdatetime_mac.mm +++ b/src/corelib/tools/qdatetime_mac.mm @@ -44,6 +44,13 @@ QT_BEGIN_NAMESPACE +/*! \fn QDateTime QDateTime::fromCFDate(CFDateRef date) + \since 5.5 + + Constructs a new QDateTime containing a copy of the CFDate \a date. + + \sa toCFDate() +*/ QDateTime QDateTime::fromCFDate(CFDateRef date) { if (!date) @@ -52,12 +59,27 @@ QDateTime QDateTime::fromCFDate(CFDateRef date) + kCFAbsoluteTimeIntervalSince1970) * 1000)); } +/*! \fn CFDateRef QDateTime::toCFDate() const + \since 5.5 + + Creates a CFDate from a QDateTime. The caller owns the CFDate object + and is responsible for releasing it. + + \sa fromCFDate() +*/ CFDateRef QDateTime::toCFDate() const { return CFDateCreate(kCFAllocatorDefault, (static_cast(toMSecsSinceEpoch()) / 1000) - kCFAbsoluteTimeIntervalSince1970); } +/*! \fn QDateTime QDateTime::fromNSDate(const NSDate *date) + \since 5.5 + + Constructs a new QDateTime containing a copy of the NSDate \a date. + + \sa toNSDate() +*/ QDateTime QDateTime::fromNSDate(const NSDate *date) { if (!date) @@ -65,6 +87,13 @@ QDateTime QDateTime::fromNSDate(const NSDate *date) return QDateTime::fromMSecsSinceEpoch(static_cast([date timeIntervalSince1970] * 1000)); } +/*! \fn NSDate QDateTime::toNSDate() const + \since 5.5 + + Creates an NSDate from a QDateTime. The NSDate object is autoreleased. + + \sa fromNSDate() +*/ NSDate *QDateTime::toNSDate() const { return [NSDate diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index accdb83608..92d187c3ec 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -7938,40 +7938,6 @@ QString QString::multiArg(int numArgs, const QString **args) const return result; } - -/*! \fn QString QString::fromCFString(CFStringRef string) - \since 5.2 - - Constructs a new QString containing a copy of the \a string CFString. - - \note this function is only available on OS X and iOS. -*/ - -/*! \fn CFStringRef QString::toCFString() const - \since 5.2 - - Creates a CFString from a QString. The caller owns the CFString and is - responsible for releasing it. - - \note this function is only available on OS X and iOS. -*/ - -/*! \fn QString QString::fromNSString(const NSString *string) - \since 5.2 - - Constructs a new QString containing a copy of the \a string NSString. - - \note this function is only available on OS X and iOS. -*/ - -/*! \fn NSString QString::toNSString() const - \since 5.2 - - Creates a NSString from a QString. The NSString is autoreleased. - - \note this function is only available on OS X and iOS. -*/ - /*! \fn bool QString::isSimpleText() const \internal diff --git a/src/corelib/tools/qstring_mac.mm b/src/corelib/tools/qstring_mac.mm index 7b3d6b53c0..81cbb91e6c 100644 --- a/src/corelib/tools/qstring_mac.mm +++ b/src/corelib/tools/qstring_mac.mm @@ -43,6 +43,13 @@ QT_BEGIN_NAMESPACE +/*! \fn QString QString::fromCFString(CFStringRef string) + \since 5.2 + + Constructs a new QString containing a copy of the \a string CFString. + + \note this function is only available on OS X and iOS. +*/ QString QString::fromCFString(CFStringRef string) { if (!string) @@ -60,11 +67,26 @@ QString QString::fromCFString(CFStringRef string) return ret; } +/*! \fn CFStringRef QString::toCFString() const + \since 5.2 + + Creates a CFString from a QString. The caller owns the CFString and is + responsible for releasing it. + + \note this function is only available on OS X and iOS. +*/ CFStringRef QString::toCFString() const { return CFStringCreateWithCharacters(0, reinterpret_cast(unicode()), length()); } +/*! \fn QString QString::fromNSString(const NSString *string) + \since 5.2 + + Constructs a new QString containing a copy of the \a string NSString. + + \note this function is only available on OS X and iOS. +*/ QString QString::fromNSString(const NSString *string) { if (!string) @@ -75,6 +97,13 @@ QString QString::fromNSString(const NSString *string) return qstring; } +/*! \fn NSString QString::toNSString() const + \since 5.2 + + Creates a NSString from a QString. The NSString is autoreleased. + + \note this function is only available on OS X and iOS. +*/ NSString *QString::toNSString() const { return [NSString stringWithCharacters: reinterpret_cast(unicode()) length: length()]; -- cgit v1.2.3