LCOV - code coverage report
Current view: top level - data/include/set - data_search_result.inl (source / functions) Coverage Total Hit
Test: crystal-facet-uml_v1.63.2_covts Lines: 100.0 % 95 95
Test Date: 2025-05-01 10:10:14 Functions: 100.0 % 21 21

            Line data    Source code
       1              : /* File: data_search_result.inl; Copyright and License: see below */
       2              : 
       3              : #include <assert.h>
       4              : #include "u8/u8_log.h"
       5              : 
       6            2 : static inline void data_search_result_init_diagram ( data_search_result_t *this_,
       7              :                                                      data_row_t match_id,
       8              :                                                      data_diagram_type_t match_type,
       9              :                                                      const char* match_name )
      10              : {
      11            2 :     assert( NULL != match_name );
      12              :     utf8error_t strerr;
      13              : 
      14            2 :     data_id_init( &((*this_).match_object_id), DATA_TABLE_DIAGRAM, match_id );
      15            2 :     data_type_init_diagram( &((*this_).match_object_type), match_type );
      16            2 :     (*this_).match_object_name = utf8stringbuf_new( (*this_).private_match_name_buffer, sizeof((*this_).private_match_name_buffer) );
      17            2 :     strerr = utf8stringbuf_copy_str( &((*this_).match_object_name), match_name );
      18            2 :     if ( strerr != UTF8ERROR_SUCCESS )
      19              :     {
      20              :         /* just the read-only name of a search result - truncation should not matter */
      21            1 :         U8_LOG_ANOMALY_INT( "utf8stringbuf_copy_str() failed:", strerr );
      22              :     }
      23              : 
      24            2 :     data_id_init_void( &((*this_).src_classifier_id) );
      25            2 :     data_id_init_void( &((*this_).dst_classifier_id) );
      26            2 :     data_id_init( &((*this_).diagram_id), DATA_TABLE_DIAGRAM, match_id );
      27            2 : }
      28              : 
      29            1 : static inline void data_search_result_init_classifier ( data_search_result_t *this_,
      30              :                                                         data_row_t match_id,
      31              :                                                         data_classifier_type_t match_type,
      32              :                                                         const char* match_name,
      33              :                                                         data_row_t diagram_id  )
      34              : {
      35            1 :     assert( NULL != match_name );
      36              :     utf8error_t strerr;
      37              : 
      38            1 :     data_id_init( &((*this_).match_object_id), DATA_TABLE_CLASSIFIER, match_id );
      39            1 :     data_type_init_classifier( &((*this_).match_object_type), match_type );
      40            1 :     (*this_).match_object_name = utf8stringbuf_new( (*this_).private_match_name_buffer, sizeof((*this_).private_match_name_buffer) );
      41            1 :     strerr = utf8stringbuf_copy_str( &((*this_).match_object_name), match_name );
      42            1 :     if ( strerr != UTF8ERROR_SUCCESS )
      43              :     {
      44              :         /* just the read-only name of a search result - truncation should not matter */
      45            1 :         U8_LOG_ANOMALY_INT( "utf8stringbuf_copy_str() failed:", strerr );
      46              :     }
      47              : 
      48            1 :     data_id_init_void( &((*this_).src_classifier_id) );
      49            1 :     data_id_init_void( &((*this_).dst_classifier_id) );
      50            1 :     data_id_init( &((*this_).diagram_id), DATA_TABLE_DIAGRAM, diagram_id );
      51            1 : }
      52              : 
      53            1 : static inline void data_search_result_init_feature ( data_search_result_t *this_,
      54              :                                                      data_row_t match_id,
      55              :                                                      data_feature_type_t match_type,
      56              :                                                      const char* match_name,
      57              :                                                      data_row_t classifier_id,
      58              :                                                      data_row_t diagram_id )
      59              : {
      60            1 :     assert( NULL != match_name );
      61              :     utf8error_t strerr;
      62              : 
      63            1 :     data_id_init( &((*this_).match_object_id), DATA_TABLE_FEATURE, match_id );
      64            1 :     data_type_init_feature( &((*this_).match_object_type), match_type );
      65            1 :     (*this_).match_object_name = utf8stringbuf_new( (*this_).private_match_name_buffer, sizeof((*this_).private_match_name_buffer) );
      66            1 :     strerr = utf8stringbuf_copy_str( &((*this_).match_object_name), match_name );
      67            1 :     if ( strerr != UTF8ERROR_SUCCESS )
      68              :     {
      69              :         /* just the read-only name of a search result - truncation should not matter */
      70            1 :         U8_LOG_ANOMALY_INT( "utf8stringbuf_copy_str() failed:", strerr );
      71              :     }
      72              : 
      73            1 :     data_id_init( &((*this_).src_classifier_id), DATA_TABLE_CLASSIFIER, classifier_id );
      74            1 :     data_id_init_void( &((*this_).dst_classifier_id) );
      75            1 :     data_id_init( &((*this_).diagram_id), DATA_TABLE_DIAGRAM, diagram_id );
      76            1 : }
      77              : 
      78            1 : static inline void data_search_result_init_relationship ( data_search_result_t *this_,
      79              :                                                           data_row_t match_id,
      80              :                                                           data_relationship_type_t match_type,
      81              :                                                           const char* match_name,
      82              :                                                           data_row_t from_classifier_id,
      83              :                                                           data_row_t to_classifier_id,
      84              :                                                           data_row_t diagram_id )
      85              : {
      86            1 :     assert( NULL != match_name );
      87              :     utf8error_t strerr;
      88              : 
      89            1 :     data_id_init( &((*this_).match_object_id), DATA_TABLE_RELATIONSHIP, match_id );
      90            1 :     data_type_init_relationship( &((*this_).match_object_type), match_type );
      91            1 :     (*this_).match_object_name = utf8stringbuf_new( (*this_).private_match_name_buffer, sizeof((*this_).private_match_name_buffer) );
      92            1 :     strerr = utf8stringbuf_copy_str( &((*this_).match_object_name), match_name );
      93            1 :     if ( strerr != UTF8ERROR_SUCCESS )
      94              :     {
      95              :         /* just the read-only name of a search result - truncation should not matter */
      96            1 :         U8_LOG_ANOMALY_INT( "utf8stringbuf_copy_str() failed:", strerr );
      97              :     }
      98              : 
      99            1 :     data_id_init( &((*this_).src_classifier_id), DATA_TABLE_CLASSIFIER, from_classifier_id );
     100            1 :     data_id_init( &((*this_).dst_classifier_id), DATA_TABLE_CLASSIFIER, to_classifier_id );
     101            1 :     data_id_init( &((*this_).diagram_id), DATA_TABLE_DIAGRAM, diagram_id );
     102            1 : }
     103              : 
     104            2 : static inline void data_search_result_copy ( data_search_result_t *this_, const data_search_result_t *original )
     105              : {
     106            2 :     assert( NULL != original );
     107              : 
     108            2 :     *this_ = *original;
     109              :     /* repair the overwritten pointers */
     110            2 :     (*this_).match_object_name = utf8stringbuf_new( (*this_).private_match_name_buffer, sizeof((*this_).private_match_name_buffer) );
     111            2 : }
     112              : 
     113            4 : static inline void data_search_result_destroy ( data_search_result_t *this_ )
     114              : {
     115            4 :     data_id_destroy( &((*this_).match_object_id) );
     116            4 :     data_id_destroy( &((*this_).src_classifier_id) );
     117            4 :     data_id_destroy( &((*this_).dst_classifier_id) );
     118            4 :     data_id_destroy( &((*this_).diagram_id) );
     119            4 : }
     120              : 
     121            1 : static inline data_id_t data_search_result_get_match_id ( const data_search_result_t *this_ )
     122              : {
     123            1 :     return (*this_).match_object_id;
     124              : }
     125              : 
     126            1 : static inline data_id_t *data_search_result_get_match_id_ptr ( data_search_result_t *this_ )
     127              : {
     128            1 :     return &((*this_).match_object_id);
     129              : }
     130              : 
     131            2 : static inline const data_id_t *data_search_result_get_match_id_const ( const data_search_result_t *this_ )
     132              : {
     133            2 :     return &((*this_).match_object_id);
     134              : }
     135              : 
     136            4 : static inline data_type_t data_search_result_get_match_type ( const data_search_result_t *this_ )
     137              : {
     138            4 :     return (*this_).match_object_type;
     139              : }
     140              : 
     141            4 : static inline const char* data_search_result_get_match_name_const ( const data_search_result_t *this_ )
     142              : {
     143            4 :     return utf8stringbuf_get_string( &((*this_).match_object_name) );
     144              : }
     145              : 
     146            1 : static inline data_id_t data_search_result_get_src_classifier_id ( const data_search_result_t *this_ )
     147              : {
     148            1 :     return (*this_).src_classifier_id;
     149              : }
     150              : 
     151            1 : static inline data_id_t *data_search_result_get_src_classifier_id_ptr ( data_search_result_t *this_ )
     152              : {
     153            1 :     return &((*this_).src_classifier_id);
     154              : }
     155              : 
     156            2 : static inline const data_id_t *data_search_result_get_src_classifier_id_const ( const data_search_result_t *this_ )
     157              : {
     158            2 :     return &((*this_).src_classifier_id);
     159              : }
     160              : 
     161            1 : static inline data_id_t data_search_result_get_dst_classifier_id ( const data_search_result_t *this_ )
     162              : {
     163            1 :     return (*this_).dst_classifier_id;
     164              : }
     165              : 
     166            1 : static inline data_id_t *data_search_result_get_dst_classifier_id_ptr ( data_search_result_t *this_ )
     167              : {
     168            1 :     return &((*this_).dst_classifier_id);
     169              : }
     170              : 
     171            2 : static inline const data_id_t *data_search_result_get_dst_classifier_id_const ( const data_search_result_t *this_ )
     172              : {
     173            2 :     return &((*this_).dst_classifier_id);
     174              : }
     175              : 
     176            1 : static inline data_id_t data_search_result_get_diagram_id ( const data_search_result_t *this_ )
     177              : {
     178            1 :     return (*this_).diagram_id;
     179              : }
     180              : 
     181            1 : static inline data_id_t *data_search_result_get_diagram_id_ptr ( data_search_result_t *this_ )
     182              : {
     183            1 :     return &((*this_).diagram_id);
     184              : }
     185              : 
     186            2 : static inline const data_id_t *data_search_result_get_diagram_id_const ( const data_search_result_t *this_ )
     187              : {
     188            2 :     return &((*this_).diagram_id);
     189              : }
     190              : 
     191            2 : static inline void data_search_result_trace ( const data_search_result_t *this_ )
     192              : {
     193            2 :     U8_TRACE_INFO_STR( "- name:", utf8stringbuf_get_string( &((*this_).match_object_name) ) );
     194            2 :     U8_TRACE_INFO_INT( "- type:", data_type_get_type_as_int( &((*this_).match_object_type) ) );
     195            2 :     data_id_trace( &((*this_).match_object_id) );
     196            2 :     data_id_trace( &((*this_).src_classifier_id) );
     197            2 :     data_id_trace( &((*this_).dst_classifier_id) );
     198            2 :     data_id_trace( &((*this_).diagram_id) );
     199            2 : }
     200              : 
     201              : 
     202              : /*
     203              : Copyright 2020-2025 Andreas Warnke
     204              : 
     205              : Licensed under the Apache License, Version 2.0 (the "License");
     206              : you may not use this file except in compliance with the License.
     207              : You may obtain a copy of the License at
     208              : 
     209              :     http://www.apache.org/licenses/LICENSE-2.0
     210              : 
     211              : Unless required by applicable law or agreed to in writing, software
     212              : distributed under the License is distributed on an "AS IS" BASIS,
     213              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     214              : See the License for the specific language governing permissions and
     215              : limitations under the License.
     216              : */
        

Generated by: LCOV version 2.0-1