QGIS API Documentation  3.23.0-Master (dd0cd13a00)
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 
70 class QgsChunkList
71 {
72  public:
74  QgsChunkList() = default;
75 
77  int trueCount() const;
79  int count() const { return mCount; }
80 
82  QgsChunkListEntry *first() const { return mHead; }
84  QgsChunkListEntry *last() const { return mTail; }
86  bool isEmpty() const;
87 
92  void insertEntry( QgsChunkListEntry *entry, QgsChunkListEntry *next );
93 
95  void takeEntry( QgsChunkListEntry *entry );
97  QgsChunkListEntry *takeFirst();
99  QgsChunkListEntry *takeLast();
100 
102  void insertFirst( QgsChunkListEntry *entry );
104  void insertLast( QgsChunkListEntry *entry );
105 
106  private:
107  QgsChunkListEntry *mHead = nullptr;
108  QgsChunkListEntry *mTail = nullptr;
109  int mCount = 0;
110 };
111 
113 
114 #endif // QGSCHUNKLIST_P_H