LCOV - code coverage report
Current view: top level - io/include/json - json_type_name_map.inl (source / functions) Hit Total Coverage
Test: crystal-facet-uml_v1.57.0_covts Lines: 0 65 0.0 %
Date: 2024-04-07 11:14:42 Functions: 0 8 0.0 %

          Line data    Source code
       1             : /* File: json_type_name_map.inl; Copyright and License: see below */
       2             : 
       3             : #include "xmi/xmi_element_info_map.h"
       4             : #include "xmi/xmi_element_info.h"
       5             : #include "xmi/xmi_diagram_info_map.h"
       6             : #include "xmi/xmi_diagram_info.h"
       7             : #include <stdint.h>
       8             : #include <assert.h>
       9             : 
      10           0 : static inline void json_type_name_map_init( json_type_name_map_t *this_ )
      11             : {
      12           0 :     (*this_).dummy = 0;  /* prevent warnings on uninitialized usage */
      13           0 : }
      14             : 
      15           0 : static inline void json_type_name_map_destroy( json_type_name_map_t *this_ )
      16             : {
      17           0 : }
      18             : 
      19           0 : static inline const char * json_type_name_map_get_classifier_type( const json_type_name_map_t *this_,
      20             :                                                                    data_classifier_type_t parent_type,
      21             :                                                                    data_classifier_type_t classifier_type )
      22             : {
      23             :     const xmi_element_info_t *element_info;
      24           0 :     const int err = xmi_element_info_map_get_classifier( &xmi_element_info_map_standard,
      25             :                                                          parent_type,
      26             :                                                          classifier_type,
      27             :                                                          &element_info
      28             :                                                        );
      29           0 :     const char *const type_name = (err!=0) ? "" : xmi_element_info_get_name( element_info );
      30           0 :     return type_name;
      31             : }
      32             : 
      33           0 : static inline const char * json_type_name_map_get_feature_type( const json_type_name_map_t *this_,
      34             :                                                                 data_classifier_type_t parent_type,
      35             :                                                                 data_feature_type_t feature_type )
      36             : {
      37             :     const xmi_element_info_t *element_info;
      38           0 :     const int err = xmi_element_info_map_get_feature( &xmi_element_info_map_standard,
      39             :                                                       parent_type,
      40             :                                                       feature_type,
      41             :                                                       &element_info
      42             :                                                     );
      43           0 :     const char *const type_name = (err!=0) ? "" : xmi_element_info_get_name( element_info );
      44           0 :     return type_name;
      45             : }
      46             : 
      47           0 : static inline const char * json_type_name_map_get_relationship_type( const json_type_name_map_t *this_,
      48             :                                                                      bool statemachine_context,
      49             :                                                                      data_relationship_type_t rel_type )
      50             : {
      51             :     const xmi_element_info_t *element_info;
      52           0 :     const int err = xmi_element_info_map_get_relationship( &xmi_element_info_map_standard,
      53             :                                                            statemachine_context,
      54             :                                                            rel_type,
      55             :                                                            &element_info
      56             :                                                          );
      57           0 :     const char *const type_name = (err!=0) ? "" : xmi_element_info_get_name( element_info );
      58           0 :     return type_name;
      59             : }
      60             : 
      61           0 : static inline const char * json_type_name_map_get_diagram_type( const json_type_name_map_t *this_,
      62             :                                                                 data_diagram_type_t diagram_type )
      63             : {
      64             :     const xmi_diagram_info_t *diagram_info;
      65           0 :     const u8_error_t err = xmi_diagram_info_map_get_diagram( &xmi_diagram_info_map_standard,
      66             :                                                              diagram_type,
      67             :                                                              &diagram_info
      68             :                                                            );
      69           0 :     const char *const type_name = (err!=U8_ERROR_NONE) ? "" : xmi_diagram_info_get_name( diagram_info );
      70           0 :     return type_name;
      71             : }
      72             : 
      73           0 : static inline const char * json_type_name_map_get_diagram_tags( const json_type_name_map_t *this_,
      74             :                                                                 data_diagram_flag_t diagram_flag )
      75             : {
      76           0 :     const char * tag_names = "";
      77             : 
      78           0 :     switch( diagram_flag )
      79             :     {
      80           0 :         case DATA_DIAGRAM_FLAG_EMPHASIS:
      81             :         {
      82           0 :             tag_names = "Emphasis";
      83             :         }
      84           0 :         break;
      85             : 
      86           0 :         case DATA_DIAGRAM_FLAG_GRAY_OUT:
      87             :         {
      88           0 :             tag_names = "GrayOut";
      89             :         }
      90           0 :         break;
      91             : 
      92           0 :         default:
      93             :         {
      94           0 :             tag_names = "";
      95             :         }
      96           0 :         break;
      97             :     }
      98             : 
      99           0 :     return tag_names;
     100             : }
     101             : 
     102           0 : static inline const char * json_type_name_map_get_diagramelement_tags( const json_type_name_map_t *this_,
     103             :                                                                        data_diagramelement_flag_t diagramelement_flag )
     104             : {
     105           0 :     const char * tag_names = "";
     106             : 
     107           0 :     switch( (int_fast32_t) diagramelement_flag )
     108             :     {
     109           0 :         case DATA_DIAGRAMELEMENT_FLAG_EMPHASIS:
     110             :         {
     111           0 :             tag_names = "Emphasis";
     112             :         }
     113           0 :         break;
     114             : 
     115           0 :         case DATA_DIAGRAMELEMENT_FLAG_GRAY_OUT:
     116             :         {
     117           0 :             tag_names = "GrayOut";
     118             :         }
     119           0 :         break;
     120             : 
     121           0 :         case DATA_DIAGRAMELEMENT_FLAG_NAMED_INSTANCE:
     122             :         {
     123           0 :             tag_names = "NamedInstance";
     124             :         }
     125           0 :         break;
     126             : 
     127           0 :         case DATA_DIAGRAMELEMENT_FLAG_NAMED_INSTANCE | DATA_DIAGRAMELEMENT_FLAG_EMPHASIS:
     128             :         {
     129           0 :             tag_names = "NamedInstance, Emphasis";
     130             :         }
     131           0 :         break;
     132             : 
     133           0 :         case DATA_DIAGRAMELEMENT_FLAG_NAMED_INSTANCE | DATA_DIAGRAMELEMENT_FLAG_GRAY_OUT:
     134             :         {
     135           0 :             tag_names = "NamedInstance, GrayOut";
     136             :         }
     137           0 :         break;
     138             : 
     139           0 :         case DATA_DIAGRAMELEMENT_FLAG_ANONYMOUS_INSTANCE:
     140             :         {
     141           0 :             tag_names = "AnonymousInstance";
     142             :         }
     143           0 :         break;
     144             : 
     145           0 :         case DATA_DIAGRAMELEMENT_FLAG_ANONYMOUS_INSTANCE | DATA_DIAGRAMELEMENT_FLAG_EMPHASIS:
     146             :         {
     147           0 :             tag_names = "AnonymousInstance, Emphasis";
     148             :         }
     149           0 :         break;
     150             : 
     151           0 :         case DATA_DIAGRAMELEMENT_FLAG_ANONYMOUS_INSTANCE | DATA_DIAGRAMELEMENT_FLAG_GRAY_OUT:
     152             :         {
     153           0 :             tag_names = "AnonymousInstance, GrayOut";
     154             :         }
     155           0 :         break;
     156             : 
     157           0 :         default:
     158             :         {
     159           0 :             tag_names = "";
     160             :         }
     161           0 :         break;
     162             :     }
     163             : 
     164           0 :     return tag_names;
     165             : }
     166             : 
     167             : 
     168             : /*
     169             : Copyright 2022-2024 Andreas Warnke
     170             : 
     171             : Licensed under the Apache License, Version 2.0 (the "License");
     172             : you may not use this file except in compliance with the License.
     173             : You may obtain a copy of the License at
     174             : 
     175             :     http://www.apache.org/licenses/LICENSE-2.0
     176             : 
     177             : Unless required by applicable law or agreed to in writing, software
     178             : distributed under the License is distributed on an "AS IS" BASIS,
     179             : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     180             : See the License for the specific language governing permissions and
     181             : limitations under the License.
     182             : */

Generated by: LCOV version 1.16