Kstars

MeshIterator.h
1/*
2 SPDX-FileCopyrightText: 2007 James B. Bowlin <bowlin@mindspring.com>
3 SPDX-License-Identifier: BSD-3-Clause AND GPL-2.0-or-later
4*/
5
6#pragma once
7
8#include "typedef.h"
9
10class HTMesh;
11
12/**
13 * @class MeshIterator
14 * MeshIterator is a very lightweight class used to iterate over the
15 * result set of an HTMesh intersection. If you want to iterate over the same
16 * result set multiple times in the same block of code, you don't need to create
17 * a new MeshIterator, just call the reset() method and then re-use the iterator.
18 */
19
21{
22 public:
23 MeshIterator(HTMesh *mesh, BufNum bufNum = 0);
24
25 /** @short true if there are more trixel to iterate over.
26 */
27 bool hasNext() const { return cnt < m_size; }
28
29 /** @short returns the next trixel
30 */
31 Trixel next() const { return index[cnt++]; }
32
33 /** @short returns the number of trixels stored
34 */
35 int size() const { return m_size; }
36
37 /** @short sets the count back to zero so you can use this iterator
38 * to iterate again over the same result set.
39 */
40 void reset() const { cnt = 0; }
41
42 private:
43 const Trixel *index;
44 int m_size;
45 mutable int cnt;
46};
HTMesh was originally intended to be a simple interface to the HTM library for the KStars project tha...
Definition HTMesh.h:57
MeshIterator is a very lightweight class used to iterate over the result set of an HTMesh intersectio...
void reset() const
sets the count back to zero so you can use this iterator to iterate again over the same result set.
Trixel next() const
returns the next trixel
bool hasNext() const
true if there are more trixel to iterate over.
int size() const
returns the number of trixels stored
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:03 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.