LCOV - code coverage report
Current view: top level - xsd/cxx/xml/dom/bits - error-handler-proxy.txx (source / functions) Hit Total Coverage
Test: lcov-run.info Lines: 12 16 75.0 %
Date: 2019-02-15 00:00:25 Functions: 1 1 100.0 %
Branches: 9 17 52.9 %

           Branch data     Line data    Source code
       1                 :            : // file      : xsd/cxx/xml/dom/bits/error-handler-proxy.txx
       2                 :            : // copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
       3                 :            : // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file
       4                 :            : 
       5                 :            : #include <xsd/cxx/xml/string.hxx>
       6                 :            : 
       7                 :            : namespace xsd
       8                 :            : {
       9                 :            :   namespace cxx
      10                 :            :   {
      11                 :            :     namespace xml
      12                 :            :     {
      13                 :            :       namespace dom
      14                 :            :       {
      15                 :            :         namespace bits
      16                 :            :         {
      17                 :            :           template <typename C>
      18                 :          2 :           bool error_handler_proxy<C>::
      19                 :            :           handleError (const xercesc::DOMError& e)
      20                 :            :           {
      21                 :            :             using xercesc::DOMError;
      22                 :            : 
      23         [ +  - ]:          2 :             if (e.getSeverity() != DOMError::DOM_SEVERITY_WARNING)
      24                 :          2 :               failed_ = true;
      25                 :            : 
      26         [ +  + ]:          2 :             if (native_eh_)
      27                 :          1 :               return native_eh_->handleError (e);
      28                 :            :             else
      29                 :            :             {
      30                 :            :               typedef typename error_handler<C>::severity severity;
      31                 :            : 
      32                 :            :               severity s (severity::error);
      33                 :            : 
      34      [ -  -  + ]:          1 :               switch (e.getSeverity())
      35                 :            :               {
      36                 :            :               case DOMError::DOM_SEVERITY_WARNING:
      37                 :            :                 {
      38                 :          0 :                   s = severity::warning;
      39                 :          0 :                   break;
      40                 :            :                 }
      41                 :            :               case DOMError::DOM_SEVERITY_ERROR:
      42                 :            :                 {
      43                 :            :                   s = severity::error;
      44                 :            :                   break;
      45                 :            :                 }
      46                 :            :               case DOMError::DOM_SEVERITY_FATAL_ERROR:
      47                 :            :                 {
      48                 :          0 :                   s = severity::fatal;
      49                 :          0 :                   break;
      50                 :            :                 }
      51                 :            :               }
      52                 :            : 
      53                 :          1 :               xercesc::DOMLocator* loc (e.getLocation ());
      54                 :            : 
      55                 :          2 :               return eh_->handle (
      56                 :          1 :                 transcode<C> (loc->getURI ()),
      57                 :          1 :                 static_cast<unsigned long> (loc->getLineNumber ()),
      58                 :          1 :                 static_cast<unsigned long> (loc->getColumnNumber ()),
      59                 :            :                 s,
      60 [ +  - ][ +  - ]:          3 :                 transcode<C> (e.getMessage ()));
         [ +  - ][ +  - ]
                 [ +  - ]
      61                 :            :             }
      62                 :            :           }
      63                 :            :         }
      64                 :            :       }
      65                 :            :     }
      66                 :            :   }
      67                 :            : }

Generated by: LCOV version 1.12