QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgschunklist_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgschunklist_p.h
3  --------------------------------------
4  Date : July 2017
5  Copyright : (C) 2017 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSCHUNKLIST_P_H
17 #define QGSCHUNKLIST_P_H
18 
20 
21 //
22 // W A R N I N G
23 // -------------
24 //
25 // This file is not part of the QGIS API. It exists purely as an
26 // implementation detail. This header file may change from version to
27 // version without notice, or even be removed.
28 //
29 
30 #define SIP_NO_FILE
31 
32 class QgsChunkNode;
33 
42 struct QgsChunkListEntry
43 {
45  QgsChunkListEntry( QgsChunkNode *node )
46  : chunk( node )
47  {
48  }
49 
50  QgsChunkListEntry *prev = nullptr;
51  QgsChunkListEntry *next = nullptr;
52  QgsChunkNode *chunk;
53 };
54 
55 
69 class QgsChunkList
70 {
71  public:
73  QgsChunkList() = default;
74 
76  int trueCount() const;
78  int count() const { return mCount; }
79 
81  QgsChunkListEntry *first() const { return mHead; }
83  QgsChunkListEntry *last() const { return mTail; }
85  bool isEmpty() const;
86 
91  void insertEntry( QgsChunkListEntry *entry, QgsChunkListEntry *next );
92 
94  void takeEntry( QgsChunkListEntry *entry );
96  QgsChunkListEntry *takeFirst();
98  QgsChunkListEntry *takeLast();
99 
101  void insertFirst( QgsChunkListEntry *entry );
103  void insertLast( QgsChunkListEntry *entry );
104 
105  private:
106  QgsChunkListEntry *mHead = nullptr;
107  QgsChunkListEntry *mTail = nullptr;
108  int mCount = 0;
109 };
110 
112 
113 #endif // QGSCHUNKLIST_P_H