repos
/
qt.core
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
Get the QList size using Lisp instead of an external C function.
Annotate for file src/lib/qlist.h
2009-05-11 tobias
1
#ifndef CL_SMOKE_QT_QLIST_H
11:21:14 '
2
#define CL_SMOKE_QT_QLIST_H
'
3
2009-05-11 tobias
4
#include "cl_smoke_qt.h"
2009-05-11 tobias
5
2010-01-10 tobias
6
#include <QList>
08:52:09 '
7
2009-05-11 tobias
8
/** @file
11:21:14 '
9
*/
'
10
'
11
/** Defines a C wrapper for the QList<@a TYPE>.
'
12
* @param TYPE the type of the elements of the QList
'
13
*/
'
14
#define DEFINE_QLIST_WRAPPER(TYPE) \
'
15
DEFINE_QLIST_WRAPPER_3(TYPE, TYPE, VALUE)
'
16
'
17
/** Defines a C wrapper for the QList<@a TYPE*>,
'
18
* where @a TYPE is the of the pointer.
'
19
*
'
20
* @param NAME the name used for the wrapper functions.
'
21
* @param TYPE the type of the elements
'
22
*/
'
23
#define DEFINE_QLIST_WRAPPER_PTR(TYPE) \
'
24
DEFINE_QLIST_WRAPPER_3(TYPE, TYPE*, PTR)
'
25
'
26
/** @internal */
'
27
#define DEFINE_QLIST_WRAPPER_3(NAME, TYPE, PTR_VALUE) \
'
28
DEFINE_QLIST_WRAPPER_ALL_PART(NAME, TYPE) \
'
29
DEFINE_QLIST_WRAPPER_ ## PTR_VALUE ## _PART(NAME, TYPE) \
'
30
'
31
'
32
/** @internal
'
33
* size, free and make_list. */
'
34
#define DEFINE_QLIST_WRAPPER_ALL_PART(NAME, TYPE) \
2009-05-11 tobias
35
CL_SMOKE_QT_EXPORT void \
2010-01-10 tobias
36
cl_smoke_free_list_ ## NAME (void* list) \
2009-05-11 tobias
37
{ \
11:21:14 '
38
delete static_cast<QList< TYPE >*>(list); \
'
39
} \
'
40
\
2009-05-11 tobias
41
CL_SMOKE_QT_EXPORT void* \
2010-01-10 tobias
42
cl_smoke_make_list_ ## NAME () \
2009-05-11 tobias
43
{ \
11:21:14 '
44
return new QList< TYPE >(); \
'
45
} \
'
46
\
'
47
'
48
/** @internal
'
49
* At and append for pointer types
'
50
*/
'
51
#define DEFINE_QLIST_WRAPPER_PTR_PART(NAME, TYPE) \
2009-05-11 tobias
52
CL_SMOKE_QT_EXPORT const void* \
2010-01-10 tobias
53
cl_smoke_list_ ## NAME ## _at(const void* list, int index) \
2009-05-11 tobias
54
{ \
11:21:14 '
55
const QList< TYPE >* qlist = static_cast<const QList< TYPE > *>(list); \
'
56
return qlist->at(index); \
'
57
} \
'
58
\
2009-05-11 tobias
59
CL_SMOKE_QT_EXPORT void \
2010-01-10 tobias
60
cl_smoke_list_ ## NAME ## _append(void* list, void* data) \
2009-05-11 tobias
61
{ \
11:21:14 '
62
static_cast<QList< TYPE >*>(list) \
'
63
->append(static_cast<TYPE>(data)); \
'
64
} \
'
65
'
66
/** @internal
'
67
* At and append for value types.
'
68
*/
'
69
#define DEFINE_QLIST_WRAPPER_VALUE_PART(NAME, TYPE) \
2009-05-11 tobias
70
CL_SMOKE_QT_EXPORT const void* \
2010-01-10 tobias
71
cl_smoke_list_ ## NAME ## _at(const void* list, int index) \
2009-05-11 tobias
72
{ \
11:21:14 '
73
const QList< TYPE >* qlist = static_cast<const QList< TYPE > *>(list); \
2009-05-27 tobias
74
return new TYPE(qlist->at(index)); \
2009-05-11 tobias
75
} \
11:21:14 '
76
\
2009-05-11 tobias
77
CL_SMOKE_QT_EXPORT void \
2010-01-10 tobias
78
cl_smoke_list_ ## NAME ## _append(void* list, void* data) \
2009-05-11 tobias
79
{ \
11:21:14 '
80
static_cast<QList< TYPE >*>(list) \
'
81
->append(*static_cast<TYPE*>(data)); \
'
82
} \
'
83
'
84
#endif // CL_SMOKE_QT_QLIST_H