LCOV - code coverage report
Current view: top level - xsd/cxx/tree - error-handler.hxx (source / functions) Hit Total Coverage
Test: lcov-run.info Lines: 6 6 100.0 %
Date: 2019-02-15 00:00:25 Functions: 1 3 33.3 %
Branches: 3 4 75.0 %

           Branch data     Line data    Source code
       1                 :            : // file      : xsd/cxx/tree/error-handler.hxx
       2                 :            : // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
       3                 :            : // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file
       4                 :            : 
       5                 :            : #ifndef XSD_CXX_TREE_ERROR_HANDLER_HXX
       6                 :            : #define XSD_CXX_TREE_ERROR_HANDLER_HXX
       7                 :            : 
       8                 :            : #include <xsd/cxx/xml/error-handler.hxx>
       9                 :            : 
      10                 :            : #include <xsd/cxx/tree/exceptions.hxx>
      11                 :            : 
      12                 :            : namespace xsd
      13                 :            : {
      14                 :            :   namespace cxx
      15                 :            :   {
      16                 :            :     namespace tree
      17                 :            :     {
      18                 :            :       template <typename C>
      19                 :          1 :       class error_handler: public xml::error_handler<C>
      20                 :            :       {
      21                 :            :       public:
      22                 :            :         typedef typename xml::error_handler<C>::severity severity;
      23                 :            : 
      24                 :            :         error_handler ()
      25                 :          2 :             : failed_ (false)
      26                 :            :         {
      27                 :            :         }
      28                 :            : 
      29                 :            :         virtual bool
      30                 :            :         handle (const std::basic_string<C>& id,
      31                 :            :                 unsigned long line,
      32                 :            :                 unsigned long column,
      33                 :            :                 severity,
      34                 :            :                 const std::basic_string<C>& message);
      35                 :            : 
      36                 :            :         template <typename E>
      37                 :            :         void
      38                 :          2 :         throw_if_failed () const
      39                 :            :         {
      40         [ +  + ]:          2 :           if (failed_)
      41         [ +  - ]:          1 :             throw E (diagnostics_);
      42                 :          1 :         }
      43                 :            : 
      44                 :            :         void
      45                 :            :         reset ()
      46                 :            :         {
      47                 :            :           failed_ = false;
      48                 :            :           diagnostics_.clear ();
      49                 :            :         }
      50                 :            : 
      51                 :            :       private:
      52                 :            :         bool failed_;
      53                 :            :         diagnostics<C> diagnostics_;
      54                 :            :       };
      55                 :            :     }
      56                 :            :   }
      57                 :            : }
      58                 :            : 
      59                 :            : #include <xsd/cxx/tree/error-handler.txx>
      60                 :            : 
      61                 :            : #endif  // XSD_CXX_TREE_ERROR_HANDLER_HXX

Generated by: LCOV version 1.12