LCOV - code coverage report
Current view: top level - io/source/document - document_element_writer.c (source / functions) Hit Total Coverage
Test: crystal-facet-uml_v1.65.6_covts Lines: 0 808 0.0 %
Date: 2025-09-25 21:07:53 Functions: 0 31 0.0 %

          Line data    Source code
       1             : /* File: document_element_writer.c; Copyright and License: see below */
       2             : 
       3             : #include "document/document_element_writer.h"
       4             : #include "utf8stringbuf/utf8string.h"
       5             : #include "entity/data_id.h"
       6             : #include "u8/u8_trace.h"
       7             : #include "u8/u8_log.h"
       8             : #include <stdio.h>
       9             : #include <stdbool.h>
      10             : #include <assert.h>
      11             : 
      12             : /* GENERAL STRUCTURE */
      13             : 
      14             : /*
      15             :  *    <THING>_START
      16             :  *    <THING>_MIDDLE            #optional, if dynamic content needs to be added to the start
      17             :  *    <THING>_TITLE_START       #alternative to TITLE: NAME
      18             :  *    <THING>_TITLE_END         #alternative to TITLE: NAME
      19             :  *    ...                       #optional text
      20             :  *    <THING>_<OTHERSUB>_START  #optional if there ore other sub-things
      21             :  *    <THING>_<OTHERSUB>_END    #optional if there ore other sub-things
      22             :  *    <THING>_END
      23             :  */
      24             : 
      25             : /* IO_FILE_FORMAT_DOCBOOK */
      26             : 
      27             : #define DOCUMENT_ELEMENT_WRITER_LEFT_POINTING_GUILLEMENTS "\xc2\xab"
      28             : #define DOCUMENT_ELEMENT_WRITER_RIGHT_POINTING_GUILLEMENTS "\xc2\xbb"
      29             : 
      30             : static const char DOCBOOK_ENC[]
      31             :     = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
      32             : static const char DOCBOOK_DOC_START[]
      33             :     = "\n<book xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\" xml:lang=\"en\">";
      34             : static const char DOCBOOK_DOC_TITLE_START[]
      35             :     = "\n<title>";
      36             : static const char DOCBOOK_DOC_TITLE_END[]
      37             :     = "</title>";
      38             : static const char DOCBOOK_DOC_END[]
      39             :     = "\n</book>\n";
      40             : 
      41             : static const char DOCBOOK_TOP_DIAGRAM_START[]
      42             :     = "\n<chapter xml:id=\"";
      43             : static const char DOCBOOK_TOP_DIAGRAM_MIDDLE[]
      44             :     = "\">";
      45             : static const char DOCBOOK_TOP_DIAGRAM_END[]
      46             :     = "\n</chapter>";
      47             : static const char DOCBOOK_DIAGRAM_START[]
      48             :     = "\n<section xml:id=\"";
      49             : static const char DOCBOOK_DIAGRAM_MIDDLE[]
      50             :     = "\">";
      51             : static const char DOCBOOK_DIAGRAM_TITLE_START[]
      52             :     = "\n<title>";
      53             : static const char DOCBOOK_DIAGRAM_TITLE_END[]
      54             :     = "</title>";
      55             : static const char DOCBOOK_DIAGRAM_IMG_START[]
      56             :     = "\n<para>"
      57             :       "\n    <mediaobject>"
      58             :       "\n        <imageobject><imagedata fileref=\"";
      59             : static const char DOCBOOK_DIAGRAM_IMG_MIDDLE[]
      60             :     = ".pdf\" width=\"12cm\"/></imageobject>"
      61             :       "\n        <imageobject><imagedata fileref=\"";
      62             : static const char DOCBOOK_DIAGRAM_IMG_END[]
      63             :     = ".png\"/></imageobject>"
      64             :       "\n    </mediaobject>"
      65             :       "\n</para>";
      66             : static const char DOCBOOK_DIAGRAM_END[]
      67             :     = "\n</section>";
      68             : 
      69             : static const char DOCBOOK_DESCRIPTION_START[]
      70             :     = "\n<para>";
      71             : static const char DOCBOOK_DESCRIPTION_MIDDLE[]  /* optional */
      72             :     = "\n</para>"
      73             :       "\n<para>";
      74             : static const char DOCBOOK_DESCRIPTION_XREF_START[]
      75             :     = "<xref linkend=\"";
      76             : static const char DOCBOOK_DESCRIPTION_XREF_MIDDLE[]
      77             :     = "\"/>: ";
      78             : static const char DOCBOOK_DESCRIPTION_XREF_END[]
      79             :     = "";
      80             : static const char DOCBOOK_DESCRIPTION_END[]
      81             :     = "\n</para>";
      82             : 
      83             : static const char DOCBOOK_ELEMENT_LIST_START[]
      84             :     = "\n<variablelist>";
      85             : static const char DOCBOOK_ELEMENT_START[]
      86             :     = "\n<varlistentry>";
      87             : static const char DOCBOOK_ELEMENT_NAME_START[]
      88             :     = "\n<term>";
      89             : static const char DOCBOOK_ELEMENT_NAME_END[]
      90             :     = "</term>"
      91             :       "\n<listitem>";
      92             : static const char DOCBOOK_ELEMENT_ATTRIBUTES_START[]
      93             :     = "\n<para>";
      94             : static const char DOCBOOK_ELEMENT_STEREO_START[]
      95             :     = "\n" DOCUMENT_ELEMENT_WRITER_LEFT_POINTING_GUILLEMENTS;
      96             : static const char DOCBOOK_ELEMENT_STEREO_END[]
      97             :     = DOCUMENT_ELEMENT_WRITER_RIGHT_POINTING_GUILLEMENTS;
      98             : static const char DOCBOOK_ELEMENT_ID_START[]
      99             :     = "\n<token>";
     100             : static const char DOCBOOK_ELEMENT_ID_END[]
     101             :     = "</token>";
     102             : static const char DOCBOOK_ELEMENT_SEE_START[] = "\n<emphasis>(appears in ";
     103             : static const char DOCBOOK_ELEMENT_SEE_NEXT[] = ",\n";
     104             : static const char DOCBOOK_ELEMENT_SEE_END[] = ")\n</emphasis>";
     105             : static const char DOCBOOK_ELEMENT_ATTRIBUTES_END[]
     106             :     = "\n</para>";
     107             : static const char DOCBOOK_ELEMENT_DESCR_START[]  /* optional */
     108             :     = "\n<para>";
     109             : static const char DOCBOOK_ELEMENT_DESCR_END[]  /* optional */
     110             :     = "\n</para>";
     111             : static const char DOCBOOK_ELEMENT_END[]
     112             :     = "\n    </listitem>"
     113             :       "\n</varlistentry>";
     114             : static const char DOCBOOK_ELEMENT_LIST_END[]
     115             :     = "\n</variablelist>";
     116             : 
     117             : /* IO_FILE_FORMAT_HTML */
     118             : 
     119             : enum HTML_DIAGRAM_MAX { HTML_DIAGRAM_MAX_DEPTH = 6, };
     120             : static const char HTML_DTD[]
     121             :     = "<!DOCTYPE html>";
     122             : static const char HTML_DOC_START[]
     123             :     = "\n<html>";
     124             : static const char HTML_HEAD_START[]
     125             :     = "\n<head>"
     126             :       "\n    <meta charset=\"UTF-8\" />";
     127             :       /* "\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"; < old */
     128             : static const char HTML_HEAD_TITLE_START[]
     129             :     = "\n<title>";
     130             : static const char HTML_HEAD_TITLE_END[]
     131             :     = "</title>";
     132             : static const char HTML_HEAD_CSS_START[]
     133             :     = "\n<link rel=\"stylesheet\" type=\"text/css\" href=\"";
     134             : static const char HTML_HEAD_CSS_END[]
     135             :     = ".css\" />";
     136             : static const char HTML_HEAD_END[]
     137             :     = "\n</head>";
     138             : static const char HTML_BODY_START[]
     139             :     = "\n<body>";
     140             : static const char HTML_HEADER[]
     141             :     = "\n<header></header>";
     142             : static const char HTML_NAV_START[]
     143             :     = "\n<nav>";
     144             : static const char HTML_NAV_END[]
     145             :     = "\n</nav>";
     146             : static const char HTML_ARTICLE_START[]
     147             :     = "\n<main>"
     148             :       "\n<article>";
     149             : static const char HTML_ARTICLE_END[]
     150             :     = "\n</article>"
     151             :       "\n</main>";
     152             : static const char HTML_FOOTER[]
     153             :     = "\n<footer></footer>";
     154             : static const char HTML_BODY_END[]
     155             :     = "\n</body>";
     156             : static const char HTML_DOC_END[]
     157             :     = "\n</html>\n";
     158             : static const char HTML_TOC_SUBLIST_START[]
     159             :     = "\n<ul class=\"toc\">";
     160             : static const char *HTML_TOC_SUBLIST_ENTRY_START[HTML_DIAGRAM_MAX_DEPTH]
     161             :     = {
     162             :       "\n<li class=\"toc1\">",
     163             :       "\n<li class=\"toc2\">",
     164             :       "\n<li class=\"toc3\">",
     165             :       "\n<li class=\"toc4\">",
     166             :       "\n<li class=\"toc5\">",
     167             :       "\n<li class=\"toc6\">"
     168             :       };
     169             : static const char HTML_TOC_SUBLIST_ENTRY_TITLE_START[]
     170             :     = "\n<a href=\"#";
     171             : static const char HTML_TOC_SUBLIST_ENTRY_TITLE_MIDDLE[]
     172             :     = "\">";
     173             : static const char HTML_TOC_SUBLIST_ENTRY_TITLE_END[]
     174             :     = "</a>";
     175             : static const char HTML_TOC_SUBLIST_ENTRY_END[]
     176             :     = "\n</li>";
     177             : static const char HTML_TOC_SUBLIST_END[]
     178             :     = "\n</ul>";
     179             : 
     180             : static const char *HTML_DIAGRAM_TITLE_START[HTML_DIAGRAM_MAX_DEPTH]
     181             :     = {
     182             :       "\n\n<h1 id=\"",
     183             :       "\n\n<h2 id=\"",
     184             :       "\n\n<h3 id=\"",
     185             :       "\n\n<h4 id=\"",
     186             :       "\n\n<h5 id=\"",
     187             :       "\n\n<h6 id=\""
     188             :       };
     189             : static const char HTML_DIAGRAM_TITLE_MIDDLE[]
     190             :     = "\" class=\"diag-title\">";
     191             : static const char *HTML_DIAGRAM_TITLE_END[HTML_DIAGRAM_MAX_DEPTH]
     192             :     = {
     193             :       "</h1>",
     194             :       "</h2>",
     195             :       "</h3>",
     196             :       "</h4>",
     197             :       "</h5>",
     198             :       "</h6>"
     199             :       };
     200             : static const char HTML_DIAGRAM_IMG_START[]
     201             :     = "\n<div class=\"mediaobject\"><img src=\"";
     202             : static const char HTML_DIAGRAM_IMG_END[]
     203             :     = ".png\" width=\"840\" alt=\"\" /></div>";
     204             : 
     205             : static const char HTML_ANY_DESCR_NEWLINE[]
     206             :     = "\n<br />\n";
     207             : static const char HTML_ANY_DESCR_XREF_START[]
     208             :     = "<a href=\"#";
     209             : static const char HTML_ANY_DESCR_XREF_MIDDLE[]
     210             :     = "\">";
     211             : static const char HTML_ANY_DESCR_XREF_END[]
     212             :     = "</a>";
     213             : 
     214             : static const char HTML_DIAG_START[] = "\n<div class=\"diag\">";
     215             : static const char HTML_DIAG_HEAD_START[] = "\n<p>";
     216             : static const char HTML_DIAG_NAME_START[] = "\n<strong class=\"diag-name\">";
     217             : static const char HTML_DIAG_NAME_END[] = "</strong>";
     218             : static const char HTML_DIAG_STEREO_START[] = "\n<em class=\"diag-stereo\">";
     219             : static const char HTML_DIAG_STEREO_END[] = "</em>";
     220             : static const char HTML_DIAG_TYPE_START[] = "\n<em class=\"diag-type\">";
     221             : static const char HTML_DIAG_TYPE_END[] = "</em>";
     222             : static const char HTML_DIAG_ID_START[] = "\n<em class=\"diag-id\">";
     223             : static const char HTML_DIAG_ID_END[] = "</em>";
     224             : static const char HTML_DIAG_HEAD_END[] = "\n</p>";
     225             : static const char HTML_DIAG_DESCR_START[] = "\n<p class=\"diag-descr\">\n";
     226             : static const char HTML_DIAG_DESCR_END[] = "\n</p>";
     227             : static const char HTML_DIAG_END[] = "\n</div>";
     228             : 
     229             : static const char HTML_CLAS_START[] = "\n<div class=\"clas\">";
     230             : static const char HTML_CLAS_HEAD_START[] = "\n<p>";
     231             : static const char HTML_CLAS_NAME_START[] = "\n<strong class=\"clas-name\">";
     232             : static const char HTML_CLAS_NAME_END[] = "</strong>";
     233             : static const char HTML_CLAS_STEREO_START[] = "\n<em class=\"clas-stereo\">";
     234             : static const char HTML_CLAS_STEREO_END[] = "</em>";
     235             : static const char HTML_CLAS_TYPE_START[] = "\n<em class=\"clas-type\">";
     236             : static const char HTML_CLAS_TYPE_END[] = "</em>";
     237             : static const char HTML_CLAS_ID_START[] = "\n<em class=\"clas-id\">";
     238             : static const char HTML_CLAS_ID_END[] = "</em>";
     239             : static const char HTML_CLAS_HEAD_END[] = "\n</p>";
     240             : static const char HTML_CLAS_SEE_START[] = "\n<p class=\"clas-see\">\n";
     241             : static const char HTML_CLAS_SEE_NEXT[] = ",\n";
     242             : static const char HTML_CLAS_SEE_END[] = "\n</p>";
     243             : static const char HTML_CLAS_DESCR_START[] = "\n<p class=\"clas-descr\">\n";
     244             : static const char HTML_CLAS_DESCR_END[] = "\n</p>";
     245             : static const char HTML_CLAS_END[] = "\n</div>";
     246             : 
     247             : static const char HTML_FEAT_START[] = "\n<div class=\"feat\">";
     248             : static const char HTML_FEAT_HEAD_START[] = "\n<p>";
     249             : static const char HTML_FEAT_NAME_START[] = "\n<strong class=\"feat-name\">";
     250             : static const char HTML_FEAT_NAME_END[] = "</strong>";
     251             : static const char HTML_FEAT_STEREO_START[] = "\n<em class=\"feat-stereo\">";
     252             : static const char HTML_FEAT_STEREO_END[] = "</em>";
     253             : static const char HTML_FEAT_VALUE_START[] = "\n<em class=\"feat-value\">";
     254             : static const char HTML_FEAT_VALUE_END[] = "</em>";
     255             : static const char HTML_FEAT_TYPE_START[] = "\n<em class=\"feat-type\">";
     256             : static const char HTML_FEAT_TYPE_END[] = "</em>";
     257             : static const char HTML_FEAT_ID_START[] = "\n<em class=\"feat-id\">";
     258             : static const char HTML_FEAT_ID_END[] = "</em>";
     259             : static const char HTML_FEAT_HEAD_END[] = "\n</p>";
     260             : static const char HTML_FEAT_DESCR_START[] = "\n<p class=\"feat-descr\">\n";
     261             : static const char HTML_FEAT_DESCR_END[] = "\n</p>";
     262             : static const char HTML_FEAT_END[] = "\n</div>";
     263             : 
     264             : static const char HTML_REL_START[] = "\n<div class=\"rel\">";
     265             : static const char HTML_REL_HEAD_START[] = "\n<p>";
     266             : static const char HTML_REL_NAME_START[] = "\n<strong class=\"rel-name\">";
     267             : static const char HTML_REL_NAME_END[] = "</strong>";
     268             : static const char HTML_REL_DEST_START[] = "\n<strong class=\"rel-dest\">";
     269             : static const char HTML_REL_DEST_END[] = "</strong>";
     270             : static const char HTML_REL_STEREO_START[] = "\n<em class=\"rel-stereo\">";
     271             : static const char HTML_REL_STEREO_END[] = "</em>";
     272             : static const char HTML_REL_TYPE_START[] = "\n<em class=\"rel-type\">";
     273             : static const char HTML_REL_TYPE_END[] = "</em>";
     274             : static const char HTML_REL_ID_START[] = "\n<em class=\"rel-id\">";
     275             : static const char HTML_REL_ID_END[] = "</em>";
     276             : static const char HTML_REL_HEAD_END[] = "\n</p>";
     277             : static const char HTML_REL_DESCR_START[] = "\n<p class=\"rel-descr\">\n";
     278             : static const char HTML_REL_DESCR_END[] = "\n</p>";
     279             : static const char HTML_REL_END[] = "\n</div>";
     280             : 
     281             : /* IO_FILE_FORMAT_TXT */
     282             : 
     283             : static const int TXT_ID_ALIGN_COLUMN = 80;  /* the alignment column of the id in export mode txt */
     284             : static const char TXT_NEWLINE[] = "\n";
     285             : static const char TXT_NO_INDENT[] = "";
     286             : static const char TXT_FEAT_INDENT[] = "+ ";
     287             : static const char TXT_REL_INDENT[] = "* ";
     288             : static const char TXT_CONTINUE_INDENT[] = "  ";
     289             : static const char TXT_COLON_SPACE[] = ": ";
     290             : static const char TXT_SPACE[] = " ";
     291             : static const char TXT_CODE_START[] = "`";
     292             : static const char TXT_CODE_END[] = "`";
     293             : static const char TXT_DIAG_UNDERLINE = '=';  /* underline character for diagram names */
     294             : static const char TXT_CLAS_UNDERLINE = '-';  /* underline character for classifier names */
     295             : 
     296             : #define io_element_writer_impl_t document_element_writer_t
     297             : /*!
     298             :  *  \brief A struct of function pointers which is the interface of an io_element_writer
     299             :  *
     300             :  *  To avoid typecasts, this struct provides function pointers with the exact right signatures
     301             :  *  provided via io_element_writer_impl_t
     302             :  */
     303             : struct document_element_writer_io_element_writer_if_struct {
     304             : #include "io_element_writer_if.inl"
     305             : };
     306             : #undef io_element_writer_impl_t
     307             : 
     308             : /* the vmt implementing the interface */
     309             : static const struct document_element_writer_io_element_writer_if_struct document_element_writer_private_io_element_writer_if
     310             :     = {
     311             :         .write_header = &document_element_writer_write_header,
     312             :         .start_main = &document_element_writer_start_main,
     313             :         .can_classifier_nest_classifier = &document_element_writer_can_classifier_nest_classifier,
     314             :         .can_classifier_nest_relationship = &document_element_writer_can_classifier_nest_relationship,
     315             :         .start_classifier = &document_element_writer_start_classifier,
     316             :         .assemble_classifier = &document_element_writer_assemble_classifier,
     317             :         .end_classifier = &document_element_writer_end_classifier,
     318             :         .start_feature = &document_element_writer_start_feature,
     319             :         .assemble_feature = &document_element_writer_assemble_feature,
     320             :         .end_feature = &document_element_writer_end_feature,
     321             :         .start_relationship = &document_element_writer_start_relationship,
     322             :         .assemble_relationship = &document_element_writer_assemble_relationship,
     323             :         .end_relationship = &document_element_writer_end_relationship,
     324             :         .start_diagram = &document_element_writer_start_diagram,
     325             :         .assemble_diagram = &document_element_writer_assemble_diagram,
     326             :         .end_diagram = &document_element_writer_end_diagram,
     327             :         .start_diagramelement = &document_element_writer_start_diagramelement,
     328             :         .assemble_diagramelement = &document_element_writer_assemble_diagramelement,
     329             :         .end_diagramelement = &document_element_writer_end_diagramelement,
     330             :         .end_main = &document_element_writer_end_main,
     331             :         .write_footer = &document_element_writer_write_footer
     332             :     };
     333             : 
     334           0 : void document_element_writer_init ( document_element_writer_t *this_,
     335             :                                     data_database_reader_t *db_reader,
     336             :                                     io_file_format_t export_type,
     337             :                                     data_stat_t *io_export_stat,
     338             :                                     universal_output_stream_t *output )
     339             : {
     340           0 :     U8_TRACE_BEGIN();
     341           0 :     assert( NULL != output );
     342           0 :     assert( NULL != io_export_stat );
     343           0 :     assert( NULL != db_reader );
     344             : 
     345           0 :     io_element_writer_private_init( &((*this_).element_writer),
     346             :                                     (io_element_writer_if_t*) &document_element_writer_private_io_element_writer_if,
     347             :                                     this_
     348             :                                   );
     349           0 :     (*this_).export_stat = io_export_stat;
     350             : 
     351           0 :     (*this_).export_type = export_type;
     352           0 :     (*this_).current_tree_depth = 0;
     353             : 
     354           0 :     json_type_name_map_init( &((*this_).type_map) );
     355           0 :     data_rules_init( &((*this_).data_rules) );
     356           0 :     io_txt_icon_init( &((*this_).txt_icon) );
     357             : 
     358           0 :     io_txt_writer_init( &((*this_).txt_writer), output );
     359           0 :     io_xml_writer_init( &((*this_).xml_writer), output );
     360             : 
     361           0 :     switch ( (*this_).export_type )
     362             :     {
     363           0 :         case IO_FILE_FORMAT_DOCBOOK:
     364             :         {
     365           0 :             document_link_provider_init( &((*this_).link_provider),
     366             :                                          db_reader,
     367             :                                          DOCBOOK_ELEMENT_SEE_NEXT,
     368             :                                          DOCBOOK_DESCRIPTION_XREF_START,
     369             :                                          DOCBOOK_DESCRIPTION_XREF_MIDDLE,
     370             :                                          DOCBOOK_DESCRIPTION_XREF_END,
     371             :                                          &((*this_).xml_writer)
     372             :                                        );
     373           0 :             io_md_writer_init( &((*this_).md_writer),
     374             :                                db_reader,
     375             :                                DOCBOOK_DESCRIPTION_MIDDLE,
     376             :                                DOCBOOK_DESCRIPTION_XREF_START,
     377             :                                DOCBOOK_DESCRIPTION_XREF_MIDDLE,
     378             :                                DOCBOOK_DESCRIPTION_XREF_END,
     379             :                                &((*this_).xml_writer)
     380             :                              );
     381             :         }
     382           0 :         break;
     383             : 
     384           0 :         case IO_FILE_FORMAT_HTML:
     385             :         {
     386           0 :             document_link_provider_init( &((*this_).link_provider),
     387             :                                          db_reader,
     388             :                                          HTML_CLAS_SEE_NEXT,
     389             :                                          HTML_ANY_DESCR_XREF_START,
     390             :                                          HTML_ANY_DESCR_XREF_MIDDLE,
     391             :                                          HTML_ANY_DESCR_XREF_END,
     392             :                                          &((*this_).xml_writer)
     393             :                                        );
     394           0 :             io_md_writer_init( &((*this_).md_writer),
     395             :                                db_reader,
     396             :                                HTML_ANY_DESCR_NEWLINE,
     397             :                                HTML_ANY_DESCR_XREF_START,
     398             :                                HTML_ANY_DESCR_XREF_MIDDLE,
     399             :                                HTML_ANY_DESCR_XREF_END,
     400             :                                &((*this_).xml_writer)
     401             :                              );
     402             :         }
     403           0 :         break;
     404             : 
     405           0 :         case IO_FILE_FORMAT_TXT:
     406             :         {
     407           0 :             document_link_provider_init( &((*this_).link_provider),
     408             :                                          db_reader,
     409             :                                          ", ",
     410             :                                          "",
     411             :                                          ": ",
     412             :                                          "",
     413             :                                          &((*this_).xml_writer)
     414             :                                        );
     415           0 :             io_md_writer_init( &((*this_).md_writer), db_reader, "\n", "", ": ", "", &((*this_).xml_writer) );
     416             :         }
     417           0 :         break;
     418             : 
     419           0 :         default:
     420             :         {
     421           0 :             U8_LOG_ERROR("error: unknown_format.");
     422           0 :             assert(false);  /* use another io_element_writer instead */
     423             :             document_link_provider_init( &((*this_).link_provider),
     424             :                                          db_reader,
     425             :                                          ", ",
     426             :                                          "",
     427             :                                          ": ",
     428             :                                          "",
     429             :                                          &((*this_).xml_writer)
     430             :                                        );
     431             :             io_md_writer_init( &((*this_).md_writer), db_reader, "\n", "", ": ", "", &((*this_).xml_writer) );
     432             :         }
     433             :         break;
     434             :     }
     435             : 
     436           0 :     U8_TRACE_END();
     437           0 : }
     438             : 
     439           0 : void document_element_writer_destroy( document_element_writer_t *this_ )
     440             : {
     441           0 :     U8_TRACE_BEGIN();
     442             : 
     443           0 :     io_md_writer_destroy( &((*this_).md_writer) );
     444           0 :     document_link_provider_destroy( &((*this_).link_provider) );
     445           0 :     io_xml_writer_destroy( &((*this_).xml_writer) );
     446           0 :     io_txt_writer_destroy( &((*this_).txt_writer) );
     447             : 
     448           0 :     io_txt_icon_destroy( &((*this_).txt_icon) );
     449           0 :     data_rules_destroy( &((*this_).data_rules) );
     450           0 :     json_type_name_map_destroy( &((*this_).type_map) );
     451             : 
     452           0 :     (*this_).export_stat = NULL;
     453             : 
     454           0 :     io_element_writer_private_destroy( &((*this_).element_writer) );
     455             : 
     456           0 :     U8_TRACE_END();
     457           0 : }
     458             : 
     459           0 : io_element_writer_t * document_element_writer_get_element_writer( document_element_writer_t *this_ )
     460             : {
     461           0 :     U8_TRACE_BEGIN();
     462             : 
     463           0 :     io_element_writer_t * base = &((*this_).element_writer);
     464             : 
     465           0 :     U8_TRACE_END();
     466           0 :     return base;
     467             : }
     468             : 
     469           0 : u8_error_t document_element_writer_write_header( document_element_writer_t *this_, const char *document_title )
     470             : {
     471           0 :     U8_TRACE_BEGIN();
     472           0 :     assert ( NULL != document_title );
     473           0 :     u8_error_t export_err = U8_ERROR_NONE;
     474             : 
     475           0 :     io_xml_writer_reset_indent ( &((*this_).xml_writer) );
     476             : 
     477           0 :     switch ( (*this_).export_type )
     478             :     {
     479           0 :         case IO_FILE_FORMAT_DOCBOOK:
     480             :         {
     481           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ENC );
     482           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DOC_START );
     483           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     484           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DOC_TITLE_START );
     485           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), document_title );
     486           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DOC_TITLE_END );
     487             :         }
     488           0 :         break;
     489             : 
     490           0 :         case IO_FILE_FORMAT_HTML:
     491             :         {
     492           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DTD );
     493           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DOC_START );
     494           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_START );
     495           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     496           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_TITLE_START );
     497           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), document_title );
     498           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_TITLE_END );
     499           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_CSS_START );
     500           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), document_title );
     501           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_CSS_END );
     502           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     503           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_END );
     504           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_BODY_START );
     505           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     506           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEADER );
     507             :         }
     508           0 :         break;
     509             : 
     510           0 :         case IO_FILE_FORMAT_TXT:
     511             :         {
     512             :             /* no header */
     513             :         }
     514           0 :         break;
     515             : 
     516           0 :         default:
     517             :         {
     518           0 :             U8_LOG_ERROR("error: unknown_format.");
     519           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
     520             :         }
     521           0 :         break;
     522             :     }
     523             : 
     524           0 :     U8_TRACE_END_ERR( export_err );
     525           0 :     return export_err;
     526             : }
     527             : 
     528           0 : u8_error_t document_element_writer_start_main( document_element_writer_t *this_, const char *document_title )
     529             : {
     530           0 :     U8_TRACE_BEGIN();
     531           0 :     assert( document_title != NULL );
     532           0 :     u8_error_t export_err = U8_ERROR_NONE;
     533             : 
     534           0 :     switch ( (*this_).export_type )
     535             :     {
     536           0 :         case IO_FILE_FORMAT_DOCBOOK:
     537             :         {
     538             :             /* no main start */
     539             :         }
     540           0 :         break;
     541             : 
     542           0 :         case IO_FILE_FORMAT_HTML:
     543             :         {
     544           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_ARTICLE_START );
     545           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     546             :         }
     547           0 :         break;
     548             : 
     549           0 :         case IO_FILE_FORMAT_TXT:
     550             :         {
     551             :             /* no main start */
     552             :         }
     553           0 :         break;
     554             : 
     555           0 :         default:
     556             :         {
     557           0 :             U8_LOG_ERROR("error: unknown_format.");
     558           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
     559             :         }
     560           0 :         break;
     561             :     }
     562             : 
     563           0 :     U8_TRACE_END_ERR(export_err);
     564           0 :     return export_err;
     565             : }
     566             : 
     567           0 : bool document_element_writer_can_classifier_nest_classifier( document_element_writer_t *this_,
     568             :                                                              data_classifier_type_t host_type,
     569             :                                                              data_classifier_type_t child_type )
     570             : {
     571           0 :     U8_TRACE_BEGIN();
     572           0 :     const bool can_nest = false;
     573           0 :     U8_TRACE_END();
     574           0 :     return can_nest;
     575             : }
     576             : 
     577           0 : bool document_element_writer_can_classifier_nest_relationship( document_element_writer_t *this_,
     578             :                                                                data_classifier_type_t host_type,
     579             :                                                                data_relationship_type_t child_type )
     580             : {
     581           0 :     U8_TRACE_BEGIN();
     582           0 :     const bool can_nest = true;
     583           0 :     U8_TRACE_END();
     584           0 :     return can_nest;
     585             : }
     586             : 
     587           0 : u8_error_t document_element_writer_start_toc ( document_element_writer_t *this_ )
     588             : {
     589           0 :     U8_TRACE_BEGIN();
     590           0 :     u8_error_t export_err = U8_ERROR_NONE;
     591             : 
     592           0 :     switch ( (*this_).export_type )
     593             :     {
     594           0 :         case IO_FILE_FORMAT_HTML:
     595             :         {
     596           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_NAV_START );
     597           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     598             :         }
     599           0 :         break;
     600             : 
     601           0 :         default:
     602             :         {
     603             :             /* nothing to do, only html provides a table of contents */
     604             :         }
     605           0 :         break;
     606             :     }
     607             : 
     608           0 :     U8_TRACE_END_ERR( export_err );
     609           0 :     return export_err;
     610             : }
     611             : 
     612           0 : u8_error_t document_element_writer_start_toc_sublist ( document_element_writer_t *this_ )
     613             : {
     614           0 :     U8_TRACE_BEGIN();
     615           0 :     u8_error_t export_err = U8_ERROR_NONE;
     616             : 
     617             :     /* increase tree depth */
     618           0 :     (*this_).current_tree_depth ++;
     619             : 
     620           0 :     switch ( (*this_).export_type )
     621             :     {
     622           0 :         case IO_FILE_FORMAT_HTML:
     623             :         {
     624           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_START );
     625           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     626             :         }
     627           0 :         break;
     628             : 
     629           0 :         default:
     630             :         {
     631             :             /* nothing to do, only html provides a table of contents */
     632             :         }
     633           0 :         break;
     634             :     }
     635             : 
     636           0 :     U8_TRACE_END_ERR( export_err );
     637           0 :     return export_err;
     638             : }
     639             : 
     640           0 : u8_error_t document_element_writer_start_toc_entry ( document_element_writer_t *this_ )
     641             : {
     642           0 :     U8_TRACE_BEGIN();
     643           0 :     u8_error_t export_err = U8_ERROR_NONE;
     644             : 
     645           0 :     switch ( (*this_).export_type )
     646             :     {
     647           0 :         case IO_FILE_FORMAT_HTML:
     648             :         {
     649           0 :             const unsigned int index_of_depth = ((*this_).current_tree_depth > HTML_DIAGRAM_MAX_DEPTH)
     650             :                 ? (HTML_DIAGRAM_MAX_DEPTH-1)
     651           0 :                 : ((*this_).current_tree_depth-1);
     652           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_ENTRY_START[index_of_depth] );
     653           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     654             :         }
     655           0 :         break;
     656             : 
     657           0 :         default:
     658             :         {
     659             :             /* nothing to do, only html provides a table of contents */
     660             :         }
     661           0 :         break;
     662             :     }
     663             : 
     664           0 :     U8_TRACE_END_ERR( export_err );
     665           0 :     return export_err;
     666             : }
     667             : 
     668           0 : u8_error_t document_element_writer_write_toc_entry ( document_element_writer_t *this_, const data_diagram_t *diag_ptr )
     669             : {
     670           0 :     U8_TRACE_BEGIN();
     671           0 :     assert ( NULL != diag_ptr );
     672           0 :     u8_error_t export_err = U8_ERROR_NONE;
     673             : 
     674           0 :     switch ( (*this_).export_type )
     675             :     {
     676           0 :         case IO_FILE_FORMAT_HTML:
     677             :         {
     678           0 :             const char *const diag_name = data_diagram_get_name_const(diag_ptr);
     679           0 :             const data_id_t diag_id = data_diagram_get_data_id(diag_ptr);
     680             : 
     681           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_ENTRY_TITLE_START );
     682           0 :             export_err |= io_xml_writer_write_plain_id ( &((*this_).xml_writer), diag_id );
     683           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_ENTRY_TITLE_MIDDLE );
     684           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_name );
     685           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_ENTRY_TITLE_END );
     686             :         }
     687           0 :         break;
     688             : 
     689             : 
     690           0 :         default:
     691             :         {
     692             :             /* nothing to do, only html provides a table of contents */
     693             :         }
     694           0 :         break;
     695             :     }
     696             : 
     697           0 :     U8_TRACE_END_ERR( export_err );
     698           0 :     return export_err;
     699             : }
     700             : 
     701           0 : u8_error_t document_element_writer_end_toc_entry ( document_element_writer_t *this_ )
     702             : {
     703           0 :     U8_TRACE_BEGIN();
     704           0 :     u8_error_t export_err = U8_ERROR_NONE;
     705             : 
     706           0 :     switch ( (*this_).export_type )
     707             :     {
     708           0 :         case IO_FILE_FORMAT_HTML:
     709             :         {
     710           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     711           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_ENTRY_END );
     712             :         }
     713           0 :         break;
     714             : 
     715           0 :         default:
     716             :         {
     717             :             /* nothing to do, only html provides a table of contents */
     718             :         }
     719           0 :         break;
     720             :     }
     721             : 
     722           0 :     U8_TRACE_END_ERR( export_err );
     723           0 :     return export_err;
     724             : }
     725             : 
     726           0 : u8_error_t document_element_writer_end_toc_sublist ( document_element_writer_t *this_ )
     727             : {
     728           0 :     U8_TRACE_BEGIN();
     729           0 :     u8_error_t export_err = U8_ERROR_NONE;
     730             : 
     731           0 :     switch ( (*this_).export_type )
     732             :     {
     733           0 :         case IO_FILE_FORMAT_HTML:
     734             :         {
     735           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     736           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_END );
     737             :         }
     738           0 :         break;
     739             : 
     740           0 :         default:
     741             :         {
     742             :             /* nothing to do, only html provides a table of contents */
     743             :         }
     744           0 :         break;
     745             :     }
     746             : 
     747             :     /* decrease tree depth */
     748           0 :     (*this_).current_tree_depth --;
     749             : 
     750           0 :     U8_TRACE_END_ERR( export_err );
     751           0 :     return export_err;
     752             : }
     753             : 
     754           0 : u8_error_t document_element_writer_end_toc ( document_element_writer_t *this_ )
     755             : {
     756           0 :     U8_TRACE_BEGIN();
     757           0 :     u8_error_t export_err = U8_ERROR_NONE;
     758             : 
     759           0 :     switch ( (*this_).export_type )
     760             :     {
     761           0 :         case IO_FILE_FORMAT_HTML:
     762             :         {
     763           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     764           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_NAV_END );
     765             :         }
     766           0 :         break;
     767             : 
     768           0 :         default:
     769             :         {
     770             :             /* nothing to do, only html provides a table of contents */
     771             :         }
     772           0 :         break;
     773             :     }
     774             : 
     775           0 :     U8_TRACE_END_ERR( export_err );
     776           0 :     return export_err;
     777             : }
     778             : 
     779           0 : u8_error_t document_element_writer_start_classifier( document_element_writer_t *this_,
     780             :                                                      data_classifier_type_t host_type,
     781             :                                                      const data_classifier_t *classifier_ptr )
     782             : {
     783           0 :     U8_TRACE_BEGIN();
     784           0 :     assert ( NULL != classifier_ptr );
     785           0 :     u8_error_t export_err = U8_ERROR_NONE;
     786             : 
     787           0 :     switch ( (*this_).export_type )
     788             :     {
     789           0 :         case IO_FILE_FORMAT_DOCBOOK:
     790             :         {
     791           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_START );
     792           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_START );
     793           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     794             :         }
     795           0 :         break;
     796             : 
     797           0 :         case IO_FILE_FORMAT_HTML:
     798             :         {
     799           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_START );
     800           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     801             :         }
     802           0 :         break;
     803             : 
     804           0 :         case IO_FILE_FORMAT_TXT:
     805             :         {
     806           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
     807             :         }
     808           0 :         break;
     809             : 
     810           0 :         default:
     811             :         {
     812           0 :             U8_LOG_ERROR("error: unknown_format.");
     813           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
     814             :         }
     815           0 :         break;
     816             :     }
     817             : 
     818           0 :     U8_TRACE_END_ERR( export_err );
     819           0 :     return export_err;
     820             : }
     821             : 
     822           0 : u8_error_t document_element_writer_assemble_classifier( document_element_writer_t *this_,
     823             :                                                         data_classifier_type_t host_type,
     824             :                                                         const data_classifier_t *classifier_ptr )
     825             : {
     826           0 :     U8_TRACE_BEGIN();
     827           0 :     assert ( NULL != classifier_ptr );
     828           0 :     u8_error_t export_err = U8_ERROR_NONE;
     829             : 
     830           0 :     const char *const classifier_name = data_classifier_get_name_const(classifier_ptr);
     831           0 :     const char *const classifier_descr = data_classifier_get_description_const(classifier_ptr);
     832           0 :     const size_t classifier_descr_len = utf8string_get_length(classifier_descr);
     833           0 :     const data_id_t classifier_id = data_classifier_get_data_id(classifier_ptr);
     834             :     const char *const classifier_type_name
     835           0 :         = json_type_name_map_get_classifier_type( &((*this_).type_map),
     836             :                                                   data_classifier_get_main_type( classifier_ptr )
     837             :                                                 );
     838           0 :     const char *const classifier_stereotype = data_classifier_get_stereotype_const( classifier_ptr );
     839             : 
     840           0 :     switch ( (*this_).export_type )
     841             :     {
     842           0 :         case IO_FILE_FORMAT_DOCBOOK:
     843             :         {
     844           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_START );
     845           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     846             : 
     847           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_START );
     848           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), classifier_name );
     849           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_END );
     850             : 
     851           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_START );
     852           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     853           0 :             if ( 0 != utf8string_get_length( classifier_stereotype ) )
     854             :             {
     855           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_START );
     856           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), classifier_stereotype );
     857           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_END );
     858             :             }
     859           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_START );
     860           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), classifier_id );
     861           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_END );
     862             :             /* unconditional: Every classifier shoud be contained in at least 1 diagram */
     863             :             {
     864           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_SEE_START );
     865           0 :                 export_err |= document_link_provider_write_occurrences( &((*this_).link_provider), classifier_id );
     866           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_SEE_END );
     867             :             }
     868             : 
     869           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     870           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_END );
     871             : 
     872           0 :             if ( 0 != classifier_descr_len )
     873             :             {
     874           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_START );
     875           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), classifier_descr );
     876           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_END );
     877             :             }
     878             : 
     879           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     880           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_END );
     881             :         }
     882           0 :         break;
     883             : 
     884           0 :         case IO_FILE_FORMAT_HTML:
     885             :         {
     886             :             /* unconditional: Every classifier shoud be contained in at least 1 diagram */
     887             :             {
     888           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_SEE_START );
     889           0 :                 export_err |= document_link_provider_write_occurrences( &((*this_).link_provider), classifier_id );
     890           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_SEE_END );
     891             :             }
     892           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_HEAD_START );
     893           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_NAME_START );
     894           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), classifier_name );
     895           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_NAME_END );
     896           0 :             if ( 0 != utf8string_get_length( classifier_stereotype ) )
     897             :             {
     898           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_STEREO_START );
     899           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), classifier_stereotype );
     900           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_STEREO_END );
     901             :             }
     902           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_TYPE_START );
     903           0 :             export_err |= io_xml_writer_write_xml_enc( &((*this_).xml_writer), classifier_type_name );
     904           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_TYPE_END );
     905           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_ID_START );
     906           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), classifier_id );
     907           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_ID_END );
     908           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_HEAD_END );
     909             : 
     910           0 :             if ( 0 != classifier_descr_len )
     911             :             {
     912           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_DESCR_START );
     913           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), classifier_descr );
     914           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_DESCR_END );
     915             :             }
     916             :         }
     917           0 :         break;
     918             : 
     919           0 :         case IO_FILE_FORMAT_TXT:
     920             :         {
     921           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
     922           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), classifier_name );
     923           0 :             const utf8stringview_t classifier_name_view = UTF8STRINGVIEW_STR( classifier_name );
     924           0 :             const size_t clas_codepoint = utf8stringview_count_codepoints( &classifier_name_view );
     925           0 :             export_err |= io_txt_writer_write_aligned_id( &((*this_).txt_writer),
     926           0 :                                                           TXT_ID_ALIGN_COLUMN - clas_codepoint,
     927             :                                                           classifier_id
     928             :                                                         );
     929           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
     930           0 :             export_err |= io_txt_writer_fill (  &((*this_).txt_writer), TXT_CLAS_UNDERLINE, clas_codepoint );
     931           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
     932           0 :             export_err |= io_txt_writer_write_indent_multiline_string( &((*this_).txt_writer),
     933             :                                                                        TXT_NO_INDENT,
     934             :                                                                        classifier_descr
     935             :                                                                      );
     936           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
     937             :         }
     938           0 :         break;
     939             : 
     940           0 :         default:
     941             :         {
     942           0 :             U8_LOG_ERROR("error: unknown_format.");
     943           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
     944             :         }
     945           0 :         break;
     946             :     }
     947             : 
     948             :     /* update export statistics */
     949           0 :     data_stat_inc_count ( (*this_).export_stat, DATA_STAT_TABLE_CLASSIFIER, DATA_STAT_SERIES_EXPORTED );
     950             : 
     951           0 :     U8_TRACE_END_ERR( export_err );
     952           0 :     return export_err;
     953             : }
     954             : 
     955           0 : u8_error_t document_element_writer_end_classifier( document_element_writer_t *this_,
     956             :                                                    data_classifier_type_t host_type,
     957             :                                                    const data_classifier_t *classifier_ptr )
     958             : {
     959           0 :     U8_TRACE_BEGIN();
     960           0 :     assert ( NULL != classifier_ptr );
     961           0 :     u8_error_t export_err = U8_ERROR_NONE;
     962             : 
     963           0 :     switch ( (*this_).export_type )
     964             :     {
     965           0 :         case IO_FILE_FORMAT_DOCBOOK:
     966             :         {
     967           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     968           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_END );
     969           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_END );
     970             :         }
     971           0 :         break;
     972             : 
     973           0 :         case IO_FILE_FORMAT_HTML:
     974             :         {
     975           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     976           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_END );
     977             :         }
     978           0 :         break;
     979             : 
     980           0 :         case IO_FILE_FORMAT_TXT:
     981             :         {
     982             :             /* no end classifier tags */
     983             :         }
     984           0 :         break;
     985             : 
     986           0 :         default:
     987             :         {
     988           0 :             U8_LOG_ERROR("error: unknown_format.");
     989           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
     990             :         }
     991           0 :         break;
     992             :     }
     993             : 
     994           0 :     U8_TRACE_END_ERR( export_err );
     995           0 :     return export_err;
     996             : }
     997             : 
     998           0 : u8_error_t document_element_writer_start_feature( document_element_writer_t *this_,
     999             :                                                   data_classifier_type_t parent_type,
    1000             :                                                   const data_feature_t *feature_ptr)
    1001             : {
    1002           0 :     U8_TRACE_BEGIN();
    1003           0 :     assert( feature_ptr != NULL );
    1004           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1005             : 
    1006           0 :     switch ( (*this_).export_type )
    1007             :     {
    1008           0 :         case IO_FILE_FORMAT_HTML:
    1009             :         {
    1010           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_START );
    1011           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1012             :         }
    1013           0 :         break;
    1014             : 
    1015           0 :         default:
    1016             :         {
    1017             :         }
    1018           0 :         break;
    1019             :     }
    1020             : 
    1021           0 :     U8_TRACE_END_ERR(export_err);
    1022           0 :     return export_err;
    1023             : }
    1024             : 
    1025           0 : u8_error_t document_element_writer_assemble_feature( document_element_writer_t *this_,
    1026             :                                                      const data_classifier_t *parent,
    1027             :                                                      const data_feature_t *feature_ptr )
    1028             : {
    1029           0 :     U8_TRACE_BEGIN();
    1030           0 :     assert ( NULL != feature_ptr );
    1031           0 :     assert( parent != NULL );
    1032           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1033             : 
    1034           0 :     const char *const feature_key = data_feature_get_key_const( feature_ptr );
    1035           0 :     const char *const feature_value = data_feature_get_value_const( feature_ptr );
    1036           0 :     const size_t feature_value_len = utf8string_get_length(feature_value);
    1037           0 :     const char *const feature_descr = data_feature_get_description_const( feature_ptr );
    1038           0 :     const size_t feature_descr_len = utf8string_get_length(feature_descr);
    1039           0 :     const data_id_t feature_id = data_feature_get_data_id( feature_ptr );
    1040           0 :     const data_feature_type_t feature_type = data_feature_get_main_type( feature_ptr );
    1041             :     const char *const feature_type_name
    1042           0 :         = json_type_name_map_get_feature_type( &((*this_).type_map), feature_type );
    1043           0 :     const bool has_stereotype = data_rules_feature_value_is_stereotype( &((*this_).data_rules), feature_type );
    1044             : 
    1045           0 :     switch ( (*this_).export_type )
    1046             :     {
    1047           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1048             :         {
    1049           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_START );
    1050           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1051             : 
    1052           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_START );
    1053           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_key );
    1054           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_END );
    1055             : 
    1056           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_START );
    1057           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1058           0 :             if ( 0 != feature_value_len )
    1059             :             {
    1060           0 :                 if ( has_stereotype )
    1061             :                 {
    1062           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_START );
    1063           0 :                     export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_value );
    1064           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_END );
    1065             :                 }
    1066             :                 else
    1067             :                 {
    1068           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_COLON_SPACE );
    1069           0 :                     export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_value );
    1070             :                 }
    1071             :             }
    1072           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_START );
    1073           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), feature_id );
    1074           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_END );
    1075           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1076           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_END );
    1077             : 
    1078           0 :             if ( 0 != feature_descr_len )
    1079             :             {
    1080           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_START );
    1081           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), feature_descr );
    1082           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_END );
    1083             :             }
    1084             : 
    1085           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1086           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_END );
    1087             :         }
    1088           0 :         break;
    1089             : 
    1090           0 :         case IO_FILE_FORMAT_HTML:
    1091             :         {
    1092           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_HEAD_START );
    1093           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_NAME_START );
    1094           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_key );
    1095           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_NAME_END );
    1096           0 :             if ( 0 != feature_value_len )
    1097             :             {
    1098           0 :                 if ( has_stereotype )
    1099             :                 {
    1100           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_STEREO_START );
    1101           0 :                     export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_value );
    1102           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_STEREO_END );
    1103             :                 }
    1104             :                 else
    1105             :                 {
    1106           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_COLON_SPACE );
    1107           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_VALUE_START );
    1108           0 :                     export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_value );
    1109           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_VALUE_END );
    1110             :                 }
    1111             :             }
    1112           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_TYPE_START );
    1113           0 :             export_err |= io_xml_writer_write_xml_enc( &((*this_).xml_writer), feature_type_name );
    1114           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_TYPE_END );
    1115           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_ID_START );
    1116           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), feature_id );
    1117           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_ID_END );
    1118           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_HEAD_END );
    1119           0 :             if ( 0 != feature_descr_len )
    1120             :             {
    1121           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_DESCR_START );
    1122           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), feature_descr );
    1123           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_DESCR_END );
    1124             :             }
    1125             :         }
    1126           0 :         break;
    1127             : 
    1128           0 :         case IO_FILE_FORMAT_TXT:
    1129             :         {
    1130           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_FEAT_INDENT );
    1131           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), feature_key );
    1132           0 :             if ( 0 != feature_value_len )
    1133             :             {
    1134           0 :                 export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_COLON_SPACE );
    1135           0 :                 export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), feature_value );
    1136             :             }
    1137             : 
    1138           0 :             const utf8stringview_t feature_key_view = UTF8STRINGVIEW_STR( feature_key );
    1139           0 :             const utf8stringview_t feature_value_view = UTF8STRINGVIEW_STR( feature_value );
    1140           0 :             const size_t feat_key_codepoint = utf8stringview_count_codepoints( &feature_key_view );
    1141           0 :             const size_t feat_value_codepoint = utf8stringview_count_codepoints( &feature_value_view );
    1142           0 :             int id_indent_width = TXT_ID_ALIGN_COLUMN - utf8string_get_length(TXT_FEAT_INDENT) - feat_key_codepoint
    1143           0 :                 - ((feature_value_len==0)?0:(feat_value_codepoint+utf8string_get_length(TXT_COLON_SPACE)));
    1144           0 :             export_err |= io_txt_writer_write_aligned_id( &((*this_).txt_writer),
    1145             :                                                           id_indent_width,
    1146             :                                                           feature_id
    1147             :                                                         );
    1148           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
    1149           0 :             export_err |= io_txt_writer_write_indent_multiline_string( &((*this_).txt_writer),
    1150             :                                                                        TXT_CONTINUE_INDENT,
    1151             :                                                                        feature_descr
    1152             :                                                                      );
    1153             :         }
    1154           0 :         break;
    1155             : 
    1156           0 :         default:
    1157             :         {
    1158           0 :             U8_LOG_ERROR("error: unknown_format.");
    1159           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1160             :         }
    1161           0 :         break;
    1162             :     }
    1163             : 
    1164             :     /* update export statistics */
    1165           0 :     const data_feature_type_t feat_type = data_feature_get_main_type( feature_ptr );
    1166           0 :     const data_stat_table_t feat_or_lifeline
    1167           0 :         = ( feat_type == DATA_FEATURE_TYPE_LIFELINE ) ? DATA_STAT_TABLE_LIFELINE : DATA_STAT_TABLE_FEATURE;
    1168           0 :     data_stat_inc_count ( (*this_).export_stat, feat_or_lifeline, DATA_STAT_SERIES_EXPORTED );
    1169             : 
    1170           0 :     U8_TRACE_END_ERR( export_err );
    1171           0 :     return export_err;
    1172             : }
    1173             : 
    1174           0 : u8_error_t document_element_writer_end_feature( document_element_writer_t *this_,
    1175             :                                                 data_classifier_type_t parent_type,
    1176             :                                                 const data_feature_t *feature_ptr)
    1177             : {
    1178           0 :     U8_TRACE_BEGIN();
    1179           0 :     assert( feature_ptr != NULL );
    1180           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1181             : 
    1182           0 :     switch ( (*this_).export_type )
    1183             :     {
    1184           0 :         case IO_FILE_FORMAT_HTML:
    1185             :         {
    1186           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1187           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_END );
    1188             :         }
    1189           0 :         break;
    1190             : 
    1191           0 :         default:
    1192             :         {
    1193             :         }
    1194           0 :         break;
    1195             :     }
    1196             : 
    1197           0 :     U8_TRACE_END_ERR(export_err);
    1198           0 :     return export_err;
    1199             : }
    1200             : 
    1201           0 : u8_error_t document_element_writer_start_relationship( document_element_writer_t *this_,
    1202             :                                                        data_classifier_type_t host_type,
    1203             :                                                        const data_relationship_t *relation_ptr)
    1204             : {
    1205           0 :     U8_TRACE_BEGIN();
    1206           0 :     assert( relation_ptr != NULL );
    1207           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1208             : 
    1209           0 :     switch ( (*this_).export_type )
    1210             :     {
    1211           0 :         case IO_FILE_FORMAT_HTML:
    1212             :         {
    1213           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_START );
    1214           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1215             :         }
    1216           0 :         break;
    1217             : 
    1218           0 :         default:
    1219             :         {
    1220             :         }
    1221           0 :         break;
    1222             :     }
    1223             : 
    1224           0 :     U8_TRACE_END_ERR(export_err);
    1225           0 :     return export_err;
    1226             : }
    1227             : 
    1228           0 : u8_error_t document_element_writer_assemble_relationship( document_element_writer_t *this_,
    1229             :                                                           const data_classifier_t *host,
    1230             :                                                           const data_relationship_t *relation_ptr,
    1231             :                                                           const data_classifier_t *from_c,
    1232             :                                                           const data_feature_t *from_f,
    1233             :                                                           const data_classifier_t *to_c,
    1234             :                                                           const data_feature_t *to_f )
    1235             : {
    1236           0 :     U8_TRACE_BEGIN();
    1237           0 :     assert ( NULL != relation_ptr );
    1238             :     /* NULL is allowed here: dest_classifier_ptr */
    1239           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1240             : 
    1241           0 :     const char *const relation_name = data_relationship_get_name_const( relation_ptr );
    1242           0 :     const data_id_t relation_id = data_relationship_get_data_id( relation_ptr );
    1243           0 :     const char *const relation_descr = data_relationship_get_description_const( relation_ptr );
    1244           0 :     const size_t relation_descr_len = utf8string_get_length(relation_descr);
    1245           0 :     const data_relationship_type_t relation_type = data_relationship_get_main_type( relation_ptr );
    1246           0 :     const char *const dest_classifier_name
    1247             :         = (NULL != to_c)
    1248           0 :         ? data_classifier_get_name_const( to_c )
    1249           0 :         : "";
    1250             :     const char *const relation_type_name
    1251           0 :         = json_type_name_map_get_relationship_type( &((*this_).type_map), relation_type );
    1252           0 :     const char*const relation_txticon = io_txt_icon_get_relationship ( &((*this_).txt_icon), relation_type );
    1253             : 
    1254           0 :     const char *const relation_stereotype = data_relationship_get_stereotype_const( relation_ptr );
    1255             : 
    1256           0 :     switch ( (*this_).export_type )
    1257             :     {
    1258           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1259             :         {
    1260             :             /* list start */
    1261           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_START );
    1262           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_START );
    1263           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1264             :             /* element */
    1265           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_START );
    1266           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1267             : 
    1268           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_START );
    1269           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_name );
    1270           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_END );
    1271             : 
    1272           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_START );
    1273           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1274           0 :             if ( 0 != utf8string_get_length( relation_stereotype ) )
    1275             :             {
    1276           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_START );
    1277           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_stereotype );
    1278           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_END );
    1279             :             }
    1280           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_SPACE );
    1281           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_txticon );
    1282           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_SPACE );
    1283           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), dest_classifier_name );
    1284           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_START );
    1285           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), relation_id );
    1286           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_END );
    1287           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1288           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_END );
    1289             : 
    1290           0 :             if ( 0 != relation_descr_len )
    1291             :             {
    1292           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_START );
    1293           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), relation_descr );
    1294           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_END );
    1295             :             }
    1296             : 
    1297           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1298           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_END );
    1299             :             /* list end */
    1300           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1301           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_END );
    1302           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_END );
    1303             :         }
    1304           0 :         break;
    1305             : 
    1306           0 :         case IO_FILE_FORMAT_HTML:
    1307             :         {
    1308           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_HEAD_START );
    1309           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_NAME_START );
    1310           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_name );
    1311           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_NAME_END );
    1312           0 :             if ( 0 != utf8string_get_length( relation_stereotype ) )
    1313             :             {
    1314           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_STEREO_START );
    1315           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_stereotype );
    1316           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_STEREO_END );
    1317             :             }
    1318           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_SPACE );
    1319           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_txticon );
    1320           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_SPACE );
    1321           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_DEST_START );
    1322           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), dest_classifier_name );
    1323           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_DEST_END );
    1324           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_TYPE_START );
    1325           0 :             export_err |= io_xml_writer_write_xml_enc( &((*this_).xml_writer), relation_type_name );
    1326           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_TYPE_END );
    1327           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_ID_START );
    1328           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), relation_id );
    1329           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_ID_END );
    1330           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_HEAD_END );
    1331           0 :             if ( 0 != relation_descr_len )
    1332             :             {
    1333           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_DESCR_START );
    1334           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), relation_descr );
    1335           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_DESCR_END );
    1336             :             }
    1337             :         }
    1338           0 :         break;
    1339             : 
    1340           0 :         case IO_FILE_FORMAT_TXT:
    1341             :         {
    1342           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_REL_INDENT );
    1343             : 
    1344           0 :             size_t relation_name_len = utf8string_get_length(relation_name);
    1345             :             /* print arrow */
    1346           0 :             if ( relation_name_len != 0 )
    1347             :             {
    1348           0 :                 export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), relation_name );
    1349           0 :                 export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_SPACE );
    1350             :             }
    1351           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_CODE_START );
    1352           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), relation_txticon );
    1353           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_CODE_END );
    1354           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_SPACE );
    1355             : 
    1356           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), dest_classifier_name );
    1357             : 
    1358             :             /* print id */
    1359           0 :             const utf8stringview_t relation_name_view = UTF8STRINGVIEW_STR( relation_name );
    1360           0 :             const utf8stringview_t relation_txticon_view = UTF8STRINGVIEW_STR( relation_txticon );
    1361           0 :             const utf8stringview_t dest_classifier_name_view = UTF8STRINGVIEW_STR( dest_classifier_name );
    1362           0 :             const size_t rel_name_codepoint = utf8stringview_count_codepoints( &relation_name_view);
    1363           0 :             const size_t rel_icon_codepoint = utf8stringview_count_codepoints( &relation_txticon_view );
    1364           0 :             const size_t rel_dest_codepoint = utf8stringview_count_codepoints( &dest_classifier_name_view );
    1365           0 :             int id_indent_width
    1366             :                 = TXT_ID_ALIGN_COLUMN
    1367           0 :                 - utf8string_get_length(TXT_REL_INDENT)
    1368           0 :                 - ((relation_name_len==0)?0:(rel_name_codepoint+utf8string_get_length(TXT_SPACE)))
    1369           0 :                 - utf8string_get_length(TXT_CODE_START)
    1370           0 :                 - rel_icon_codepoint
    1371           0 :                 - utf8string_get_length(TXT_CODE_END)
    1372           0 :                 - utf8string_get_length(TXT_SPACE)
    1373           0 :                 - rel_dest_codepoint;
    1374           0 :             export_err |= io_txt_writer_write_aligned_id( &((*this_).txt_writer),
    1375             :                                                           id_indent_width,
    1376             :                                                           relation_id
    1377             :                                                         );
    1378             : 
    1379           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
    1380           0 :             export_err |= io_txt_writer_write_indent_multiline_string( &((*this_).txt_writer),
    1381             :                                                                        TXT_CONTINUE_INDENT,
    1382             :                                                                        relation_descr
    1383             :                                                                      );
    1384             :         }
    1385           0 :         break;
    1386             : 
    1387           0 :         default:
    1388             :         {
    1389           0 :             U8_LOG_ERROR("error: unknown_format.");
    1390           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1391             :         }
    1392           0 :         break;
    1393             :     }
    1394             : 
    1395             :     /* update export statistics */
    1396           0 :     data_stat_inc_count ( (*this_).export_stat, DATA_STAT_TABLE_RELATIONSHIP, DATA_STAT_SERIES_EXPORTED );
    1397             : 
    1398           0 :     U8_TRACE_END_ERR( export_err );
    1399           0 :     return export_err;
    1400             : }
    1401             : 
    1402           0 : u8_error_t document_element_writer_end_relationship( document_element_writer_t *this_,
    1403             :                                                      data_classifier_type_t host_type,
    1404             :                                                      const data_relationship_t *relation_ptr)
    1405             : {
    1406           0 :     U8_TRACE_BEGIN();
    1407           0 :     assert( relation_ptr != NULL );
    1408           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1409             : 
    1410           0 :     switch ( (*this_).export_type )
    1411             :     {
    1412           0 :         case IO_FILE_FORMAT_HTML:
    1413             :         {
    1414           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1415           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_END );
    1416             :         }
    1417           0 :         break;
    1418             : 
    1419           0 :         default:
    1420             :         {
    1421             :         }
    1422           0 :         break;
    1423             :     }
    1424             : 
    1425           0 :     U8_TRACE_END_ERR(export_err);
    1426           0 :     return export_err;
    1427             : }
    1428             : 
    1429           0 : u8_error_t document_element_writer_start_diagram( document_element_writer_t *this_, const data_diagram_t *diag_ptr )
    1430             : {
    1431           0 :     U8_TRACE_BEGIN();
    1432           0 :     assert ( NULL != diag_ptr );
    1433           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1434             : 
    1435           0 :     const data_id_t diag_id = data_diagram_get_data_id(diag_ptr);
    1436           0 :     const char *const diag_name = data_diagram_get_name_const( diag_ptr );
    1437             : 
    1438             :     /* increase tree depth */
    1439           0 :     (*this_).current_tree_depth ++;
    1440             : 
    1441           0 :     switch ( (*this_).export_type )
    1442             :     {
    1443           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1444             :         {
    1445           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), ((*this_).current_tree_depth==1) ? DOCBOOK_TOP_DIAGRAM_START : DOCBOOK_DIAGRAM_START );
    1446           0 :             export_err |= io_xml_writer_write_plain_id ( &((*this_).xml_writer), diag_id );
    1447           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), ((*this_).current_tree_depth==1) ? DOCBOOK_TOP_DIAGRAM_MIDDLE : DOCBOOK_DIAGRAM_MIDDLE );
    1448           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1449             :         }
    1450           0 :         break;
    1451             : 
    1452           0 :         case IO_FILE_FORMAT_HTML:
    1453             :         {
    1454           0 :             const unsigned int index_of_depth = ((*this_).current_tree_depth > HTML_DIAGRAM_MAX_DEPTH)
    1455             :                 ? (HTML_DIAGRAM_MAX_DEPTH-1)
    1456           0 :                 : ((*this_).current_tree_depth-1);
    1457           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAGRAM_TITLE_START[index_of_depth] );
    1458           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), diag_id );
    1459           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAGRAM_TITLE_MIDDLE );
    1460           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_name );
    1461           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAGRAM_TITLE_END[index_of_depth] );
    1462             :         }
    1463           0 :         break;
    1464             : 
    1465           0 :         case IO_FILE_FORMAT_TXT:
    1466             :         {
    1467             :             /* no start diagram tags */
    1468             :         }
    1469           0 :         break;
    1470             : 
    1471           0 :         default:
    1472             :         {
    1473           0 :             U8_LOG_ERROR("error: unknown_format.");
    1474           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1475             :         }
    1476           0 :         break;
    1477             :     }
    1478           0 :     if ( export_err != 0 )
    1479             :     {
    1480           0 :         U8_LOG_ERROR( "not all bytes could be written" );
    1481             :     }
    1482             : 
    1483             :     /* inform the link provider on current diagram id: */
    1484           0 :     document_link_provider_set_current_diagram( &((*this_).link_provider), &diag_id );
    1485             : 
    1486           0 :     U8_TRACE_END_ERR( export_err );
    1487           0 :     return export_err;
    1488             : }
    1489             : 
    1490           0 : u8_error_t document_element_writer_assemble_diagram( document_element_writer_t *this_,
    1491             :                                                      const data_diagram_t *parent,
    1492             :                                                      const data_diagram_t *diag_ptr,
    1493             :                                                      const char *diagram_file_base_name )
    1494             : {
    1495           0 :     U8_TRACE_BEGIN();
    1496             :     /* parent may be NULL */
    1497           0 :     assert ( NULL != diag_ptr );
    1498           0 :     assert ( NULL != diagram_file_base_name );
    1499           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1500             : 
    1501           0 :     const char *const diag_name = data_diagram_get_name_const( diag_ptr );
    1502           0 :     const char *const diag_description = data_diagram_get_description_const( diag_ptr );
    1503           0 :     const data_id_t diag_id = data_diagram_get_data_id(diag_ptr);
    1504             :     const char *const diag_type_name
    1505           0 :         = json_type_name_map_get_diagram_type( &((*this_).type_map),
    1506             :                                                data_diagram_get_diagram_type( diag_ptr )
    1507             :                                               );
    1508           0 :     const char *const diag_stereotype = data_diagram_get_stereotype_const( diag_ptr );
    1509             : 
    1510           0 :     switch ( (*this_).export_type )
    1511             :     {
    1512           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1513             :         {
    1514           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DIAGRAM_TITLE_START );
    1515           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_name );
    1516           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DIAGRAM_TITLE_END );
    1517             : 
    1518           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_START );
    1519           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_START );
    1520           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1521           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_START );
    1522           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1523             : 
    1524           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_START );
    1525           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_name );
    1526           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_END );
    1527             : 
    1528           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_START );
    1529           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1530           0 :             if ( 0 != utf8string_get_length( diag_stereotype ) )
    1531             :             {
    1532           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_START );
    1533           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_stereotype );
    1534           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_END );
    1535             :             }
    1536           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_START );
    1537           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), diag_id );
    1538           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_END );
    1539           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1540           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_END );
    1541             : 
    1542           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1543           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_END );
    1544           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1545           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_END );
    1546           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_END );
    1547             : 
    1548           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_START );
    1549           0 :             export_err |= io_md_writer_transform ( &((*this_).md_writer), diag_description );
    1550           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_END );
    1551             : 
    1552           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DIAGRAM_IMG_START );
    1553           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diagram_file_base_name );
    1554           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DIAGRAM_IMG_MIDDLE );
    1555           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diagram_file_base_name );
    1556           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DIAGRAM_IMG_END );
    1557             :         }
    1558           0 :         break;
    1559             : 
    1560           0 :         case IO_FILE_FORMAT_HTML:
    1561             :         {
    1562             :             /* diagram start */
    1563           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_START );
    1564           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1565             : 
    1566             :             /* diagram contents */
    1567           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_HEAD_START );
    1568           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_NAME_START );
    1569           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_name );
    1570           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_NAME_END );
    1571           0 :             if ( 0 != utf8string_get_length( diag_stereotype ) )
    1572             :             {
    1573           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_STEREO_START );
    1574           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_stereotype );
    1575           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_STEREO_END );
    1576             :             }
    1577           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_TYPE_START );
    1578           0 :             export_err |= io_xml_writer_write_xml_enc( &((*this_).xml_writer), diag_type_name );
    1579           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_TYPE_END );
    1580           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_ID_START );
    1581           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), diag_id );
    1582           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_ID_END );
    1583           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_HEAD_END );
    1584           0 :             if ( 0 != utf8string_get_length( diag_description ) )
    1585             :             {
    1586           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_DESCR_START );
    1587           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), diag_description );
    1588           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_DESCR_END );
    1589             :             }
    1590             : 
    1591             :             /* diagram end happens here to avoid recursion to child diagrams before the end */
    1592           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1593           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_END );
    1594             : 
    1595             :             /* show the diagram-picture */
    1596           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAGRAM_IMG_START );
    1597           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diagram_file_base_name );
    1598           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAGRAM_IMG_END );
    1599             :         }
    1600           0 :         break;
    1601             : 
    1602           0 :         case IO_FILE_FORMAT_TXT:
    1603             :         {
    1604           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), diag_name );
    1605           0 :             const utf8stringview_t diag_name_view = UTF8STRINGVIEW_STR( diag_name );
    1606           0 :             const size_t diag_name_codepoint = utf8stringview_count_codepoints( &diag_name_view );
    1607           0 :             export_err |= io_txt_writer_write_aligned_id( &((*this_).txt_writer),
    1608           0 :                                                           TXT_ID_ALIGN_COLUMN - diag_name_codepoint,
    1609             :                                                           diag_id
    1610             :                                                         );
    1611           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
    1612           0 :             export_err |= io_txt_writer_fill (  &((*this_).txt_writer), TXT_DIAG_UNDERLINE, diag_name_codepoint );
    1613           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
    1614           0 :             export_err |= io_txt_writer_write_indent_multiline_string( &((*this_).txt_writer),
    1615             :                                                                        TXT_NO_INDENT,
    1616             :                                                                        diag_description
    1617             :                                                                      );
    1618             :         }
    1619           0 :         break;
    1620             : 
    1621           0 :         default:
    1622             :         {
    1623           0 :             U8_LOG_ERROR("error: unknown_format.");
    1624           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1625             :         }
    1626           0 :         break;
    1627             :     }
    1628             : 
    1629             :     /* update export statistics */
    1630           0 :     data_stat_inc_count ( (*this_).export_stat, DATA_STAT_TABLE_DIAGRAM, DATA_STAT_SERIES_EXPORTED );
    1631             : 
    1632           0 :     U8_TRACE_END_ERR( export_err );
    1633           0 :     return export_err;
    1634             : }
    1635             : 
    1636           0 : u8_error_t document_element_writer_end_diagram( document_element_writer_t *this_, const data_diagram_t *diag_ptr )
    1637             : {
    1638           0 :     U8_TRACE_BEGIN();
    1639           0 :     assert ( NULL != diag_ptr );
    1640           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1641             : 
    1642           0 :     switch ( (*this_).export_type )
    1643             :     {
    1644           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1645             :         {
    1646           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1647           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), ((*this_).current_tree_depth==1) ? DOCBOOK_TOP_DIAGRAM_END : DOCBOOK_DIAGRAM_END );
    1648             :         }
    1649           0 :         break;
    1650             : 
    1651           0 :         case IO_FILE_FORMAT_HTML:
    1652             :         {
    1653             :         }
    1654           0 :         break;
    1655             : 
    1656           0 :         case IO_FILE_FORMAT_TXT:
    1657             :         {
    1658             :             /* no end diagram tags */
    1659             :         }
    1660           0 :         break;
    1661             : 
    1662           0 :         default:
    1663             :         {
    1664           0 :             U8_LOG_ERROR("error: unknown_format.");
    1665           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1666             :         }
    1667           0 :         break;
    1668             :     }
    1669             : 
    1670             :     /* decrease tree depth */
    1671           0 :     (*this_).current_tree_depth --;
    1672             : 
    1673           0 :     U8_TRACE_END_ERR( export_err );
    1674           0 :     return export_err;
    1675             : }
    1676             : 
    1677           0 : u8_error_t document_element_writer_start_diagramelement( document_element_writer_t *this_,
    1678             :                                                          const data_diagram_t *parent,
    1679             :                                                          const data_diagramelement_t *diagramelement_ptr )
    1680             : {
    1681           0 :     U8_TRACE_BEGIN();
    1682           0 :     assert( diagramelement_ptr != NULL );
    1683           0 :     assert( parent != NULL );
    1684           0 :     u8_error_t write_error = U8_ERROR_NONE;
    1685             : 
    1686           0 :     U8_TRACE_END_ERR(write_error);
    1687           0 :     return write_error;
    1688             : }
    1689             : 
    1690           0 : u8_error_t document_element_writer_assemble_diagramelement( document_element_writer_t *this_,
    1691             :                                                             const data_diagram_t *parent,
    1692             :                                                             const data_diagramelement_t *diagramelement_ptr,
    1693             :                                                             const data_classifier_t *occurrence,
    1694             :                                                             const data_feature_t *feat_occur )
    1695             : {
    1696           0 :     U8_TRACE_BEGIN();
    1697           0 :     assert( diagramelement_ptr != NULL );
    1698           0 :     assert( parent != NULL );
    1699           0 :     assert( occurrence != NULL );
    1700             :     /* NULL is allowed here: feat_occur */
    1701           0 :     u8_error_t write_error = U8_ERROR_NONE;
    1702             : 
    1703           0 :     U8_TRACE_END_ERR(write_error);
    1704           0 :     return write_error;
    1705             : }
    1706             : 
    1707           0 : u8_error_t document_element_writer_end_diagramelement( document_element_writer_t *this_,
    1708             :                                                        const data_diagram_t *parent,
    1709             :                                                        const data_diagramelement_t *diagramelement_ptr )
    1710             : {
    1711           0 :     U8_TRACE_BEGIN();
    1712           0 :     assert( diagramelement_ptr != NULL );
    1713           0 :     assert( parent != NULL );
    1714           0 :     u8_error_t write_error = U8_ERROR_NONE;
    1715             : 
    1716           0 :     U8_TRACE_END_ERR(write_error);
    1717           0 :     return write_error;
    1718             : }
    1719             : 
    1720           0 : u8_error_t document_element_writer_end_main( document_element_writer_t *this_ )
    1721             : {
    1722           0 :     U8_TRACE_BEGIN();
    1723           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1724             : 
    1725           0 :     switch ( (*this_).export_type )
    1726             :     {
    1727           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1728             :         {
    1729             :             /* no main end */
    1730             :         }
    1731           0 :         break;
    1732             : 
    1733           0 :         case IO_FILE_FORMAT_HTML:
    1734             :         {
    1735           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1736           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_ARTICLE_END );
    1737             :         }
    1738           0 :         break;
    1739             : 
    1740           0 :         case IO_FILE_FORMAT_TXT:
    1741             :         {
    1742             :             /* no main end */
    1743             :         }
    1744           0 :         break;
    1745             : 
    1746           0 :         default:
    1747             :         {
    1748           0 :             U8_LOG_ERROR("error: unknown_format.");
    1749           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1750             :         }
    1751           0 :         break;
    1752             :     }
    1753             : 
    1754           0 :     U8_TRACE_END_ERR(export_err);
    1755           0 :     return export_err;
    1756             : }
    1757             : 
    1758           0 : u8_error_t document_element_writer_write_footer( document_element_writer_t *this_ )
    1759             : {
    1760           0 :     U8_TRACE_BEGIN();
    1761           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1762             : 
    1763           0 :     switch ( (*this_).export_type )
    1764             :     {
    1765           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1766             :         {
    1767           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1768           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DOC_END );
    1769             :         }
    1770           0 :         break;
    1771             : 
    1772           0 :         case IO_FILE_FORMAT_HTML:
    1773             :         {
    1774           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FOOTER );
    1775           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1776           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_BODY_END );
    1777           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DOC_END );
    1778             :         }
    1779           0 :         break;
    1780             : 
    1781           0 :         case IO_FILE_FORMAT_TXT:
    1782             :         {
    1783             :             /* no footer */
    1784             :         }
    1785           0 :         break;
    1786             : 
    1787           0 :         default:
    1788             :         {
    1789           0 :             U8_LOG_ERROR("error: unknown_format.");
    1790           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1791             :         }
    1792           0 :         break;
    1793             :     }
    1794             : 
    1795           0 :     U8_TRACE_END_ERR( export_err );
    1796           0 :     return export_err;
    1797             : }
    1798             : 
    1799             : 
    1800             : /*
    1801             : Copyright 2017-2025 Andreas Warnke
    1802             : 
    1803             : Licensed under the Apache License, Version 2.0 (the "License");
    1804             : you may not use this file except in compliance with the License.
    1805             : You may obtain a copy of the License at
    1806             : 
    1807             :     http://www.apache.org/licenses/LICENSE-2.0
    1808             : 
    1809             : Unless required by applicable law or agreed to in writing, software
    1810             : distributed under the License is distributed on an "AS IS" BASIS,
    1811             : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1812             : See the License for the specific language governing permissions and
    1813             : limitations under the License.
    1814             : */

Generated by: LCOV version 1.16