QGIS API Documentation  3.2.0-Bonn (bc43194)
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 class QgsChunkNode;
31 
37 struct QgsChunkListEntry
38 {
40  QgsChunkListEntry( QgsChunkNode *node )
41  : chunk( node )
42  {
43  }
44 
45  QgsChunkListEntry *prev = nullptr;
46  QgsChunkListEntry *next = nullptr;
47  QgsChunkNode *chunk;
48 };
49 
50 
64 class QgsChunkList
65 {
66  public:
68  QgsChunkList() = default;
69 
71  int trueCount() const;
73  int count() const { return mCount; }
74 
76  QgsChunkListEntry *first() const { return mHead; }
78  QgsChunkListEntry *last() const { return mTail; }
80  bool isEmpty() const;
81 
86  void insertEntry( QgsChunkListEntry *entry, QgsChunkListEntry *next );
87 
89  void takeEntry( QgsChunkListEntry *entry );
91  QgsChunkListEntry *takeFirst();
93  QgsChunkListEntry *takeLast();
94 
96  void insertFirst( QgsChunkListEntry *entry );
98  void insertLast( QgsChunkListEntry *entry );
99 
100  private:
101  QgsChunkListEntry *mHead = nullptr;
102  QgsChunkListEntry *mTail = nullptr;
103  int mCount = 0;
104 };
105 
107 
108 #endif // QGSCHUNKLIST_P_H