QList<QByteArray> and QList<QVariant> conversion & use cxx:operator== and qt:operator== in cxx:=
Annotate for file src/lib/qlist.h
2010-01-10 tobias 1 #ifndef CL_SMOKE_QT_QLIST_H
08:52:49 ' 2 #define CL_SMOKE_QT_QLIST_H
' 3
' 4 #include <QList>
' 5 #include "cl_smoke_qt.h"
' 6
' 7 /** @file
' 8 */
' 9
' 10 /** Defines a C wrapper for the QList<@a TYPE>.
' 11 * @param TYPE the type of the elements of the QList
' 12 */
' 13 #define DEFINE_QLIST_WRAPPER(TYPE) \
' 14 DEFINE_QLIST_WRAPPER_3(TYPE, TYPE, VALUE)
' 15
' 16 /** Defines a C wrapper for the QList<@a TYPE*>,
' 17 * where @a TYPE is the of the pointer.
' 18 *
' 19 * @param NAME the name used for the wrapper functions.
' 20 * @param TYPE the type of the elements
' 21 */
' 22 #define DEFINE_QLIST_WRAPPER_PTR(TYPE) \
' 23 DEFINE_QLIST_WRAPPER_3(TYPE, TYPE*, PTR)
' 24
' 25 /** @internal */
' 26 #define DEFINE_QLIST_WRAPPER_3(NAME, TYPE, PTR_VALUE) \
' 27 DEFINE_QLIST_WRAPPER_ALL_PART(NAME, TYPE) \
' 28 DEFINE_QLIST_WRAPPER_ ## PTR_VALUE ## _PART(NAME, TYPE) \
' 29
' 30
' 31 /** @internal
' 32 * size, free and make_list. */
' 33 #define DEFINE_QLIST_WRAPPER_ALL_PART(NAME, TYPE) \
' 34 CL_SMOKE_QT_EXPORT int \
2009-05-27 tobias 35 qt_smoke_list_ ## NAME ## _size(const void* list) \
2010-01-10 tobias 36 { \
08:52:49 ' 37 return static_cast<const QList< TYPE >*>(list)->size(); \
' 38 } \
' 39 \
' 40 CL_SMOKE_QT_EXPORT void \
' 41 qt_smoke_free_list_ ## NAME (void* list) \
' 42 { \
' 43 delete static_cast<QList< TYPE >*>(list); \
' 44 } \
' 45 \
' 46 CL_SMOKE_QT_EXPORT void* \
' 47 qt_smoke_make_list_ ## NAME () \
' 48 { \
' 49 return new QList< TYPE >(); \
' 50 } \
' 51 \
' 52
' 53 /** @internal
' 54 * At and append for pointer types
' 55 */
' 56 #define DEFINE_QLIST_WRAPPER_PTR_PART(NAME, TYPE) \
' 57 CL_SMOKE_QT_EXPORT const void* \
' 58 qt_smoke_list_ ## NAME ## _at(const void* list, int index) \
' 59 { \
' 60 const QList< TYPE >* qlist = static_cast<const QList< TYPE > *>(list); \
' 61 return qlist->at(index); \
' 62 } \
' 63 \
' 64 CL_SMOKE_QT_EXPORT void \
2009-05-27 tobias 65 qt_smoke_list_ ## NAME ## _append(void* list, void* data) \
2010-01-10 tobias 66 { \
08:52:49 ' 67 static_cast<QList< TYPE >*>(list) \
' 68 ->append(static_cast<TYPE>(data)); \
' 69 } \
' 70
' 71 /** @internal
' 72 * At and append for value types.
' 73 */
' 74 #define DEFINE_QLIST_WRAPPER_VALUE_PART(NAME, TYPE) \
' 75 CL_SMOKE_QT_EXPORT const void* \
' 76 qt_smoke_list_ ## NAME ## _at(const void* list, int index) \
' 77 { \
' 78 const QList< TYPE >* qlist = static_cast<const QList< TYPE > *>(list); \
2009-05-27 tobias 79 return new TYPE(qlist->at(index)); \
2010-01-10 tobias 80 } \
08:52:49 ' 81 \
' 82 CL_SMOKE_QT_EXPORT void \
2009-05-27 tobias 83 qt_smoke_list_ ## NAME ## _append(void* list, void* data) \
2010-01-10 tobias 84 { \
08:52:49 ' 85 static_cast<QList< TYPE >*>(list) \
' 86 ->append(*static_cast<TYPE*>(data)); \
' 87 } \
' 88
' 89 #endif // CL_SMOKE_QT_QLIST_H