acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
node.h
1#pragma once
2//#include "acme/prototype/prototype/payload.h"
3//#include "acme/prototype/collection/pointer_array.h"
4
5
6namespace data
7{
8
9
10 enum enum_node
11 {
12
13 e_node_none,
14 e_node_xml_element, // general node '<matter>...</matter>' or <matter/>
15 e_node_xml_pi, // <?xml version="1.0" ?>
16 e_node_xml_comment, // <!-- comment -->
17 e_node_xml_cdata, // <![CDATA[ cdata ]]>
18 e_node_xml_document, // internal virtual root
19 e_node_xml_text // special node_element - final node matter
20
21 };
22
23
24 class CLASS_DECL_ACME node :
25 virtual public ::particle
26 {
27
28 public:
29
30
31 typedef pointer_array < node > array;
32
33 ::xml::node * m_pxmlnode;
34 node * m_pnodeParent;
35 enum_node m_enode;
36 string m_strName;
37 string m_strValue;
38 ::property_set m_set;
39 node::array m_nodea;
40
41 node();
42 ~node() override;
43
44
45 string name() const { return m_strName; }
46 void set_name(const ::scoped_string & scopedstrName) { m_strName = scopedstrName; }
47
48
49 string value() const { return m_strValue; }
50 void set_value(const ::scoped_string & scopedstrValue) { m_strValue = scopedstrValue; }
51
52
53 inline enum_node get_type() const { return m_enode; }
54 inline void set_type(enum_node enode) { m_enode = enode; }
55
56 inline ::xml::node* get_xml_node() const { return m_pxmlnode; }
57
58 virtual ::xml::document* get_xml_document() const;
59
60
61
62 payload attribute(const ::scoped_string & scopedstr) const { return m_set[scopedstr]; }
63 ::property& attribute(const ::scoped_string & scopedstr) { return m_set[scopedstr]; }
64
65
66
67 node* node_at(::collection::index i) { return m_nodea[i]; }
68 ::collection::count get_node_count() const { return m_nodea.get_count(); }
69
70
71 };
72
73
74 inline ::xml::node* __xml(::data::node* pnode) { return pnode == nullptr ? nullptr : pnode->get_xml_node(); }
75
76} // namespace acme
77
78
79
Definition property.h:16
Definition payload.h:54
Definition property_set.h:512