Debian Codegraph @

pencil/include/layout/layout_visible_classifier_iter.h

raw
1 /* File: layout_visible_classifier_iter.h; Copyright and License: see below */
2
3 #ifndef LAYOUT_VISIBLE_CLASSIFIER_ITER_H
4 #define LAYOUT_VISIBLE_CLASSIFIER_ITER_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Iterator over sorted arrays of visible classifiers.
10 */
11
12 #include "layout/layout_visible_classifier.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_visible_classifier_iter_struct {
22 uint32_t next_idx; /*!< next index on the order index_sorter, not the index in items */
23 uint32_t length; /*!< maximum entries to iterate over in index_sorter */
24 layout_visible_set_t *items;
25 const universal_array_index_sorter_t *order;
26 };
27
28 typedef struct layout_visible_classifier_iter_struct layout_visible_classifier_iter_t;
29
30 /*!
31 * \brief initializes the layout_visible_classifier_iter_t
32 *
33 * \param this_ pointer to own object attributes
34 * \param items array of items to iterate over
35 * \param order sorted list of indexes which determine the order
36 */
37 static inline void layout_visible_classifier_iter_init( layout_visible_classifier_iter_t *this_,
38 layout_visible_set_t *items,
39 const universal_array_index_sorter_t *order
40 );
41
42 /*!
43 * \brief initializes the layout_visible_classifier_iter_t to re-process the already processed items
44 *
45 * it ignores the not-yet-processed items and iterates only over the already processed items
46 *
47 * \param this_ pointer to own object attributes
48 * \param that pointer to layout_visible_classifier_iter_t iterator, of which only the processed elements shall be re-processed
49 */
50 static inline void layout_visible_classifier_iter_init_from_processed( layout_visible_classifier_iter_t *this_,
51 const layout_visible_classifier_iter_t *that
52 );
53
54 /*!
55 * \brief destroys the layout_visible_classifier_iter_t
56 *
57 * \param this_ pointer to own object attributes
58 */
59 static inline void layout_visible_classifier_iter_destroy( layout_visible_classifier_iter_t *this_ );
60
61 /*!
62 * \brief checks if there are more elements
63 *
64 * has_next() does not modify the iterator; multiple calls to has_next() do not skip elements.
65 *
66 * \param this_ pointer to own object attributes
67 * \return true if there is at least one more element.
68 */
69 static inline bool layout_visible_classifier_iter_has_next( const layout_visible_classifier_iter_t *this_ );
70
71 /*!
72 * \brief gets the next layout_visible_classifier_t if there are more, NULL otherwise.
73 *
74 * \param this_ pointer to own object attributes
75 * \return the next layout_visible_classifier_t
76 */
77 static inline layout_visible_classifier_t *layout_visible_classifier_iter_next_ptr( layout_visible_classifier_iter_t *this_ );
78
79 /*!
80 * \brief gets the number of already processed elements
81 *
82 * \param this_ pointer to own object attributes
83 * \return number of successful layout_visible_classifier_iter_next_ptr() calls.
84 */
85 static inline uint32_t layout_visible_classifier_iter_count_processed( const layout_visible_classifier_iter_t *this_ );
86
87 #include "layout_visible_classifier_iter.inl"
88
89 #endif /* LAYOUT_VISIBLE_CLASSIFIER_ITER_H */
90
91
92 /*
93 Copyright 2025-2026 Andreas Warnke
94
95 Licensed under the Apache License, Version 2.0 (the "License");
96 you may not use this file except in compliance with the License.
97 You may obtain a copy of the License at
98
99 http://www.apache.org/licenses/LICENSE-2.0
100
101 Unless required by applicable law or agreed to in writing, software
102 distributed under the License is distributed on an "AS IS" BASIS,
103 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
104 See the License for the specific language governing permissions and
105 limitations under the License.
106 */