Orcus
include
orcus
dom_tree.hpp
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
*/
7
8
#ifndef INCLUDED_ORCUS_DOM_TREE_HPP
9
#define INCLUDED_ORCUS_DOM_TREE_HPP
10
11
#include "pstring.hpp"
12
#include "types.hpp"
13
14
#include <vector>
15
#include <ostream>
16
#include <memory>
17
18
namespace
orcus {
19
20
class
xmlns_context;
21
22
namespace
sax {
23
24
struct
doctype_declaration;
25
26
}
27
28
namespace
dom {
29
30
class
document_tree;
31
32
enum class
node_t : uint8_t
33
{
34
unset,
35
declaration,
36
element,
37
};
38
39
struct
ORCUS_DLLPUBLIC
entity_name
40
{
41
xmlns_id_t ns;
42
pstring
name;
43
44
entity_name
();
45
entity_name
(
const
pstring
& _name);
46
entity_name
(xmlns_id_t _ns,
const
pstring
& _name);
47
48
bool
operator== (
const
entity_name
& other)
const
;
49
bool
operator!= (
const
entity_name
& other)
const
;
50
};
51
52
class
ORCUS_DLLPUBLIC
const_node
53
{
54
friend
class
document_tree
;
55
56
struct
impl;
57
std::unique_ptr<impl> mp_impl;
58
59
const_node
(std::unique_ptr<impl>&& _impl);
60
public
:
61
const_node
();
62
const_node
(
const
const_node
& other);
63
const_node
(
const_node
&& other);
64
65
~
const_node
();
66
67
node_t type()
const
;
68
69
size_t
child_count()
const
;
70
71
const_node
child(
size_t
index)
const
;
72
73
entity_name
name()
const
;
74
75
pstring
attribute(
const
entity_name
& name)
const
;
76
pstring
attribute(
const
pstring
& name)
const
;
77
78
size_t
attribute_count()
const
;
79
80
const_node
parent()
const
;
81
82
void
swap(
const_node
& other);
83
84
const_node
& operator= (
const
const_node
& other);
85
86
bool
operator== (
const
const_node
& other)
const
;
87
bool
operator!= (
const
const_node
& other)
const
;
88
};
89
93
class
ORCUS_DLLPUBLIC
document_tree
94
{
95
struct
impl;
96
std::unique_ptr<impl> mp_impl;
97
98
public
:
99
document_tree
(
const
document_tree
&) =
delete
;
100
document_tree
& operator= (
const
document_tree
&) =
delete
;
101
102
document_tree
(
xmlns_context
& cxt);
103
document_tree
(
document_tree
&& other);
104
~
document_tree
();
105
111
void
load
(
const
std::string& strm);
112
113
void
load(
const
char
* p_strm,
size_t
n_strm);
114
115
dom::const_node
root()
const
;
116
117
dom::const_node
declaration(
const
pstring
& name)
const
;
118
124
void
swap
(
document_tree
& other);
125
126
const
sax::doctype_declaration
* get_doctype()
const
;
127
128
void
dump_compact(std::ostream& os)
const
;
129
};
130
131
}
// namespace dom
132
133
}
134
135
#endif
136
137
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
orcus::dom::const_node
Definition:
dom_tree.hpp:53
orcus::dom::document_tree
Definition:
dom_tree.hpp:94
orcus::dom::document_tree::swap
void swap(document_tree &other)
orcus::dom::document_tree::load
void load(const std::string &strm)
orcus::pstring
Definition:
pstring.hpp:28
orcus::xmlns_context
Definition:
xml_namespace.hpp:83
orcus::dom::entity_name
Definition:
dom_tree.hpp:40
orcus::sax::doctype_declaration
Definition:
sax_parser_base.hpp:46
Generated on Sat Aug 7 2021 00:00:00 for Orcus by
1.9.1