LCOV - code coverage report
Current view: top level - /usr/include/xsd/cxx/tree - exceptions.txx (source / functions) Coverage Total Hit
Test: mu2edaq.info.cleaned Lines: 0.0 % 97 0
Test Date: 2026-07-30 01:56:44 Functions: 0.0 % 29 0

            Line data    Source code
       1              : // file      : xsd/cxx/tree/exceptions.txx
       2              : // copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
       3              : // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file
       4              : 
       5              : #include <xsd/cxx/tree/bits/literals.hxx>
       6              : 
       7              : namespace xsd
       8              : {
       9              :   namespace cxx
      10              :   {
      11              :     namespace tree
      12              :     {
      13              :       // error
      14              :       //
      15              :       template <typename C>
      16            0 :       error<C>::
      17              :       error (tree::severity s,
      18              :              const std::basic_string<C>& id,
      19              :              unsigned long line,
      20              :              unsigned long column,
      21              :              const std::basic_string<C>& message)
      22            0 :           : severity_ (s),
      23            0 :             id_ (id),
      24            0 :             line_ (line),
      25            0 :             column_ (column),
      26            0 :             message_ (message)
      27              :       {
      28            0 :       }
      29              : 
      30              :       template <typename C>
      31              :       error<C>::
      32              :       error ()
      33              :           : severity_ (tree::severity::error), line_ (0), column_ (0)
      34              :       {
      35              :       }
      36              : 
      37              :       template <typename C>
      38              :       std::basic_ostream<C>&
      39            0 :       operator<< (std::basic_ostream<C>& os, const error<C>& e)
      40              :       {
      41            0 :         return os << e.id () << C (':') << e.line () << C (':') << e.column ()
      42            0 :                   << (e.severity () == severity::error
      43            0 :                       ? bits::ex_error_error<C> ()
      44            0 :                       : bits::ex_error_warning<C> ()) << e.message ();
      45              :       }
      46              : 
      47              :       // diagnostics
      48              :       //
      49              :       template <typename C>
      50              :       std::basic_ostream<C>&
      51            0 :       operator<< (std::basic_ostream<C>& os, const diagnostics<C>& d)
      52              :       {
      53            0 :         for (typename diagnostics<C>::const_iterator b (d.begin ()), i (b);
      54            0 :              i != d.end ();
      55            0 :              ++i)
      56              :         {
      57            0 :           if (i != b)
      58            0 :             os << C ('\n');
      59              : 
      60            0 :           os << *i;
      61              :         }
      62              : 
      63            0 :         return os;
      64              :       }
      65              : 
      66              :       // parsing
      67              :       //
      68              :       template <typename C>
      69            0 :       parsing<C>::
      70              :       ~parsing () throw ()
      71              :       {
      72            0 :       }
      73              : 
      74              :       template <typename C>
      75            0 :       parsing<C>::
      76            0 :       parsing ()
      77              :       {
      78            0 :       }
      79              : 
      80              :       template <typename C>
      81            0 :       parsing<C>::
      82              :       parsing (const tree::diagnostics<C>& diagnostics)
      83            0 :           : diagnostics_ (diagnostics)
      84              :       {
      85            0 :       }
      86              : 
      87              :       template <typename C>
      88            0 :       const char* parsing<C>::
      89              :       what () const throw ()
      90              :       {
      91            0 :         return "instance document parsing failed";
      92              :       }
      93              : 
      94              :       template <typename C>
      95            0 :       void parsing<C>::
      96              :       print (std::basic_ostream<C>& os) const
      97              :       {
      98            0 :         if (diagnostics_.empty ())
      99            0 :           os << bits::ex_parsing_msg<C> ();
     100              :         else
     101            0 :           os << diagnostics_;
     102            0 :       }
     103              : 
     104              :       // expected_element
     105              :       //
     106              :       template <typename C>
     107              :       expected_element<C>::
     108              :       ~expected_element () throw ()
     109              :       {
     110              :       }
     111              : 
     112              :       template <typename C>
     113              :       expected_element<C>::
     114              :       expected_element (const std::basic_string<C>& name,
     115              :                         const std::basic_string<C>& namespace_)
     116              :           : name_ (name), namespace__ (namespace_)
     117              :       {
     118              :       }
     119              : 
     120              :       template <typename C>
     121              :       const char* expected_element<C>::
     122              :       what () const throw ()
     123              :       {
     124              :         return "expected element not encountered";
     125              :       }
     126              : 
     127              :       template <typename C>
     128              :       void expected_element<C>::
     129              :       print (std::basic_ostream<C>& os) const
     130              :       {
     131              :         os << bits::ex_eel_expected<C> ();
     132              : 
     133              :         if (!namespace_ ().empty ())
     134              :           os << namespace_ () << C ('#');
     135              : 
     136              :         os << name () << C ('\'');
     137              :       }
     138              : 
     139              :       // unexpected_element
     140              :       //
     141              :       template <typename C>
     142            0 :       unexpected_element<C>::
     143              :       ~unexpected_element () throw ()
     144              :       {
     145            0 :       }
     146              : 
     147              :       template <typename C>
     148            0 :       unexpected_element<C>::
     149              :       unexpected_element (const std::basic_string<C>& encountered_name,
     150              :                           const std::basic_string<C>& encountered_namespace,
     151              :                           const std::basic_string<C>& expected_name,
     152              :                           const std::basic_string<C>& expected_namespace)
     153            0 :           : encountered_name_ (encountered_name),
     154            0 :             encountered_namespace_ (encountered_namespace),
     155            0 :             expected_name_ (expected_name),
     156            0 :             expected_namespace_ (expected_namespace)
     157              :       {
     158            0 :       }
     159              : 
     160              :       template <typename C>
     161            0 :       const char* unexpected_element<C>::
     162              :       what () const throw ()
     163              :       {
     164            0 :         return "unexpected element encountered";
     165              :       }
     166              : 
     167              :       template <typename C>
     168            0 :       void unexpected_element<C>::
     169              :       print (std::basic_ostream<C>& os) const
     170              :       {
     171            0 :         if (!expected_name ().empty ())
     172              :         {
     173            0 :           os << bits::ex_uel_expected<C> ();
     174              : 
     175            0 :           if (!expected_namespace ().empty ())
     176            0 :             os << expected_namespace () << C ('#');
     177              : 
     178            0 :           os << expected_name () << bits::ex_uel_instead<C> ();
     179              : 
     180            0 :           if (!encountered_namespace ().empty ())
     181            0 :             os << encountered_namespace () << C ('#');
     182              : 
     183            0 :           os << encountered_name () << C ('\'');
     184              :         }
     185              :         else
     186              :         {
     187            0 :           os << bits::ex_uel_unexpected<C> ();
     188              : 
     189            0 :           if (!encountered_namespace ().empty ())
     190            0 :             os << encountered_namespace () << C ('#');
     191              : 
     192            0 :           os << encountered_name () << C ('\'');
     193              :         }
     194            0 :       }
     195              : 
     196              :       // expected_attribute
     197              :       //
     198              :       template <typename C>
     199            0 :       expected_attribute<C>::
     200              :       ~expected_attribute () throw ()
     201              :       {
     202            0 :       }
     203              : 
     204              :       template <typename C>
     205            0 :       expected_attribute<C>::
     206              :       expected_attribute (const std::basic_string<C>& name,
     207              :                           const std::basic_string<C>& namespace_)
     208            0 :           : name_ (name), namespace__ (namespace_)
     209              :       {
     210            0 :       }
     211              : 
     212              :       template <typename C>
     213            0 :       const char* expected_attribute<C>::
     214              :       what () const throw ()
     215              :       {
     216            0 :         return "expected attribute not encountered";
     217              :       }
     218              : 
     219              :       template <typename C>
     220            0 :       void expected_attribute<C>::
     221              :       print (std::basic_ostream<C>& os) const
     222              :       {
     223            0 :         os << bits::ex_eat_expected<C> ();
     224              : 
     225            0 :         if (!namespace_ ().empty ())
     226            0 :           os << namespace_ () << C ('#');
     227              : 
     228            0 :         os << name () << C ('\'');
     229            0 :       }
     230              : 
     231              :       // unexpected_enumerator
     232              :       //
     233              :       template <typename C>
     234              :       unexpected_enumerator<C>::
     235              :       ~unexpected_enumerator () throw ()
     236              :       {
     237              :       }
     238              : 
     239              :       template <typename C>
     240              :       unexpected_enumerator<C>::
     241              :       unexpected_enumerator (const std::basic_string<C>& enumerator)
     242              :           : enumerator_ (enumerator)
     243              :       {
     244              :       }
     245              : 
     246              :       template <typename C>
     247              :       const char* unexpected_enumerator<C>::
     248              :       what () const throw ()
     249              :       {
     250              :         return "unexpected enumerator encountered";
     251              :       }
     252              : 
     253              :       template <typename C>
     254              :       void unexpected_enumerator<C>::
     255              :       print (std::basic_ostream<C>& os) const
     256              :       {
     257              :         os << bits::ex_uen_unexpected<C> () << enumerator () << C ('\'');
     258              :       }
     259              : 
     260              :       // expected_text_content
     261              :       //
     262              :       template <typename C>
     263            0 :       const char* expected_text_content<C>::
     264              :       what () const throw ()
     265              :       {
     266            0 :         return "expected text content";
     267              :       }
     268              : 
     269              :       template <typename C>
     270            0 :       void expected_text_content<C>::
     271              :       print (std::basic_ostream<C>& os) const
     272              :       {
     273            0 :         os << bits::ex_etc_msg<C> ();
     274            0 :       }
     275              : 
     276              :       // no_type_info
     277              :       //
     278              :       template <typename C>
     279              :       no_type_info<C>::
     280              :       ~no_type_info () throw ()
     281              :       {
     282              :       }
     283              : 
     284              :       template <typename C>
     285              :       no_type_info<C>::
     286              :       no_type_info (const std::basic_string<C>& type_name,
     287              :                     const std::basic_string<C>& type_namespace)
     288              :           : type_name_ (type_name),
     289              :             type_namespace_ (type_namespace)
     290              :       {
     291              :       }
     292              : 
     293              :       template <typename C>
     294              :       const char* no_type_info<C>::
     295              :       what () const throw ()
     296              :       {
     297              :         return "no type information available for a type";
     298              :       }
     299              : 
     300              :       template <typename C>
     301              :       void no_type_info<C>::
     302              :       print (std::basic_ostream<C>& os) const
     303              :       {
     304              :         os << bits::ex_nti_no_type_info<C> ();
     305              : 
     306              :         if (!type_namespace ().empty ())
     307              :           os << type_namespace () << C ('#');
     308              : 
     309              :         os << type_name () << C ('\'');
     310              :       }
     311              : 
     312              :       // no_element_info
     313              :       //
     314              :       template <typename C>
     315              :       no_element_info<C>::
     316              :       ~no_element_info () throw ()
     317              :       {
     318              :       }
     319              : 
     320              :       template <typename C>
     321              :       no_element_info<C>::
     322              :       no_element_info (const std::basic_string<C>& element_name,
     323              :                        const std::basic_string<C>& element_namespace)
     324              :           : element_name_ (element_name),
     325              :             element_namespace_ (element_namespace)
     326              :       {
     327              :       }
     328              : 
     329              :       template <typename C>
     330              :       const char* no_element_info<C>::
     331              :       what () const throw ()
     332              :       {
     333              :         return "no parsing or serialization information available for "
     334              :           "an element";
     335              :       }
     336              : 
     337              :       template <typename C>
     338              :       void no_element_info<C>::
     339              :       print (std::basic_ostream<C>& os) const
     340              :       {
     341              :         os << bits::ex_nei_no_element_info<C> ();
     342              : 
     343              :         if (!element_namespace ().empty ())
     344              :           os << element_namespace () << C ('#');
     345              : 
     346              :         os << element_name () << C ('\'');
     347              :       }
     348              : 
     349              :       // not_derived
     350              :       //
     351              :       template <typename C>
     352              :       not_derived<C>::
     353              :       ~not_derived () throw ()
     354              :       {
     355              :       }
     356              : 
     357              :       template <typename C>
     358              :       not_derived<C>::
     359              :       not_derived (const std::basic_string<C>& base_type_name,
     360              :                    const std::basic_string<C>& base_type_namespace,
     361              :                    const std::basic_string<C>& derived_type_name,
     362              :                    const std::basic_string<C>& derived_type_namespace)
     363              :           : base_type_name_ (base_type_name),
     364              :             base_type_namespace_ (base_type_namespace),
     365              :             derived_type_name_ (derived_type_name),
     366              :             derived_type_namespace_ (derived_type_namespace)
     367              :       {
     368              :       }
     369              : 
     370              :       template <typename C>
     371              :       const char* not_derived<C>::
     372              :       what () const throw ()
     373              :       {
     374              :         return "type is not derived";
     375              :       }
     376              : 
     377              :       template <typename C>
     378              :       void not_derived<C>::
     379              :       print (std::basic_ostream<C>& os) const
     380              :       {
     381              :         os << bits::ex_nd_type<C> ();
     382              : 
     383              :         if (!derived_type_namespace ().empty ())
     384              :           os << derived_type_namespace () << C ('#');
     385              : 
     386              :         os << derived_type_name () << bits::ex_nd_not_derived<C> ();
     387              : 
     388              :         if (!base_type_namespace ().empty ())
     389              :           os << base_type_namespace () << C ('#');
     390              : 
     391              :         os << base_type_name () << C ('\'');
     392              :       }
     393              : 
     394              :       // duplicate_id
     395              :       //
     396              :       template <typename C>
     397              :       duplicate_id<C>::
     398              :       ~duplicate_id () throw ()
     399              :       {
     400              :       }
     401              : 
     402              :       template <typename C>
     403              :       duplicate_id<C>::
     404              :       duplicate_id (const std::basic_string<C>& id)
     405              :           : id_ (id)
     406              :       {
     407              :       }
     408              : 
     409              :       template <typename C>
     410              :       const char* duplicate_id<C>::
     411              :       what () const throw ()
     412              :       {
     413              :         return "ID already exist";
     414              :       }
     415              : 
     416              :       template <typename C>
     417              :       void duplicate_id<C>::
     418              :       print (std::basic_ostream<C>& os) const
     419              :       {
     420              :         os << bits::ex_di_id<C> () << id () << bits::ex_di_already_exist<C> ();
     421              :       }
     422              : 
     423              :       // serialization
     424              :       //
     425              :       template <typename C>
     426            0 :       serialization<C>::
     427              :       ~serialization () throw ()
     428              :       {
     429            0 :       }
     430              : 
     431              :       template <typename C>
     432            0 :       serialization<C>::
     433            0 :       serialization ()
     434              :       {
     435            0 :       }
     436              : 
     437              :       template <typename C>
     438            0 :       serialization<C>::
     439              :       serialization (const tree::diagnostics<C>& diagnostics)
     440            0 :           : diagnostics_ (diagnostics)
     441              :       {
     442            0 :       }
     443              : 
     444              :       template <typename C>
     445            0 :       const char* serialization<C>::
     446              :       what () const throw ()
     447              :       {
     448            0 :         return "serialization failed";
     449              :       }
     450              : 
     451              :       template <typename C>
     452            0 :       void serialization<C>::
     453              :       print (std::basic_ostream<C>& os) const
     454              :       {
     455            0 :         if (diagnostics_.empty ())
     456            0 :           os << bits::ex_serialization_msg<C> ();
     457              :         else
     458            0 :           os << diagnostics_;
     459            0 :       }
     460              : 
     461              : 
     462              :       // no_prefix_mapping
     463              :       //
     464              :       template <typename C>
     465              :       no_prefix_mapping<C>::
     466              :       ~no_prefix_mapping () throw ()
     467              :       {
     468              :       }
     469              : 
     470              :       template <typename C>
     471              :       no_prefix_mapping<C>::
     472              :       no_prefix_mapping (const std::basic_string<C>& prefix)
     473              :           : prefix_ (prefix)
     474              :       {
     475              :       }
     476              : 
     477              :       template <typename C>
     478              :       const char* no_prefix_mapping<C>::
     479              :       what () const throw ()
     480              :       {
     481              :         return "no mapping provided for a namespace prefix";
     482              :       }
     483              : 
     484              :       template <typename C>
     485              :       void no_prefix_mapping<C>::
     486              :       print (std::basic_ostream<C>& os) const
     487              :       {
     488              :         os << bits::ex_npm_no_mapping<C> () << prefix () << C ('\'');
     489              :       }
     490              : 
     491              : 
     492              :       // bounds
     493              :       //
     494              :       template <typename C>
     495            0 :       const char* bounds<C>::
     496              :       what () const throw ()
     497              :       {
     498            0 :         return "buffer boundary rules have been violated";
     499              :       }
     500              : 
     501              :       template <typename C>
     502            0 :       void bounds<C>::
     503              :       print (std::basic_ostream<C>& os) const
     504              :       {
     505            0 :         os << bits::ex_bounds_msg<C> ();
     506            0 :       }
     507              :     }
     508              :   }
     509              : }
        

Generated by: LCOV version 2.0-1