ITK
5.2.0
Insight Toolkit
ITK
Modules
IO
XML
include
itkDOMNode.h
Go to the documentation of this file.
1
/*=========================================================================
2
*
3
* Copyright NumFOCUS
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0.txt
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*=========================================================================*/
18
19
#ifndef itkDOMNode_h
20
#define itkDOMNode_h
21
22
#include "
itkObject.h
"
23
#include "
itkObjectFactory.h
"
24
#include "ITKIOXMLExport.h"
25
26
#include <string>
27
#include <vector>
28
#include <list>
29
#include <map>
30
31
namespace
itk
32
{
33
34
class
DOMTextNode;
// forward declaration
35
53
class
ITKIOXML_EXPORT
DOMNode
:
public
Object
54
{
55
public
:
56
ITK_DISALLOW_COPY_AND_MOVE(
DOMNode
);
57
59
using
Self
=
DOMNode
;
60
using
Superclass
=
Object
;
61
using
Pointer
=
SmartPointer<Self>
;
62
using
ConstPointer
=
SmartPointer<const Self>
;
63
65
itkNewMacro(
Self
);
66
68
itkTypeMacro(
DOMNode
,
Object
);
69
71
using
ChildrenListType
= std::vector<DOMNode *>;
72
using
ConstChildrenListType
= std::vector<const DOMNode *>;
73
75
using
AttributeKeyType
= std::string;
76
using
AttributeValueType
= std::string;
77
78
using
AttributeItemType
= std::pair<const AttributeKeyType, AttributeValueType>;
79
81
using
AttributesListType
= std::list<AttributeItemType>;
82
83
using
SizeType
= std::size_t;
84
using
IdentifierType
= int;
85
using
OffsetType
= int;
86
88
virtual
void
89
SetParent(
DOMNode
* node);
90
DOMNode
*
91
GetParent();
92
const
DOMNode
*
93
GetParent()
const
;
95
97
itkSetMacro(Name, std::string &);
98
itkGetConstReferenceMacro(Name, std::string);
100
102
itkSetMacro(ID, std::string &);
103
itkGetConstReferenceMacro(ID, std::string);
105
107
virtual
std::string
108
GetAttribute(
const
std::string & key)
const
;
109
111
virtual
bool
112
HasAttribute(
const
std::string & key)
const
;
113
115
virtual
void
116
SetAttribute(
const
std::string & key,
const
std::string & value);
117
119
virtual
void
120
RemoveAttribute(
const
std::string & key);
121
126
virtual
void
127
GetAllAttributes(
AttributesListType
& output,
bool
keepOriginalOrder =
true
)
const
;
128
130
virtual
void
131
RemoveAllAttributes();
132
134
virtual
SizeType
135
GetNumberOfChildren()
const
;
136
138
virtual
void
139
GetAllChildren(
ChildrenListType
& output);
140
142
virtual
void
143
GetAllChildren(
ConstChildrenListType
& output)
const
;
144
146
virtual
void
147
GetChildren(
const
std::string & tag,
ChildrenListType
& output);
148
150
virtual
void
151
GetChildren(
const
std::string & tag,
ConstChildrenListType
& output)
const
;
152
154
virtual
void
155
RemoveAllChildren();
156
158
virtual
void
159
AddChild(
DOMNode
* node,
IdentifierType
i = 0);
160
162
virtual
void
163
AddChildAtBegin(
DOMNode
* node);
164
166
virtual
void
167
AddChildAtEnd(
DOMNode
* node);
168
170
virtual
void
171
SetChild(
DOMNode
* node,
IdentifierType
i = 0);
172
174
virtual
void
175
RemoveChild(
IdentifierType
i = 0);
176
178
virtual
void
179
RemoveAllAttributesAndChildren();
180
182
virtual
DOMNode
*
183
GetChild(
IdentifierType
i = 0);
184
virtual
const
DOMNode
*
185
GetChild(
IdentifierType
i = 0)
const
;
187
190
virtual
DOMNode
*
191
GetChild(
const
std::string & tag,
IdentifierType
i = 0);
192
virtual
const
DOMNode
*
193
GetChild(
const
std::string & tag,
IdentifierType
i = 0)
const
;
195
197
virtual
DOMNode
*
198
GetChildByID(
const
std::string & value);
199
virtual
const
DOMNode
*
200
GetChildByID(
const
std::string & value)
const
;
202
204
virtual
DOMNode
*
205
GetSibling(
OffsetType
i);
206
virtual
const
DOMNode
*
207
GetSibling(
OffsetType
i)
const
;
209
211
virtual
DOMNode
*
212
GetRoot();
213
virtual
const
DOMNode
*
214
GetRoot()
const
;
216
218
virtual
bool
219
ShareRoot(
const
DOMNode
* node)
const
;
220
238
virtual
DOMNode
*
239
Find(
const
std::string & path);
240
virtual
const
DOMNode
*
241
Find(
const
std::string & path)
const
;
243
245
virtual
std::string
246
GetPath()
const
;
247
249
virtual
DOMTextNode
*
250
GetTextChild(
IdentifierType
i = 0);
251
virtual
const
DOMTextNode
*
252
GetTextChild(
IdentifierType
i = 0)
const
;
254
256
virtual
void
257
AddTextChild(
const
std::string & text,
IdentifierType
i = 0);
258
260
virtual
void
261
AddTextChildAtBegin(
const
std::string & text);
262
264
virtual
void
265
AddTextChildAtEnd(
const
std::string & text);
266
268
virtual
void
269
SetTextChild(
const
std::string & text,
IdentifierType
i = 0);
270
271
protected
:
272
DOMNode
();
273
274
private
:
276
DOMNode
* m_Parent{
nullptr
};
277
279
std::string
m_Name
;
280
282
std::string
m_ID
;
283
285
using
ChildrenContainer
= std::vector<Pointer>;
286
ChildrenContainer
m_Children
;
287
289
using
AttributesContainer
= std::map<AttributeKeyType, AttributeValueType>;
290
AttributesContainer
m_Attributes
;
291
293
using
OrderedAttributesContainer
= std::list<AttributeItemType *>;
294
OrderedAttributesContainer
m_OrderedAttributes
;
295
};
296
297
}
// namespace itk
298
299
#include "
itkDOMTextNode.h
"
300
301
#include "
itkStringTools.h
"
302
#include "
itkFancyString.h
"
303
304
#endif // itkDOMNode_h
itkObjectFactory.h
itk::DOMNode::m_OrderedAttributes
OrderedAttributesContainer m_OrderedAttributes
Definition:
itkDOMNode.h:294
itk::DOMNode::AttributesContainer
std::map< AttributeKeyType, AttributeValueType > AttributesContainer
Definition:
itkDOMNode.h:289
itkStringTools.h
itkDOMTextNode.h
itk::DOMNode::IdentifierType
int IdentifierType
Definition:
itkDOMNode.h:84
itk::DOMNode::OrderedAttributesContainer
std::list< AttributeItemType * > OrderedAttributesContainer
Definition:
itkDOMNode.h:293
itk::DOMNode::AttributeValueType
std::string AttributeValueType
Definition:
itkDOMNode.h:76
itk::DOMNode::AttributeKeyType
std::string AttributeKeyType
Definition:
itkDOMNode.h:75
itk::DOMTextNode
Class to represent a special DOM node that holds a text string.
Definition:
itkDOMTextNode.h:40
itkFancyString.h
itk::DOMNode::m_ID
std::string m_ID
Definition:
itkDOMNode.h:282
itk::SmartPointer< Self >
itk::DOMNode::SizeType
std::vcl_size_t SizeType
Definition:
itkDOMNode.h:83
itk::DOMNode::AttributesListType
std::list< AttributeItemType > AttributesListType
Definition:
itkDOMNode.h:81
itk::LightObject
Light weight base class for most itk classes.
Definition:
itkLightObject.h:59
itk::DOMNode::m_Name
std::string m_Name
Definition:
itkDOMNode.h:279
itk::DOMNode::ConstChildrenListType
std::vector< const DOMNode * > ConstChildrenListType
Definition:
itkDOMNode.h:72
itk::DOMNode::OffsetType
int OffsetType
Definition:
itkDOMNode.h:85
itk::DOMNode::ChildrenContainer
std::vector< Pointer > ChildrenContainer
Definition:
itkDOMNode.h:285
itk::DOMNode::m_Attributes
AttributesContainer m_Attributes
Definition:
itkDOMNode.h:290
itk::DOMNode::ChildrenListType
std::vector< DOMNode * > ChildrenListType
Definition:
itkDOMNode.h:71
itk::DOMNode
Class to represent a node in a Document Object Model (DOM) tree structure.
Definition:
itkDOMNode.h:53
itkObject.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition:
itkAnnulusOperator.h:24
itk::Object
Base class for most ITK classes.
Definition:
itkObject.h:62
itk::DOMNode::m_Children
ChildrenContainer m_Children
Definition:
itkDOMNode.h:286
itk::DOMNode::AttributeItemType
std::pair< const AttributeKeyType, AttributeValueType > AttributeItemType
Definition:
itkDOMNode.h:78
Generated on Thu Apr 1 2021 01:41:36 for ITK by
1.8.16