libbbb
1.2.1
Groups common code used in some applications and libraries.
libbbb
Classes
Files
File List
src
antenna
autothread
backjob
bytebuffer
core
doevents
dynstack
jobinterf
lists
list2d.cc
list2d.h
lnklst.h
markup
memtrack
refcount
rexscript
templates
timer
usermsg
varmap
File Members
•
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
list2d.h
Go to the documentation of this file.
1
/* ========================================================================= */
2
/* ------------------------------------------------------------------------- */
/*
12
13
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14
Please read COPYING and README files in root folder
15
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16
17
*/
18
/* ------------------------------------------------------------------------- */
19
/* ========================================================================= */
20
21
26
/* ------------------------------------------------------------------------- */
27
/* ========================================================================= */
28
#ifndef __LIST2D_INC__
29
#define __LIST2D_INC__
30
//
31
//
32
//
33
//
34
/* INCLUDES ------------------------------------------------------------ */
35
36
class
List2De
;
37
class
List2Dh
;
38
39
#include <libbbb/libbbb.h>
40
#include <QtGlobal>
41
#include <QDebug>
42
43
/* INCLUDES ============================================================ */
44
//
45
//
46
//
47
//
48
/* CLASS --------------------------------------------------------------- */
49
51
108
class
109
BBBSHARED_EXPORT
110
List2Dh
{
111
112
//
113
//
114
//
115
//
116
/* DEFINITIONS ----------------------------------------------------- */
117
118
friend
class
List2De
;
119
120
/* DEFINITIONS ===================================================== */
121
//
122
//
123
//
124
//
125
/* DATA ------------------------------------------------------------ */
126
127
128
protected
:
129
131
List2De
*
it_1
;
132
134
int
iCnt
;
135
136
/* DATA ============================================================ */
137
//
138
//
139
//
140
//
141
/* FUNCTIONS ------------------------------------------------------- */
142
143
public
:
144
145
147
List2Dh
()
148
{ it_1 = NULL; iCnt = 0; }
149
150
152
virtual
~
List2Dh
();
153
154
155
157
161
void
erase (
void
);
162
163
165
inline
void
setFirst (
List2De
* pNew)
166
{ it_1 = pNew; }
167
168
170
inline
void
setCount (
int
iNew)
171
{ iCnt = iNew; }
172
173
175
inline
List2De
* first (
void
)
const
176
{
return
it_1; }
177
178
180
List2De
* last (
void
)
const
181
{
if
(iCnt == 0)
return
NULL;
return
item(iCnt-1); }
182
185
List2De
* item (
int
i)
const
;
186
List2De
*
at
(
int
i)
const
{
187
return
item(i);
188
}
189
List2De
* operator[] (
int
i )
const
{
190
return
item(i);
191
}
193
195
inline
int
count (
void
)
const
196
{
return
iCnt; }
197
199
inline
bool
isEmpty (
void
)
const
200
{
return
(iCnt == 0); }
201
203
207
int
itemIndex (
const
List2De
* pIt)
const
;
208
209
211
bool
has (
const
List2De
* pIt)
const
212
{
return
contains( pIt ); }
213
214
215
216
218
223
void
append (
List2De
* pIt);
224
225
227
232
void
prepend (
List2De
* pIt);
233
234
236
241
void
insert (
List2De
* p_new,
int
index
);
242
243
245
250
void
ackAdd (
List2De
* pNew);
251
252
253
254
256
259
void
remove
(
int
i );
260
261
263
266
void
remove
(
List2De
* pIt);
267
268
270
277
void
ackDel (
List2De
* pNew);
278
279
280
282
void
dbgDump
(
void
)
const
;
283
284
286
bool
contains (
const
List2De
* p_el )
const
;
287
288
289
293
294
295
297
302
void
push
(
List2De
* pIt ) {
303
prepend( pIt );
304
}
305
307
312
void
pushBack
(
List2De
* pIt ) {
313
append( pIt );
314
}
315
317
List2De
*
pop
(
void
) {
318
List2De
* ret = first();
319
if
( ret != NULL )
320
remove
( ret );
321
return
ret;
322
}
323
325
List2De
*
popBack
(
void
) {
326
List2De
* ret = last();
327
if
( ret != NULL )
328
remove
( ret );
329
return
ret;
330
}
331
333
334
335
336
/* FUNCTIONS ======================================================= */
337
//
338
//
339
//
340
//
341
342
};
/* class List2Dh */
343
344
/* CLASS =============================================================== */
345
//
346
//
347
//
348
//
349
/* CLASS --------------------------------------------------------------- */
350
352
386
class
387
BBBSHARED_EXPORT
388
List2De
{
389
390
//
391
//
392
//
393
//
394
/* DEFINITIONS ----------------------------------------------------- */
395
396
friend
class
List2Dh
;
397
398
/* DEFINITIONS ===================================================== */
399
//
400
//
401
//
402
//
403
/* DATA ------------------------------------------------------------ */
404
protected
:
405
407
class
List2De
*
it_N
;
408
410
class
List2De
*
it_P
;
411
412
413
/* DATA ============================================================ */
414
//
415
//
416
//
417
//
418
/* FUNCTIONS ------------------------------------------------------- */
419
420
public
:
421
423
inline
List2De
()
424
{ it_N = NULL; it_P = NULL; }
425
427
inline
List2De
(
List2Dh
* p_father)
428
{ it_N = NULL; it_P = NULL; p_father->
append
(
this
); }
429
430
431
433
inline
List2De
*
next
(
void
)
const
434
{
return
it_N
; }
435
436
438
inline
List2De
*
prev
(
void
)
const
439
{
return
it_P
; }
440
441
443
int
index
(
const
List2Dh
* p_father)
const
;
444
445
446
447
449
void
insAfter
(
List2Dh
* p_father,
class
List2De
* pNew);
450
451
453
void
insBefore
(
List2Dh
* p_father,
class
List2De
* pNew);
454
455
456
458
void
extract
(
List2Dh
* p_father);
459
460
461
463
void
dbgDump
(
void
)
const
464
{ qDebug() <<
this
<<
" prev: "
<<
prev
() <<
" next: "
<<
next
(); }
465
466
467
protected
:
468
469
471
inline
void
setNext
(
class
List2De
* p_new )
472
{ it_N = p_new; }
473
474
476
inline
void
setPrev
(
class
List2De
* p_new )
477
{ it_P = p_new; }
478
479
480
481
/* FUNCTIONS ======================================================= */
482
//
483
//
484
//
485
//
486
};
/* class List2De */
487
488
/* CLASS =============================================================== */
489
//
490
//
491
//
492
//
493
#endif // __LIST2D_INC__
494
/* ------------------------------------------------------------------------- */
495
/* ========================================================================= */
src
lists
list2d.h
Generated on Thu Aug 8 2013 20:10:33 for libbbb by
1.8.3.1