LCOV - code coverage report
Current view: top level - pencil/include/layout - layout_relationship_iter.inl (source / functions) Coverage Total Hit
Test: crystal-facet-uml_v1.69.0_covts Lines: 0.0 % 48 0
Test Date: 2026-03-08 20:58:47 Functions: 0.0 % 8 0

            Line data    Source code
       1              : /* File: layout_relationship_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_relationship_iter_init( layout_relationship_iter_t *this_,
       7              :                                                   layout_visible_set_t *items,
       8              :                                                   const universal_array_index_sorter_t *order )
       9              : {
      10            0 :     assert( items != NULL );
      11            0 :     assert( order != NULL );
      12            0 :     (*this_).next_idx = 0;
      13            0 :     (*this_).length = universal_array_index_sorter_get_count( order );
      14            0 :     (*this_).items = items;
      15            0 :     (*this_).order = order;
      16            0 : }
      17              : 
      18            0 : static inline void layout_relationship_iter_init_from_processed( layout_relationship_iter_t *this_,
      19              :                                                                  const layout_relationship_iter_t *that )
      20              : {
      21            0 :     (*this_).next_idx = 0;
      22            0 :     (*this_).length = (*that).next_idx;
      23            0 :     (*this_).items = (*that).items;
      24            0 :     (*this_).order = (*that).order;
      25            0 : }
      26              : 
      27            0 : static inline void layout_relationship_iter_copy( layout_relationship_iter_t *this_,
      28              :                                                   const layout_relationship_iter_t *original )
      29              : {
      30            0 :     (*this_).next_idx = (*original).next_idx;
      31            0 :     (*this_).length = (*original).length;
      32            0 :     (*this_).items = (*original).items;
      33            0 :     (*this_).order = (*original).order;
      34            0 : }
      35              : 
      36            0 : static inline void layout_relationship_iter_reset ( layout_relationship_iter_t *this_ )
      37              : {
      38            0 :     (*this_).next_idx = 0;
      39            0 : }
      40              : 
      41            0 : static inline void layout_relationship_iter_destroy( layout_relationship_iter_t *this_ )
      42              : {
      43            0 :     (*this_).next_idx = 0;
      44            0 :     (*this_).length = 0;
      45            0 :     (*this_).items = NULL;
      46            0 :     (*this_).order = NULL;
      47            0 : }
      48              : 
      49            0 : static inline bool layout_relationship_iter_has_next( const layout_relationship_iter_t *this_ )
      50              : {
      51              :     /* check that the size of the array has not shrinked */
      52              :     /* It should not have changed at all, but this cannot be checked here. */
      53            0 :     assert( (*this_).length <= universal_array_index_sorter_get_count( (*this_).order ) );
      54              : 
      55            0 :     return ( (*this_).next_idx < (*this_).length );
      56              : }
      57              : 
      58            0 : static inline layout_relationship_t *layout_relationship_iter_next_ptr( layout_relationship_iter_t *this_ )
      59              : {
      60            0 :     layout_relationship_t *result = NULL;
      61            0 :     if ( layout_relationship_iter_has_next( this_ ) )
      62              :     {
      63            0 :         uint32_t array_index = universal_array_index_sorter_get_array_index( (*this_).order, (*this_).next_idx );
      64            0 :         assert( array_index < layout_visible_set_get_relationship_count( (*this_).items ) );
      65            0 :         result = layout_visible_set_get_relationship_ptr( (*this_).items, array_index );
      66            0 :         (*this_).next_idx ++;
      67              :     }
      68            0 :     return result;
      69              : }
      70              : 
      71            0 : static inline const layout_relationship_t *layout_relationship_iter_next( layout_relationship_iter_t *this_ )
      72              : {
      73            0 :     const layout_relationship_t *result = NULL;
      74            0 :     if ( layout_relationship_iter_has_next( this_ ) )
      75              :     {
      76            0 :         uint32_t array_index = universal_array_index_sorter_get_array_index( (*this_).order, (*this_).next_idx );
      77            0 :         assert( array_index < layout_visible_set_get_relationship_count( (*this_).items ) );
      78            0 :         result = layout_visible_set_get_relationship_const( (*this_).items, array_index );
      79            0 :         (*this_).next_idx ++;
      80              :     }
      81            0 :     return result;
      82              : }
      83              : 
      84              : 
      85              : /*
      86              : Copyright 2025-2026 Andreas Warnke
      87              : 
      88              : Licensed under the Apache License, Version 2.0 (the "License");
      89              : you may not use this file except in compliance with the License.
      90              : You may obtain a copy of the License at
      91              : 
      92              :     http://www.apache.org/licenses/LICENSE-2.0
      93              : 
      94              : Unless required by applicable law or agreed to in writing, software
      95              : distributed under the License is distributed on an "AS IS" BASIS,
      96              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      97              : See the License for the specific language governing permissions and
      98              : limitations under the License.
      99              : */
        

Generated by: LCOV version 2.0-1