| 1 |
/* File: layout_feature_iter.inl; Copyright and License: see below */ |
| 2 |
|
| 3 |
#include "u8/u8_trace.h" |
| 4 |
#include <assert.h> |
| 5 |
|
| 6 |
static inline void layout_feature_iter_init( layout_feature_iter_t *this_, |
| 7 |
layout_visible_set_t *items, |
| 8 |
const universal_array_index_sorter_t *order ) |
| 9 |
{ |
| 10 |
(*this_).next_idx = 0; |
| 11 |
(*this_).items = items; |
| 12 |
(*this_).order = order; |
| 13 |
} |
| 14 |
|
| 15 |
static inline void layout_feature_iter_destroy( layout_feature_iter_t *this_ ) |
| 16 |
{ |
| 17 |
(*this_).next_idx = 0; |
| 18 |
(*this_).items = NULL; |
| 19 |
(*this_).order = NULL; |
| 20 |
} |
| 21 |
|
| 22 |
static inline bool layout_feature_iter_has_next( const layout_feature_iter_t *this_ ) |
| 23 |
{ |
| 24 |
return ( (*this_).next_idx < universal_array_index_sorter_get_count( (*this_).order ) ); |
| 25 |
} |
| 26 |
|
| 27 |
static inline layout_feature_t *layout_feature_iter_next_ptr( layout_feature_iter_t *this_ ) |
| 28 |
{ |
| 29 |
layout_feature_t *result = NULL; |
| 30 |
if ( layout_feature_iter_has_next( this_ ) ) |
| 31 |
{ |
| 32 |
uint32_t array_index = universal_array_index_sorter_get_array_index( (*this_).order, (*this_).next_idx ); |
| 33 |
assert( array_index < layout_visible_set_get_feature_count( (*this_).items ) ); |
| 34 |
result = layout_visible_set_get_feature_ptr( (*this_).items, array_index ); |
| 35 |
(*this_).next_idx ++; |
| 36 |
} |
| 37 |
return result; |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
/* |
| 42 |
Copyright 2025-2026 Andreas Warnke |
| 43 |
|
| 44 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 45 |
you may not use this file except in compliance with the License. |
| 46 |
You may obtain a copy of the License at |
| 47 |
|
| 48 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 49 |
|
| 50 |
Unless required by applicable law or agreed to in writing, software |
| 51 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 52 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 53 |
See the License for the specific language governing permissions and |
| 54 |
limitations under the License. |
| 55 |
*/ |