LCOV - code coverage report
Current view: top level - io/source/xmi - xmi_atom_writer.c (source / functions) Coverage Total Hit
Test: crystal-facet-uml_v1.63.2_covts Lines: 0.0 % 319 0
Test Date: 2025-05-01 10:10:14 Functions: 0.0 % 13 0

            Line data    Source code
       1              : /* File: xmi_atom_writer.c; Copyright and License: see below */
       2              : 
       3              : #include "xmi/xmi_atom_writer.h"
       4              : #include "xmi/xmi_element_info.h"
       5              : #include "xmi/xmi_element_info_map.h"
       6              : #include "xmi/xmi_xml.h"
       7              : #include "utf8stringbuf/utf8string.h"
       8              : #include "entity/data_id.h"
       9              : #include "u8/u8_trace.h"
      10              : #include "u8/u8_log.h"
      11              : #include <stdbool.h>
      12              : #include <assert.h>
      13              : 
      14              : /* spec-ref: https://www.omg.org/spec/UML/2.5.1/PDF chapter 7.8.6.4 */
      15              : static const char XMI2_UML_OWNED_COMMENT_START[]
      16              :     = "\n<ownedComment ";
      17              : /* spec-ref: https://www.omg.org/spec/UML/2.5.1/PDF chapter 7.8.6.4 */
      18              : static const char XMI2_UML_OWNED_COMMENT_MIDDLE[]
      19              :     = ">";
      20              : /* spec-ref: https://www.omg.org/spec/UML/2.5.1/PDF chapter 7.8.6.4 */
      21              : static const char XMI2_UML_OWNED_COMMENT_END[]
      22              :     = "\n</ownedComment>";
      23              : 
      24              : /* spec-ref: https://www.omg.org/spec/UML/2.5.1/PDF chapter 7.8.2 */
      25              : static const char XMI2_UML_COMMENT_BODY_START[]
      26              :     = "\n<body>";
      27              : static const char XMI2_UML_COMMENT_BODY_END[]
      28              :     = "\n</body>";
      29              : /* spec-ref: https://www.omg.org/spec/UML/2.5.1/PDF chapter 7.9.2 */
      30              : static const char XMI2_UML_ANNOTATED_ELEMENT_START[]
      31              :     = "\n<annotatedElement ";
      32              : static const char XMI2_UML_ANNOTATED_ELEMENT_END[]
      33              :     = "/>";
      34              : 
      35              : static const char XMI2_COMMENT_TYPE[]
      36              :     = "Comment";
      37              : 
      38            0 : void xmi_atom_writer_init ( xmi_atom_writer_t *this_,
      39              :                             io_xml_writer_t *out_writer )
      40              : {
      41            0 :     U8_TRACE_BEGIN();
      42            0 :     assert( NULL != out_writer );
      43              : 
      44            0 :     (*this_).xml_writer = out_writer;
      45              : 
      46            0 :     U8_TRACE_END();
      47            0 : }
      48              : 
      49            0 : void xmi_atom_writer_destroy( xmi_atom_writer_t *this_ )
      50              : {
      51            0 :     U8_TRACE_BEGIN();
      52              : 
      53            0 :     U8_TRACE_END();
      54            0 : }
      55              : 
      56            0 : u8_error_t xmi_atom_writer_write_xmi_comment( xmi_atom_writer_t *this_,
      57              :                                               data_id_t element_id,
      58              :                                               const char *comment_type,
      59              :                                               const char *comment )
      60              : {
      61            0 :     U8_TRACE_BEGIN();
      62            0 :     assert( NULL != comment_type );
      63            0 :     assert( NULL != comment );
      64            0 :     u8_error_t export_err = U8_ERROR_NONE;
      65              : 
      66            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI2_UML_OWNED_COMMENT_START );
      67              : 
      68            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI_XML_ATTR_TYPE_START );
      69            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI_XML_NS_UML );
      70            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI2_COMMENT_TYPE );
      71            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI_XML_ATTR_TYPE_END );
      72              : 
      73            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI_XML_ATTR_ID_START );
      74            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, element_id );
      75            0 :     export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, "#" );
      76            0 :     export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, comment_type );
      77            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI_XML_ATTR_ID_END );
      78              : 
      79            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI2_UML_OWNED_COMMENT_MIDDLE );
      80            0 :     io_xml_writer_increase_indent ( (*this_).xml_writer );
      81              : 
      82            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI2_UML_COMMENT_BODY_START );
      83            0 :     io_xml_writer_increase_indent ( (*this_).xml_writer );
      84              : 
      85            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, IO_XML_WRITER_NL );
      86            0 :     export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, comment );
      87              : 
      88            0 :     io_xml_writer_decrease_indent ( (*this_).xml_writer );
      89            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI2_UML_COMMENT_BODY_END );
      90              : 
      91              :     /* TODO: annotatedElement is not mandatory - refers to explicitly drawn relationships */
      92            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI2_UML_ANNOTATED_ELEMENT_START );
      93            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI_XML_ATTR_IDREF_START );
      94            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, element_id );
      95            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI_XML_ATTR_IDREF_END );
      96            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI2_UML_ANNOTATED_ELEMENT_END );
      97              : 
      98            0 :     io_xml_writer_decrease_indent ( (*this_).xml_writer );
      99            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, XMI2_UML_OWNED_COMMENT_END );
     100              : 
     101            0 :     U8_TRACE_END_ERR( export_err );
     102            0 :     return export_err;
     103              : }
     104              : 
     105            0 : u8_error_t xmi_atom_writer_encode_xmi_id( xmi_atom_writer_t *this_, data_id_t element_id )
     106              : {
     107            0 :     U8_TRACE_BEGIN();
     108            0 :     u8_error_t export_err = U8_ERROR_NONE;
     109              : 
     110            0 :     switch ( data_id_get_table(&element_id) )
     111              :     {
     112            0 :         case DATA_TABLE_VOID:
     113              :         {
     114            0 :             U8_LOG_WARNING( "invalid data_id_t at xmi_atom_writer_encode_xmi_id." ); /* "1" is reserved for profiles */
     115            0 :             export_err |= U8_ERROR_PARAM_MISSING;
     116              :         }
     117            0 :         break;
     118              : 
     119            0 :         case DATA_TABLE_CLASSIFIER:
     120              :         {
     121              : 
     122            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "6" /* instead of C */ );
     123              :         }
     124            0 :         break;
     125              : 
     126            0 :         case DATA_TABLE_FEATURE:
     127              :         {
     128            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "4" /* instead of F */ );
     129              :         }
     130            0 :         break;
     131              : 
     132            0 :         case DATA_TABLE_RELATIONSHIP:
     133              :         {
     134            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "8" /* instead of R */ );
     135              :         }
     136            0 :         break;
     137              : 
     138            0 :         case DATA_TABLE_DIAGRAMELEMENT:
     139              :         {
     140            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "3" /* instead of E */ );
     141              :         }
     142            0 :         break;
     143              : 
     144            0 :         case DATA_TABLE_DIAGRAM:
     145              :         {
     146            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "9" /* instead of D */ );
     147              :         }
     148            0 :         break;
     149              : 
     150            0 :         default:
     151              :         {
     152            0 :             U8_LOG_ERROR( "unknown data_id_t at xmi_atom_writer_encode_xmi_id." );
     153              :         }
     154            0 :         break;
     155              :     }
     156              : 
     157            0 :     if ( data_id_get_table(&element_id) != DATA_TABLE_VOID )
     158              :     {
     159            0 :         if ( 100 > data_id_get_row_id(&element_id) )
     160              :         {
     161            0 :             if ( 10 > data_id_get_row_id(&element_id) )
     162              :             {
     163            0 :                 if ( 0 <= data_id_get_row_id(&element_id) )
     164              :                 {
     165            0 :                     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "000" );
     166              :                 }
     167              :                 else
     168              :                 {
     169              :                     /* row_id is negative */
     170              :                 }
     171              :             }
     172              :             else
     173              :             {
     174            0 :                 export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "00" );
     175              :             }
     176              :         }
     177              :         else
     178              :         {
     179            0 :             if ( 1000 > data_id_get_row_id(&element_id) )
     180              :             {
     181            0 :                 export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "0" );
     182              :             }
     183              :             else
     184              :             {
     185              :                 /* row_id is greater than 1000 */
     186              :             }
     187              :         }
     188            0 :         export_err |= io_xml_writer_write_int ( (*this_).xml_writer, data_id_get_row_id(&element_id) );
     189              :     }
     190              : 
     191            0 :     U8_TRACE_END_ERR( export_err );
     192            0 :     return export_err;
     193              : }
     194              : 
     195            0 : u8_error_t xmi_atom_writer_report_unknown_classifier( xmi_atom_writer_t *this_,
     196              :                                                       data_id_t fact_classifier_id,
     197              :                                                       data_classifier_type_t fact_classifier_type )
     198              : {
     199            0 :     U8_TRACE_BEGIN();
     200            0 :     u8_error_t export_err = U8_ERROR_NONE;
     201              : 
     202            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- STATUS:      " );
     203            0 :     export_err |= io_xml_writer_write_plain_id( (*this_).xml_writer, fact_classifier_id );
     204            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (aka " );
     205            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, fact_classifier_id );
     206            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ") has type " );
     207            0 :     export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_classifier_type );
     208            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " which is unknown to this program version " );
     209            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     210              : 
     211            0 :     U8_TRACE_END_ERR( export_err );
     212            0 :     return export_err;
     213              : }
     214              : 
     215            0 : u8_error_t xmi_atom_writer_report_unknown_feature( xmi_atom_writer_t *this_,
     216              :                                                    data_id_t fact_feature_id,
     217              :                                                    data_feature_type_t fact_feature_type )
     218              : {
     219            0 :     U8_TRACE_BEGIN();
     220            0 :     u8_error_t export_err = U8_ERROR_NONE;
     221              : 
     222            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- STATUS:      " );
     223            0 :     export_err |= io_xml_writer_write_plain_id( (*this_).xml_writer, fact_feature_id );
     224            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (aka " );
     225            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, fact_feature_id );
     226            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ") has type " );
     227            0 :     export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_feature_type );
     228            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " which is unknown to this program version " );
     229            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     230              : 
     231            0 :     U8_TRACE_END_ERR( export_err );
     232            0 :     return export_err;
     233              : }
     234              : 
     235            0 : u8_error_t xmi_atom_writer_report_unknown_relationship( xmi_atom_writer_t *this_,
     236              :                                                         data_id_t fact_relationship_id,
     237              :                                                         data_relationship_type_t fact_relationship_type )
     238              : {
     239            0 :     U8_TRACE_BEGIN();
     240            0 :     u8_error_t export_err = U8_ERROR_NONE;
     241              : 
     242            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- STATUS:      " );
     243            0 :     export_err |= io_xml_writer_write_plain_id( (*this_).xml_writer, fact_relationship_id );
     244            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (aka " );
     245            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, fact_relationship_id );
     246            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ") has type " );
     247            0 :     export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_relationship_type );
     248            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " which is unknown to this program version " );
     249            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     250              : 
     251            0 :     U8_TRACE_END_ERR( export_err );
     252            0 :     return export_err;
     253              : }
     254              : 
     255            0 : u8_error_t xmi_atom_writer_report_illegal_container( xmi_atom_writer_t *this_,
     256              :                                                      data_id_t fact_classifier_id,
     257              :                                                      data_classifier_type_t fact_classifier_type,
     258              :                                                      data_classifier_type_t fact_parent_type )
     259              : {
     260            0 :     U8_TRACE_BEGIN();
     261            0 :     u8_error_t export_err = U8_ERROR_NONE;
     262              : 
     263              :     const xmi_element_info_t *parent_info;
     264            0 :     u8_error_t map_err = xmi_element_info_map_get_classifier( &xmi_element_info_map_standard,
     265              :                                                               DATA_CLASSIFIER_TYPE_PACKAGE, /*guess, only used for an error message */
     266              :                                                               fact_parent_type,
     267              :                                                               &parent_info
     268              :                                                             );
     269            0 :     if ( map_err != 0 )
     270              :     {
     271            0 :         U8_LOG_WARNING("xmi_element_info_map_get_classifier could not map DATA_CLASSIFIER_TYPE_PACKAGE");
     272              :     }
     273              :     const xmi_element_info_t *classifier_info;
     274            0 :     map_err = xmi_element_info_map_get_classifier( &xmi_element_info_map_standard,
     275              :                                                    fact_parent_type,
     276              :                                                    fact_classifier_type,
     277              :                                                    &classifier_info
     278              :                                                  );
     279            0 :     if ( map_err != 0 )
     280              :     {
     281            0 :         U8_LOG_WARNING_INT("xmi_element_info_map_get_classifier could not map type", fact_classifier_type );
     282              :     }
     283              : 
     284            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- STATUS:      " );
     285            0 :     export_err |= io_xml_writer_write_plain_id( (*this_).xml_writer, fact_classifier_id );
     286            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (aka " );
     287            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, fact_classifier_id );
     288            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ") of type " );
     289            0 :     export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_classifier_type );
     290            0 :     if ( classifier_info != NULL )
     291              :     {
     292            0 :         const char * classifier_type_name = xmi_element_info_get_name ( classifier_info );
     293            0 :         if ( classifier_type_name != NULL )
     294              :         {
     295            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (" );
     296            0 :             export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, classifier_type_name );
     297            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ")" );
     298              :         }
     299              :     }
     300            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " is nested in a container of type " );
     301            0 :     export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_parent_type );
     302            0 :     if ( parent_info != NULL )
     303              :     {
     304            0 :         const char * parent_type_name = xmi_element_info_get_name ( parent_info );
     305            0 :         if ( parent_type_name != NULL )
     306              :         {
     307            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (" );
     308            0 :             export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, parent_type_name );
     309            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ")" );
     310              :         }
     311              :     }
     312            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     313              : 
     314            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- CONFORMANCE: " );
     315            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Unsuitable nested type to container type" );
     316            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     317              : 
     318            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- PROPOSAL:    " );
     319            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Pack the nested element into a suitable container or change its type" );
     320            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     321              : 
     322            0 :     U8_TRACE_END_ERR( export_err );
     323            0 :     return export_err;
     324              : }
     325              : 
     326            0 : u8_error_t xmi_atom_writer_report_illegal_stereotype( xmi_atom_writer_t *this_,
     327              :                                                       data_id_t element_id,
     328              :                                                       const utf8stringview_t *stereotype )
     329              : {
     330            0 :     U8_TRACE_BEGIN();
     331            0 :     assert( stereotype != NULL );
     332            0 :     u8_error_t export_err = U8_ERROR_NONE;
     333              : 
     334            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- STATUS:      " );
     335            0 :     export_err |= io_xml_writer_write_plain_id( (*this_).xml_writer, element_id );
     336            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (aka " );
     337            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, element_id );
     338            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ") has stereotype " );
     339            0 :     export_err |= io_xml_writer_write_xml_comment_view( (*this_).xml_writer, stereotype );
     340            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     341              : 
     342            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- CONFORMANCE: " );
     343            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Stereotype unsuitable as xml tag name" );
     344            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     345              : 
     346            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- PROPOSAL:    " );
     347            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Change the name of the stereotype" );
     348            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     349              : 
     350            0 :     U8_TRACE_END_ERR( export_err );
     351            0 :     return export_err;
     352              : }
     353              : 
     354            0 : u8_error_t xmi_atom_writer_report_illegal_datatype( xmi_atom_writer_t *this_,
     355              :                                                     data_id_t feature_id,
     356              :                                                     const char * datatype )
     357              : {
     358            0 :     U8_TRACE_BEGIN();
     359            0 :     u8_error_t export_err = U8_ERROR_NONE;
     360              : 
     361            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- STATUS:      " );
     362            0 :     export_err |= io_xml_writer_write_plain_id( (*this_).xml_writer, feature_id );
     363            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (aka " );
     364            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, feature_id );
     365            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ") has valuetype/datatype " );
     366            0 :     export_err |= io_xml_writer_write_xml_comment( (*this_).xml_writer, datatype );
     367            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     368              : 
     369            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- CONFORMANCE: " );
     370            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Feature is not a TypedElement" );
     371            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     372              : 
     373            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- PROPOSAL:    " );
     374            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Clear the valuetype/datatype or change the type of the feature" );
     375            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     376              : 
     377            0 :     U8_TRACE_END_ERR( export_err );
     378            0 :     return export_err;
     379              : }
     380              : 
     381            0 : u8_error_t xmi_atom_writer_report_illegal_parent( xmi_atom_writer_t *this_,
     382              :                                                   data_id_t fact_feature_id,
     383              :                                                   data_feature_type_t fact_feature_type,
     384              :                                                   data_classifier_type_t fact_parent_type )
     385              : {
     386            0 :     U8_TRACE_BEGIN();
     387            0 :     u8_error_t export_err = U8_ERROR_NONE;
     388              : 
     389              :     const xmi_element_info_t *parent_info;
     390            0 :     u8_error_t map_err = xmi_element_info_map_get_classifier( &xmi_element_info_map_standard,
     391              :                                                               DATA_CLASSIFIER_TYPE_PACKAGE, /*guess, only used for an error message */
     392              :                                                               fact_parent_type,
     393              :                                                               &parent_info
     394              :                                                             );
     395            0 :     if ( map_err != 0 )
     396              :     {
     397            0 :         U8_LOG_WARNING("xmi_element_info_map_get_classifier could not map DATA_CLASSIFIER_TYPE_PACKAGE");
     398              :     }
     399              :     const xmi_element_info_t *feature_info;
     400            0 :     map_err = xmi_element_info_map_get_feature( &xmi_element_info_map_standard,
     401              :                                                 fact_parent_type,
     402              :                                                 fact_feature_type,
     403              :                                                 &feature_info
     404              :                                               );
     405            0 :     if ( map_err != 0 )
     406              :     {
     407            0 :         U8_LOG_WARNING_INT("xmi_element_info_map_get_feature could not map type", fact_feature_type );
     408              :     }
     409              : 
     410            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- STATUS:      " );
     411            0 :     export_err |= io_xml_writer_write_plain_id( (*this_).xml_writer, fact_feature_id );
     412            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (aka " );
     413            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, fact_feature_id );
     414            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ") of type " );
     415            0 :     export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_feature_type );
     416            0 :     if ( feature_info != NULL )
     417              :     {
     418            0 :         const char * feature_type_name = xmi_element_info_get_name ( feature_info );
     419            0 :         if ( feature_type_name != NULL )
     420              :         {
     421            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (" );
     422            0 :             export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, feature_type_name );
     423            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ")" );
     424              :         }
     425              :     }
     426            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " is child to classifier of type " );
     427            0 :     export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_parent_type );
     428            0 :     if ( parent_info != NULL )
     429              :     {
     430            0 :         const char * parent_type_name = xmi_element_info_get_name ( parent_info );
     431            0 :         if ( parent_type_name != NULL )
     432              :         {
     433            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (" );
     434            0 :             export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, parent_type_name );
     435            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ")" );
     436              :         }
     437              :     }
     438            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     439              : 
     440            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- CONFORMANCE: " );
     441            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Unsuitable child type to parent type" );
     442            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     443              : 
     444            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- PROPOSAL:    " );
     445            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Change the type of the child feature or the parent element" );
     446            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     447              : 
     448            0 :     U8_TRACE_END_ERR( export_err );
     449            0 :     return export_err;
     450              : }
     451              : 
     452            0 : u8_error_t xmi_atom_writer_report_illegal_location( xmi_atom_writer_t *this_,
     453              :                                                     data_id_t fact_relationship_id,
     454              :                                                     data_relationship_type_t fact_relationship_type,
     455              :                                                     data_classifier_type_t fact_hosting_type
     456              :                                                   )
     457              : {
     458            0 :     U8_TRACE_BEGIN();
     459            0 :     u8_error_t export_err = U8_ERROR_NONE;
     460              : 
     461              :     const xmi_element_info_t *host_info;
     462            0 :     u8_error_t map_err = xmi_element_info_map_get_classifier( &xmi_element_info_map_standard,
     463              :                                                               DATA_CLASSIFIER_TYPE_PACKAGE, /*guess, only used for an error message */
     464              :                                                               fact_hosting_type,
     465              :                                                               &host_info
     466              :                                                             );
     467            0 :     if ( map_err != 0 )
     468              :     {
     469            0 :         U8_LOG_WARNING("xmi_element_info_map_get_classifier could not map DATA_CLASSIFIER_TYPE_PACKAGE");
     470              :     }
     471              :     const xmi_element_info_t *relation_info;
     472            0 :     map_err = xmi_element_info_map_get_relationship( &xmi_element_info_map_standard,
     473              :                                                      (fact_hosting_type==DATA_CLASSIFIER_TYPE_STATE),
     474              :                                                      fact_relationship_type,
     475              :                                                      &relation_info
     476              :                                                    );
     477            0 :     if ( map_err != 0 )
     478              :     {
     479            0 :         U8_LOG_WARNING_INT("xmi_element_info_map_get_relationship could not map type", fact_relationship_type );
     480              :     }
     481              : 
     482            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- STATUS:      " );
     483            0 :     export_err |= io_xml_writer_write_plain_id( (*this_).xml_writer, fact_relationship_id );
     484            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (aka " );
     485            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, fact_relationship_id );
     486            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ") of type " );
     487            0 :     export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_relationship_type );
     488            0 :     if ( relation_info != NULL )
     489              :     {
     490            0 :         const char * relationship_type_name = xmi_element_info_get_name ( relation_info );
     491            0 :         if ( relationship_type_name != NULL )
     492              :         {
     493            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (" );
     494            0 :             export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, relationship_type_name );
     495            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ")" );
     496              :         }
     497              :     }
     498            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " is located in classifier of type " );
     499            0 :     export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_hosting_type );
     500            0 :     if ( host_info != NULL )
     501              :     {
     502            0 :         const char * parent_type_name = xmi_element_info_get_name ( host_info );
     503            0 :         if ( parent_type_name != NULL )
     504              :         {
     505            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (" );
     506            0 :             export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, parent_type_name );
     507            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ")" );
     508              :         }
     509              :     }
     510            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     511              : 
     512            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- CONFORMANCE: " );
     513            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Unsuitable relationship type to hosting location type" );
     514            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     515              : 
     516            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- PROPOSAL:    " );
     517            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Change the type of the relationship" );
     518            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     519              : 
     520            0 :     U8_TRACE_END_ERR( export_err );
     521            0 :     return export_err;
     522              : }
     523              : 
     524            0 : u8_error_t xmi_atom_writer_report_illegal_relationship_end ( xmi_atom_writer_t *this_,
     525              :                                                              data_id_t fact_relationship_id,
     526              :                                                              data_relationship_type_t fact_relationship_type,
     527              :                                                              data_classifier_type_t fact_hosting_type,
     528              :                                                              bool fact_from_end,
     529              :                                                              data_classifier_type_t fact_end_classifier_type,
     530              :                                                              data_feature_type_t fact_end_feature_type )
     531              : {
     532            0 :     U8_TRACE_BEGIN();
     533            0 :     u8_error_t export_err = U8_ERROR_NONE;
     534              : 
     535              :     const xmi_element_info_t *relation_info;
     536            0 :     u8_error_t map_err = xmi_element_info_map_get_relationship( &xmi_element_info_map_standard,
     537              :                                                                 (fact_hosting_type==DATA_CLASSIFIER_TYPE_STATE),
     538              :                                                                 fact_relationship_type,
     539              :                                                                 &relation_info
     540              :                                                               );
     541            0 :     if ( map_err != 0 )
     542              :     {
     543            0 :         U8_LOG_WARNING_INT("xmi_element_info_map_get_relationship could not map type", fact_relationship_type );
     544              :     }
     545              : 
     546            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- STATUS:      " );
     547            0 :     export_err |= io_xml_writer_write_plain_id( (*this_).xml_writer, fact_relationship_id );
     548            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (aka " );
     549            0 :     export_err |= xmi_atom_writer_encode_xmi_id( this_, fact_relationship_id );
     550            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ") of type " );
     551            0 :     export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_relationship_type );
     552            0 :     if ( relation_info != NULL )
     553              :     {
     554            0 :         const char * relationship_type_name = xmi_element_info_get_name ( relation_info );
     555            0 :         if ( relationship_type_name != NULL )
     556              :         {
     557            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (" );
     558            0 :             export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, relationship_type_name );
     559            0 :             export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ")" );
     560              :         }
     561              :     }
     562            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, fact_from_end
     563              :                                                                 ? " has source of type "
     564              :                                                                 : " has target of type " );
     565            0 :     if ( fact_end_feature_type == DATA_FEATURE_TYPE_VOID )
     566              :     {
     567            0 :         export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_end_classifier_type );
     568              : 
     569              :         const xmi_element_info_t *classifier_info;
     570            0 :         u8_error_t map_err = xmi_element_info_map_get_classifier( &xmi_element_info_map_standard,
     571              :                                                                   fact_hosting_type,
     572              :                                                                   fact_end_classifier_type,
     573              :                                                                   &classifier_info
     574              :                                                                 );
     575            0 :         if ( map_err != 0 )
     576              :         {
     577            0 :             U8_LOG_WARNING_INT("xmi_element_info_map_get_classifier could not map type", fact_end_classifier_type );
     578              :         }
     579            0 :         if ( classifier_info != NULL )
     580              :         {
     581            0 :             const char * end_type_name = xmi_element_info_get_name ( classifier_info );
     582            0 :             if ( end_type_name != NULL )
     583              :             {
     584            0 :                 export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (" );
     585            0 :                 export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, end_type_name );
     586            0 :                 export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ")" );
     587              :             }
     588              :         }
     589              :     }
     590              :     else
     591              :     {
     592            0 :         export_err |= io_xml_writer_write_int ( (*this_).xml_writer, (int64_t)fact_end_feature_type );
     593              : 
     594              :         const xmi_element_info_t *feature_info;
     595            0 :         u8_error_t map_err = xmi_element_info_map_get_feature( &xmi_element_info_map_standard,
     596              :                                                                fact_end_classifier_type,
     597              :                                                                fact_end_feature_type,
     598              :                                                                &feature_info
     599              :                                                              );
     600            0 :         if ( map_err != 0 )
     601              :         {
     602            0 :             U8_LOG_WARNING_INT("xmi_element_info_map_get_feature could not map type", fact_end_feature_type );
     603              :         }
     604            0 :         if ( feature_info != NULL )
     605              :         {
     606            0 :             const char * end_type_name = xmi_element_info_get_name ( feature_info );
     607            0 :             if ( end_type_name != NULL )
     608              :             {
     609            0 :                 export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " (" );
     610            0 :                 export_err |= io_xml_writer_write_xml_enc ( (*this_).xml_writer, end_type_name );
     611            0 :                 export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, ")" );
     612              :             }
     613              :         }
     614              :     }
     615            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     616              : 
     617            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- CONFORMANCE: " );
     618            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Unsuitable relationship type connecting to " );
     619            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, fact_from_end
     620              :                                                                  ? "source end type"
     621              :                                                                  : "target end type" );
     622            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     623              : 
     624            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, "\n<!-- PROPOSAL:    " );
     625            0 :     export_err |= io_xml_writer_write_xml_enc( (*this_).xml_writer, "Change the type of the relationship" );
     626            0 :     export_err |= io_xml_writer_write_plain ( (*this_).xml_writer, " -->" );
     627              : 
     628            0 :     U8_TRACE_END_ERR( export_err );
     629            0 :     return export_err;
     630              : }
     631              : 
     632              : 
     633              : /*
     634              : Copyright 2020-2025 Andreas Warnke
     635              : 
     636              : Licensed under the Apache License, Version 2.0 (the "License");
     637              : you may not use this file except in compliance with the License.
     638              : You may obtain a copy of the License at
     639              : 
     640              :     http://www.apache.org/licenses/LICENSE-2.0
     641              : 
     642              : Unless required by applicable law or agreed to in writing, software
     643              : distributed under the License is distributed on an "AS IS" BASIS,
     644              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     645              : See the License for the specific language governing permissions and
     646              : limitations under the License.
     647              : */
        

Generated by: LCOV version 2.0-1