forked from qt-creator/qt-creator
Sqlite: Stop using QtCore private macros in Qt Creator
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER is entirely private and may change at any time. More importantly, this macro is not necessary at all. QByteArrayLiteral solves the problem neatly. Change-Id: Ib306f8f647014b399b87ffff13f2c0f38c459ab1 Reviewed-by: Adam Majer <adamm@zombino.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
e863393355
commit
b5d964e62b
@@ -115,27 +115,7 @@ SQLITE_EXPORT QDataStream &operator>>(QDataStream &datastream, Utf8String &text)
|
|||||||
SQLITE_EXPORT QDebug operator<<(QDebug debug, const Utf8String &text);
|
SQLITE_EXPORT QDebug operator<<(QDebug debug, const Utf8String &text);
|
||||||
SQLITE_EXPORT void PrintTo(const Utf8String &text, ::std::ostream* os);
|
SQLITE_EXPORT void PrintTo(const Utf8String &text, ::std::ostream* os);
|
||||||
|
|
||||||
#if defined(Q_COMPILER_LAMBDA)
|
#define Utf8StringLiteral(str) Utf8String::fromByteArray(QByteArrayLiteral(str))
|
||||||
|
|
||||||
# define Utf8StringLiteral(str) \
|
|
||||||
([]() -> Utf8String { \
|
|
||||||
enum { Size = sizeof(str) - 1 }; \
|
|
||||||
static const QStaticByteArrayData<Size> qbytearray_literal = { \
|
|
||||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER(Size), \
|
|
||||||
str }; \
|
|
||||||
QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; \
|
|
||||||
const QByteArray byteArray(holder); \
|
|
||||||
return Utf8String::fromByteArray(byteArray); \
|
|
||||||
}()) \
|
|
||||||
/**/
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef Utf8StringLiteral
|
|
||||||
// no lambdas, not GCC, just return a temporary QByteArray
|
|
||||||
|
|
||||||
# define Utf8StringLiteral(str) Utf8String(str, sizeof(str) - 1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Utf8String)
|
Q_DECLARE_METATYPE(Utf8String)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user