Debian Codegraph @

pencil/include/layout/layout_feature_iter.h

raw
1 /* File: layout_feature_iter.h; Copyright and License: see below */
2
3 #ifndef LAYOUT_FEATURE_ITER_H
4 #define LAYOUT_FEATURE_ITER_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Iterator over sorted arrays of features.
10 */
11
12 #include "layout/layout_feature.h"
13 #include "layout/layout_visible_set.h"
14 #include "u8list/universal_array_index_sorter.h"
15 #include <stdint.h>
16 #include <stdbool.h>
17
18 /*!
19 * \brief attributes of the iterator
20 */
21 struct layout_feature_iter_struct {
22 uint32_t next_idx; /*!< next index on the order index_sorter, not the index in items */
23 layout_visible_set_t *items;
24 const universal_array_index_sorter_t *order;
25 };
26
27 typedef struct layout_feature_iter_struct layout_feature_iter_t;
28
29 /*!
30 * \brief initializes the layout_feature_iter_t
31 *
32 * \param this_ pointer to own object attributes
33 * \param items array of items to iterate over
34 * \param order sorted list of indexes which determine the order
35 */
36 static inline void layout_feature_iter_init( layout_feature_iter_t *this_,
37 layout_visible_set_t *items,
38 const universal_array_index_sorter_t *order
39 );
40
41 /*!
42 * \brief destroys the layout_feature_iter_t
43 *
44 * \param this_ pointer to own object attributes
45 */
46 static inline void layout_feature_iter_destroy( layout_feature_iter_t *this_ );
47
48 /*!
49 * \brief checks if there are more elements
50 *
51 * has_next() does not modify the iterator; multiple calls to has_next() do not skip elements.
52 *
53 * \param this_ pointer to own object attributes
54 * \return true if there is at least one more element.
55 */
56 static inline bool layout_feature_iter_has_next( const layout_feature_iter_t *this_ );
57
58 /*!
59 * \brief gets the next layout_feature_t if there are more, NULL otherwise.
60 *
61 * \param this_ pointer to own object attributes
62 * \return the next layout_feature_t
63 */
64 static inline layout_feature_t *layout_feature_iter_next_ptr( layout_feature_iter_t *this_ );
65
66 #include "layout_feature_iter.inl"
67
68 #endif /* LAYOUT_FEATURE_ITER_H */
69
70
71 /*
72 Copyright 2025-2026 Andreas Warnke
73
74 Licensed under the Apache License, Version 2.0 (the "License");
75 you may not use this file except in compliance with the License.
76 You may obtain a copy of the License at
77
78 http://www.apache.org/licenses/LICENSE-2.0
79
80 Unless required by applicable law or agreed to in writing, software
81 distributed under the License is distributed on an "AS IS" BASIS,
82 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
83 See the License for the specific language governing permissions and
84 limitations under the License.
85 */