|
TrinityCore
|
Go to the documentation of this file.
4 #define ql_head(a_type) \
9 #define ql_head_initializer(a_head) {NULL}
11 #define ql_elm(a_type) qr(a_type)
14 #define ql_new(a_head) do { \
15 (a_head)->qlh_first = NULL; \
18 #define ql_elm_new(a_elm, a_field) qr_new((a_elm), a_field)
20 #define ql_first(a_head) ((a_head)->qlh_first)
22 #define ql_last(a_head, a_field) \
23 ((ql_first(a_head) != NULL) \
24 ? qr_prev(ql_first(a_head), a_field) : NULL)
26 #define ql_next(a_head, a_elm, a_field) \
27 ((ql_last(a_head, a_field) != (a_elm)) \
28 ? qr_next((a_elm), a_field) : NULL)
30 #define ql_prev(a_head, a_elm, a_field) \
31 ((ql_first(a_head) != (a_elm)) ? qr_prev((a_elm), a_field) \
34 #define ql_before_insert(a_head, a_qlelm, a_elm, a_field) do { \
35 qr_before_insert((a_qlelm), (a_elm), a_field); \
36 if (ql_first(a_head) == (a_qlelm)) { \
37 ql_first(a_head) = (a_elm); \
41 #define ql_after_insert(a_qlelm, a_elm, a_field) \
42 qr_after_insert((a_qlelm), (a_elm), a_field)
44 #define ql_head_insert(a_head, a_elm, a_field) do { \
45 if (ql_first(a_head) != NULL) { \
46 qr_before_insert(ql_first(a_head), (a_elm), a_field); \
48 ql_first(a_head) = (a_elm); \
51 #define ql_tail_insert(a_head, a_elm, a_field) do { \
52 if (ql_first(a_head) != NULL) { \
53 qr_before_insert(ql_first(a_head), (a_elm), a_field); \
55 ql_first(a_head) = qr_next((a_elm), a_field); \
58 #define ql_remove(a_head, a_elm, a_field) do { \
59 if (ql_first(a_head) == (a_elm)) { \
60 ql_first(a_head) = qr_next(ql_first(a_head), a_field); \
62 if (ql_first(a_head) != (a_elm)) { \
63 qr_remove((a_elm), a_field); \
65 ql_first(a_head) = NULL; \
69 #define ql_head_remove(a_head, a_type, a_field) do { \
70 a_type *t = ql_first(a_head); \
71 ql_remove((a_head), t, a_field); \
74 #define ql_tail_remove(a_head, a_type, a_field) do { \
75 a_type *t = ql_last(a_head, a_field); \
76 ql_remove((a_head), t, a_field); \
79 #define ql_foreach(a_var, a_head, a_field) \
80 qr_foreach((a_var), ql_first(a_head), a_field)
82 #define ql_reverse_foreach(a_var, a_head, a_field) \
83 qr_reverse_foreach((a_var), ql_first(a_head), a_field)