LCOV - code coverage report
Current view: top level - libreoffice/workdir/unxlngi6.pro/UnpackedTarball/orcus/include/orcus - dom_tree.hpp (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-12-17 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*************************************************************************
       2             :  *
       3             :  * Copyright (c) 2012 Kohei Yoshida
       4             :  *
       5             :  * Permission is hereby granted, free of charge, to any person
       6             :  * obtaining a copy of this software and associated documentation
       7             :  * files (the "Software"), to deal in the Software without
       8             :  * restriction, including without limitation the rights to use,
       9             :  * copy, modify, merge, publish, distribute, sublicense, and/or sell
      10             :  * copies of the Software, and to permit persons to whom the
      11             :  * Software is furnished to do so, subject to the following
      12             :  * conditions:
      13             :  *
      14             :  * The above copyright notice and this permission notice shall be
      15             :  * included in all copies or substantial portions of the Software.
      16             :  *
      17             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
      18             :  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
      19             :  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
      20             :  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
      21             :  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
      22             :  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      23             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
      24             :  * OTHER DEALINGS IN THE SOFTWARE.
      25             :  *
      26             :  ************************************************************************/
      27             : 
      28             : #ifndef __ORCUS_DOM_TREE_HPP__
      29             : #define __ORCUS_DOM_TREE_HPP__
      30             : 
      31             : #include "pstring.hpp"
      32             : #include "types.hpp"
      33             : 
      34             : #include <vector>
      35             : #include <ostream>
      36             : 
      37             : #include <boost/ptr_container/ptr_vector.hpp>
      38             : 
      39             : namespace orcus {
      40             : 
      41             : class xmlns_context;
      42             : struct dom_tree_impl;
      43             : 
      44             : /**
      45             :  * Ordinary DOM tree representing the structure of a XML content in full.
      46             :  */
      47             : class ORCUS_DLLPUBLIC dom_tree
      48             : {
      49             :     dom_tree(const dom_tree&); // disabled
      50             :     dom_tree& operator= (const dom_tree&); // disabled
      51             : 
      52             : public:
      53             : 
      54           0 :     struct entity_name
      55             :     {
      56             :         xmlns_id_t ns;
      57             :         pstring name;
      58             : 
      59             :         entity_name();
      60             :         entity_name(xmlns_id_t _ns, const pstring& _name);
      61             : 
      62             :         void print(std::ostream& os, const xmlns_context& cxt) const;
      63             :     };
      64             : 
      65             :     struct attr
      66             :     {
      67             :         entity_name name;
      68             :         pstring value;
      69             : 
      70             :         attr(xmlns_id_t _ns, const pstring& _name, const pstring& _value);
      71             : 
      72             :         void print(std::ostream& os, const xmlns_context& cxt) const;
      73             :     };
      74             : 
      75             :     typedef std::vector<attr> attrs_type;
      76             : 
      77             :     enum node_type { node_element, node_content };
      78             : 
      79             :     struct node
      80             :     {
      81             :         node_type type;
      82             : 
      83           0 :         node(node_type _type) : type(_type) {}
      84             : 
      85             :         virtual ~node() = 0;
      86             :         virtual void print(std::ostream& os, const xmlns_context& cxt) const = 0;
      87             :     };
      88             : 
      89             :     typedef boost::ptr_vector<node> nodes_type;
      90             : 
      91             :     struct element : public node
      92             :     {
      93             :         entity_name name;
      94             :         attrs_type attrs;
      95             :         nodes_type child_nodes;
      96             : 
      97             :         element(xmlns_id_t _ns, const pstring& _name);
      98             :         virtual void print(std::ostream& os, const xmlns_context& cxt) const;
      99             :         virtual ~element();
     100             :     };
     101             : 
     102             :     typedef std::vector<element*> element_stack_type;
     103             : 
     104             :     struct content : public node
     105             :     {
     106             :         pstring value;
     107             : 
     108             :         content(const pstring& _value);
     109             :         virtual void print(std::ostream& os, const xmlns_context& cxt) const;
     110             :         virtual ~content();
     111             :     };
     112             : 
     113             :     dom_tree(xmlns_context& cxt);
     114             :     ~dom_tree();
     115             : 
     116             :     void end_declaration();
     117             :     void start_element(xmlns_id_t ns, const pstring& name);
     118             :     void end_element(xmlns_id_t ns, const pstring& name);
     119             :     void set_characters(const pstring& val);
     120             :     void set_attribute(xmlns_id_t ns, const pstring& name, const pstring& val);
     121             : 
     122             :     void dump_compact(std::ostream& os) const;
     123             : 
     124             : private:
     125             :     dom_tree_impl* mp_impl;
     126             : };
     127             : 
     128             : }
     129             : 
     130             : #endif

Generated by: LCOV version 1.10