Line data Source code
1 : /* File: layout_feature_iter.inl; Copyright and License: see below */ 2 : 3 : #include "u8/u8_trace.h" 4 : #include <assert.h> 5 : 6 0 : 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 0 : (*this_).next_idx = 0; 11 0 : (*this_).items = items; 12 0 : (*this_).order = order; 13 0 : } 14 : 15 0 : static inline void layout_feature_iter_destroy( layout_feature_iter_t *this_ ) 16 : { 17 0 : (*this_).next_idx = 0; 18 0 : (*this_).items = NULL; 19 0 : (*this_).order = NULL; 20 0 : } 21 : 22 0 : static inline bool layout_feature_iter_has_next( const layout_feature_iter_t *this_ ) 23 : { 24 0 : return ( (*this_).next_idx < universal_array_index_sorter_get_count( (*this_).order ) ); 25 : } 26 : 27 0 : static inline layout_feature_t *layout_feature_iter_next_ptr( layout_feature_iter_t *this_ ) 28 : { 29 0 : layout_feature_t *result = NULL; 30 0 : if ( layout_feature_iter_has_next( this_ ) ) 31 : { 32 0 : uint32_t array_index = universal_array_index_sorter_get_array_index( (*this_).order, (*this_).next_idx ); 33 0 : assert( array_index < layout_visible_set_get_feature_count( (*this_).items ) ); 34 0 : result = layout_visible_set_get_feature_ptr( (*this_).items, array_index ); 35 0 : (*this_).next_idx ++; 36 : } 37 0 : return result; 38 : } 39 : 40 : 41 : /* 42 : Copyright 2025-2025 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 : */