ITK
6.0.0
Insight Toolkit
|
#include <itkDOMNode.h>
Class to represent a node in a Document Object Model (DOM) tree structure.
A DOM is a structured document representation, in our case parsed from an XML stream (i.e. a file or a string). It is a tree structure in which each node has links to its children nodes and to its parent node (if it is not the root). This class serves as a base node corresponding to an XML tag that only contains attributes (no content for the tag itself).
Definition at line 53 of file itkDOMNode.h.
Public Types | |
using | AttributeItemType = std::pair< const AttributeKeyType, AttributeValueType > |
using | AttributeKeyType = std::string |
using | AttributesListType = std::list< AttributeItemType > |
using | AttributeValueType = std::string |
using | ChildrenListType = std::vector< DOMNode * > |
using | ConstChildrenListType = std::vector< const DOMNode * > |
using | ConstPointer = SmartPointer< const Self > |
using | IdentifierType = int |
using | OffsetType = int |
using | Pointer = SmartPointer< Self > |
using | Self = DOMNode |
using | SizeType = vcl_size_t |
using | Superclass = Object |
Public Types inherited from itk::Object | |
using | ConstPointer = SmartPointer< const Self > |
using | Pointer = SmartPointer< Self > |
using | Self = Object |
using | Superclass = LightObject |
Public Types inherited from itk::LightObject | |
using | ConstPointer = SmartPointer< const Self > |
using | Pointer = SmartPointer< Self > |
using | Self = LightObject |
Public Member Functions | |
virtual void | AddChild (DOMNode *node, IdentifierType i=0) |
virtual void | AddChildAtBegin (DOMNode *node) |
virtual void | AddChildAtEnd (DOMNode *node) |
virtual void | AddTextChild (const std::string &text, IdentifierType i=0) |
virtual void | AddTextChildAtBegin (const std::string &text) |
virtual void | AddTextChildAtEnd (const std::string &text) |
virtual void | GetAllAttributes (AttributesListType &output, bool keepOriginalOrder=true) const |
virtual void | GetAllChildren (ChildrenListType &output) |
virtual void | GetAllChildren (ConstChildrenListType &output) const |
virtual std::string | GetAttribute (const std::string &key) const |
virtual void | GetChildren (const std::string &tag, ChildrenListType &output) |
virtual void | GetChildren (const std::string &tag, ConstChildrenListType &output) const |
const char * | GetNameOfClass () const override |
virtual SizeType | GetNumberOfChildren () const |
virtual std::string | GetPath () const |
virtual bool | HasAttribute (const std::string &key) const |
virtual void | RemoveAllAttributes () |
virtual void | RemoveAllAttributesAndChildren () |
virtual void | RemoveAllChildren () |
virtual void | RemoveAttribute (const std::string &key) |
virtual void | RemoveChild (IdentifierType i=0) |
virtual void | SetAttribute (const std::string &key, const std::string &value) |
virtual void | SetChild (DOMNode *node, IdentifierType i=0) |
virtual void | SetTextChild (const std::string &text, IdentifierType i=0) |
virtual bool | ShareRoot (const DOMNode *node) const |
virtual void | SetParent (DOMNode *node) |
DOMNode * | GetParent () |
const DOMNode * | GetParent () const |
virtual void | SetName (const std::string &_arg) |
virtual const std::string & | GetName () const |
virtual void | SetID (const std::string &_arg) |
virtual const std::string & | GetID () const |
virtual DOMNode * | GetChild (IdentifierType i=0) |
virtual const DOMNode * | GetChild (IdentifierType i=0) const |
virtual DOMNode * | GetChild (const std::string &tag, IdentifierType i=0) |
virtual const DOMNode * | GetChild (const std::string &tag, IdentifierType i=0) const |
virtual DOMNode * | GetChildByID (const std::string &value) |
virtual const DOMNode * | GetChildByID (const std::string &value) const |
virtual DOMNode * | GetSibling (OffsetType i) |
virtual const DOMNode * | GetSibling (OffsetType i) const |
virtual DOMNode * | GetRoot () |
virtual const DOMNode * | GetRoot () const |
virtual DOMNode * | Find (const std::string &path) |
virtual const DOMNode * | Find (const std::string &path) const |
virtual DOMTextNode * | GetTextChild (IdentifierType i=0) |
virtual const DOMTextNode * | GetTextChild (IdentifierType i=0) const |
Public Member Functions inherited from itk::Object | |
unsigned long | AddObserver (const EventObject &event, Command *cmd) const |
unsigned long | AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const |
LightObject::Pointer | CreateAnother () const override |
virtual void | DebugOff () const |
virtual void | DebugOn () const |
Command * | GetCommand (unsigned long tag) |
bool | GetDebug () const |
MetaDataDictionary & | GetMetaDataDictionary () |
const MetaDataDictionary & | GetMetaDataDictionary () const |
virtual ModifiedTimeType | GetMTime () const |
virtual const TimeStamp & | GetTimeStamp () const |
bool | HasObserver (const EventObject &event) const |
void | InvokeEvent (const EventObject &) |
void | InvokeEvent (const EventObject &) const |
virtual void | Modified () const |
void | Register () const override |
void | RemoveAllObservers () |
void | RemoveObserver (unsigned long tag) const |
void | SetDebug (bool debugFlag) const |
void | SetReferenceCount (int) override |
void | UnRegister () const noexcept override |
void | SetMetaDataDictionary (const MetaDataDictionary &rhs) |
void | SetMetaDataDictionary (MetaDataDictionary &&rrhs) |
virtual void | SetObjectName (std::string _arg) |
virtual const std::string & | GetObjectName () const |
Public Member Functions inherited from itk::LightObject | |
Pointer | Clone () const |
virtual void | Delete () |
virtual int | GetReferenceCount () const |
void | Print (std::ostream &os, Indent indent=0) const |
Static Public Member Functions | |
static Pointer | New () |
Static Public Member Functions inherited from itk::Object | |
static bool | GetGlobalWarningDisplay () |
static void | GlobalWarningDisplayOff () |
static void | GlobalWarningDisplayOn () |
static Pointer | New () |
static void | SetGlobalWarningDisplay (bool val) |
Static Public Member Functions inherited from itk::LightObject | |
static void | BreakOnError () |
static Pointer | New () |
Protected Member Functions | |
DOMNode () | |
Protected Member Functions inherited from itk::Object | |
Object () | |
bool | PrintObservers (std::ostream &os, Indent indent) const |
void | PrintSelf (std::ostream &os, Indent indent) const override |
virtual void | SetTimeStamp (const TimeStamp &timeStamp) |
~Object () override | |
Protected Member Functions inherited from itk::LightObject | |
virtual LightObject::Pointer | InternalClone () const |
LightObject () | |
virtual void | PrintHeader (std::ostream &os, Indent indent) const |
virtual void | PrintTrailer (std::ostream &os, Indent indent) const |
virtual | ~LightObject () |
Private Types | |
using | AttributesContainer = std::map< AttributeKeyType, AttributeValueType > |
using | ChildrenContainer = std::vector< Pointer > |
using | OrderedAttributesContainer = std::list< AttributeItemType * > |
Private Attributes | |
AttributesContainer | m_Attributes {} |
ChildrenContainer | m_Children {} |
std::string | m_ID {} |
std::string | m_Name {} |
OrderedAttributesContainer | m_OrderedAttributes {} |
DOMNode * | m_Parent { nullptr } |
Additional Inherited Members | |
Protected Attributes inherited from itk::LightObject | |
std::atomic< int > | m_ReferenceCount {} |
using itk::DOMNode::AttributeItemType = std::pair<const AttributeKeyType, AttributeValueType> |
Definition at line 78 of file itkDOMNode.h.
using itk::DOMNode::AttributeKeyType = std::string |
An attribute is a pair of <key,value>, both key and value are strings.
Definition at line 75 of file itkDOMNode.h.
|
private |
Internally the attributes are stored in a map.
Definition at line 289 of file itkDOMNode.h.
using itk::DOMNode::AttributesListType = std::list<AttributeItemType> |
Container to return the attributes of a DOM node.
Definition at line 81 of file itkDOMNode.h.
using itk::DOMNode::AttributeValueType = std::string |
Definition at line 76 of file itkDOMNode.h.
|
private |
Internally the children are stored in a vector.
Definition at line 285 of file itkDOMNode.h.
using itk::DOMNode::ChildrenListType = std::vector<DOMNode *> |
Container to return all or a subset of the children of a DOM node.
Definition at line 71 of file itkDOMNode.h.
using itk::DOMNode::ConstChildrenListType = std::vector<const DOMNode *> |
Definition at line 72 of file itkDOMNode.h.
using itk::DOMNode::ConstPointer = SmartPointer<const Self> |
Definition at line 62 of file itkDOMNode.h.
using itk::DOMNode::IdentifierType = int |
Definition at line 84 of file itkDOMNode.h.
using itk::DOMNode::OffsetType = int |
Definition at line 85 of file itkDOMNode.h.
|
private |
Container to keep the inserting orders of the attributes.
Definition at line 293 of file itkDOMNode.h.
using itk::DOMNode::Pointer = SmartPointer<Self> |
Definition at line 61 of file itkDOMNode.h.
using itk::DOMNode::Self = DOMNode |
Standard class type aliases.
Definition at line 59 of file itkDOMNode.h.
using itk::DOMNode::SizeType = vcl_size_t |
Definition at line 83 of file itkDOMNode.h.
using itk::DOMNode::Superclass = Object |
Definition at line 60 of file itkDOMNode.h.
|
protected |
|
virtual |
Add a child in front of another child (throw exception if not able to add).
|
virtual |
Add a child in front of the children list (throw exception if not able to add).
|
virtual |
Add a child at the end of the children list (throw exception if not able to add).
|
virtual |
Generate a text node from a string and add/insert it as a child (see AddChild(node,i)).
|
virtual |
Generate a text node from a string and add/insert in front of all children.
|
virtual |
Generate a text node from a string and add/insert at the end of all children.
|
virtual |
The following function finds a child or sibling or relative using a query string or path. A path or QueryString consists of multiple following items that are separated by '/':
* -[n] : an older sibling by distance 1 (when omitted) or n; * +[n] : a younger sibling by distance 1 (when omitted) or n; * n : a child at index n; * <tag>[:n] : a child at index 0 (when omitted) or n after filtering children with a tag name; * ![:n] : a child at index 0 (when omitted) or n within all text children; * :<id> : a child by id; * . : current node; * .. : parent node; * /<rpath> : absolute path (denote apath), search from the root. *
The method returns nullptr if queried node does not exist.
|
virtual |
The following function finds a child or sibling or relative using a query string or path. A path or QueryString consists of multiple following items that are separated by '/':
* -[n] : an older sibling by distance 1 (when omitted) or n; * +[n] : a younger sibling by distance 1 (when omitted) or n; * n : a child at index n; * <tag>[:n] : a child at index 0 (when omitted) or n after filtering children with a tag name; * ![:n] : a child at index 0 (when omitted) or n within all text children; * :<id> : a child by id; * . : current node; * .. : parent node; * /<rpath> : absolute path (denote apath), search from the root. *
The method returns nullptr if queried node does not exist.
|
virtual |
Return all attributes, in the order of being parsed or added (default), or alphabetic order of the attribute keys (keepOriginalOrder = false).
|
virtual |
Return all children.
|
virtual |
Return all children for read-only access.
|
virtual |
Retrieve an attribute by key (return an empty string if not found).
|
virtual |
Retrieve a child by tag name and an index (multiple children can have a same tag name, return nullptr if no such child).
|
virtual |
Retrieve a child by tag name and an index (multiple children can have a same tag name, return nullptr if no such child).
|
virtual |
Retrieve a child by index (return nullptr if i is out of range).
|
virtual |
Retrieve a child by index (return nullptr if i is out of range).
|
virtual |
Retrieve a child by its unique "id" attribute value (return nullptr if not found).
|
virtual |
Retrieve a child by its unique "id" attribute value (return nullptr if not found).
|
virtual |
Return all children of a same tag name.
|
virtual |
Return all children of a same tag name for read-only access.
|
virtual |
Retrieve the special attribute "id" of this node.
|
virtual |
Retrieve the tag name of this node.
|
overridevirtual |
Reimplemented from itk::Object.
Reimplemented in itk::DOMTextNode.
|
virtual |
Get number of children.
DOMNode* itk::DOMNode::GetParent | ( | ) |
Retrieve the parent node.
const DOMNode* itk::DOMNode::GetParent | ( | ) | const |
Retrieve the parent node.
|
virtual |
Return the path of this node within its root, in the form of a query string that uses only indices.
|
virtual |
Return the root node.
|
virtual |
Return the root node.
|
virtual |
Retrieve an older or younger sibling by distance (return nullptr if no such sibling).
|
virtual |
Retrieve an older or younger sibling by distance (return nullptr if no such sibling).
|
virtual |
Get a child and cast it to a text node (return nullptr if out of range or not a text node).
|
virtual |
Get a child and cast it to a text node (return nullptr if out of range or not a text node).
|
virtual |
Check whether has an attribute.
|
static |
Method for creation through the object factory.
|
virtual |
Remove all attributes.
|
virtual |
Remove all attributes and children.
|
virtual |
Remove all children.
|
virtual |
Remove an attribute by key (throw exception if not found).
|
virtual |
Remove a child by index (throw exception if not able to remove).
|
virtual |
Add or replace an attribute.
|
virtual |
Replace a child (throw exception if not able to replace).
|
virtual |
Retrieve the special attribute "id" of this node.
|
virtual |
Retrieve the tag name of this node.
Referenced by itk::DOMTextNode::DOMTextNode().
|
virtual |
Retrieve the parent node.
|
virtual |
Generate a text node from a string and replace a child with it (see SetChild(node,i).
|
virtual |
Test whether the input node and this node share the same root.
|
private |
Definition at line 290 of file itkDOMNode.h.
|
private |
Definition at line 286 of file itkDOMNode.h.
|
private |
The special attribute "id" of this node.
Definition at line 282 of file itkDOMNode.h.
|
private |
The XML tag of this node.
Definition at line 279 of file itkDOMNode.h.
|
private |
Definition at line 294 of file itkDOMNode.h.
|
private |
The parent node that this node was placed into.
Definition at line 276 of file itkDOMNode.h.