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

            Line data    Source code
       1              : // file      : xsd/cxx/tree/text.txx
       2              : // copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
       3              : // license   : GNU GPL v2 + exceptions; see accompanying LICENSE file
       4              : 
       5              : #include <xercesc/dom/DOMText.hpp>
       6              : 
       7              : #include <xsd/cxx/xml/string.hxx>
       8              : 
       9              : #include <xsd/cxx/tree/exceptions.hxx>
      10              : 
      11              : namespace xsd
      12              : {
      13              :   namespace cxx
      14              :   {
      15              :     namespace tree
      16              :     {
      17              :       template <typename C>
      18              :       std::basic_string<C>
      19            0 :       text_content (const xercesc::DOMElement& e)
      20              :       {
      21              :         using xercesc::DOMNode;
      22              :         using xercesc::DOMText;
      23              : 
      24            0 :         DOMNode* n (e.getFirstChild ());
      25              : 
      26              :         // Fast path.
      27              :         //
      28            0 :         if (n != 0 &&
      29            0 :             n->getNodeType () == DOMNode::TEXT_NODE &&
      30            0 :             n->getNextSibling () == 0)
      31              :         {
      32            0 :           DOMText* t (static_cast<DOMText*> (n));
      33            0 :           return xml::transcode<C> (t->getData (), t->getLength ());
      34              :         }
      35              : 
      36            0 :         std::basic_string<C> r;
      37              : 
      38            0 :         for (; n != 0; n = n->getNextSibling ())
      39              :         {
      40            0 :           switch (n->getNodeType ())
      41              :           {
      42            0 :           case DOMNode::TEXT_NODE:
      43              :           case DOMNode::CDATA_SECTION_NODE:
      44              :             {
      45            0 :               DOMText* t (static_cast<DOMText*> (n));
      46            0 :               r += xml::transcode<C> (t->getData (), t->getLength ());
      47            0 :               break;
      48              :             }
      49            0 :           case DOMNode::ELEMENT_NODE:
      50              :             {
      51            0 :               throw expected_text_content<C> ();
      52              :             }
      53            0 :           default:
      54            0 :             break; // ignore
      55              :           }
      56              :         }
      57              : 
      58            0 :         return r;
      59            0 :       }
      60              :     }
      61              :   }
      62              : }
        

Generated by: LCOV version 2.0-1