ITK
4.3.0
Insight Segmentation and Registration 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 52 of file itkDOMNode.h.
Public Types | |
typedef std::pair< const AttributeKeyType, AttributeValueType > | AttributeItemType |
typedef std::string | AttributeKeyType |
typedef std::list < AttributeItemType > | AttributesListType |
typedef std::string | AttributeValueType |
typedef std::vector< DOMNode * > | ChildrenListType |
typedef std::vector< const DOMNode * > | ConstChildrenListType |
typedef SmartPointer< const Self > | ConstPointer |
typedef int | IdentifierType |
typedef int | OffsetType |
typedef SmartPointer< Self > | Pointer |
typedef DOMNode | Self |
typedef std::vcl_size_t | SizeType |
typedef Object | Superclass |
Public Types inherited from itk::Object | |
typedef SmartPointer< const Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef Object | Self |
typedef LightObject | Superclass |
Public Types inherited from itk::LightObject | |
typedef SmartPointer< const Self > | ConstPointer |
typedef SmartPointer< Self > | Pointer |
typedef LightObject | Self |
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 ::itk::LightObject::Pointer | CreateAnother (void) const |
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 |
virtual const char * | GetNameOfClass () const |
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 (std::string &_arg) |
virtual const std::string & | GetName () |
virtual void | SetID (std::string &_arg) |
virtual const std::string & | GetID () |
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 *) |
unsigned long | AddObserver (const EventObject &event, Command *) const |
virtual void | DebugOff () const |
virtual void | DebugOn () const |
Command * | GetCommand (unsigned long tag) |
bool | GetDebug () const |
MetaDataDictionary & | GetMetaDataDictionary (void) |
const MetaDataDictionary & | GetMetaDataDictionary (void) 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 |
virtual void | Register () const |
void | RemoveAllObservers () |
void | RemoveObserver (unsigned long tag) |
void | SetDebug (bool debugFlag) const |
void | SetMetaDataDictionary (const MetaDataDictionary &rhs) |
virtual void | SetReferenceCount (int) |
virtual void | UnRegister () const |
Public Member Functions inherited from itk::LightObject | |
virtual void | Delete () |
virtual int | GetReferenceCount () const |
itkCloneMacro (Self) | |
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 flag) |
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 |
virtual void | PrintSelf (std::ostream &os, Indent indent) const |
virtual void | SetTimeStamp (const TimeStamp &time) |
virtual | ~Object () |
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 | |
typedef std::map < AttributeKeyType, AttributeValueType > | AttributesContainer |
typedef std::vector< Pointer > | ChildrenContainer |
typedef std::list < AttributeItemType * > | OrderedAttributesContainer |
Private Member Functions | |
DOMNode (const Self &) | |
void | operator= (const Self &) |
Private Attributes | |
AttributesContainer | m_Attributes |
ChildrenContainer | m_Children |
std::string | m_ID |
std::string | m_Name |
OrderedAttributesContainer | m_OrderedAttributes |
DOMNode * | m_Parent |
Additional Inherited Members | |
Protected Types inherited from itk::LightObject | |
typedef int | InternalReferenceCountType |
Protected Attributes inherited from itk::LightObject | |
InternalReferenceCountType | m_ReferenceCount |
SimpleFastMutexLock | m_ReferenceCountLock |
typedef std::pair<const AttributeKeyType,AttributeValueType> itk::DOMNode::AttributeItemType |
Definition at line 76 of file itkDOMNode.h.
typedef std::string itk::DOMNode::AttributeKeyType |
An attribute is a pair of <key,value>, both key and value are strings.
Definition at line 73 of file itkDOMNode.h.
|
private |
Internally the attributes are stored in a map.
Definition at line 245 of file itkDOMNode.h.
typedef std::list<AttributeItemType> itk::DOMNode::AttributesListType |
Container to return the attributes of a DOM node.
Definition at line 79 of file itkDOMNode.h.
typedef std::string itk::DOMNode::AttributeValueType |
Definition at line 74 of file itkDOMNode.h.
|
private |
Internally the children are stored in a vector.
Definition at line 241 of file itkDOMNode.h.
typedef std::vector<DOMNode*> itk::DOMNode::ChildrenListType |
Container to return all or a subset of the children of a DOM node.
Definition at line 66 of file itkDOMNode.h.
typedef std::vector<const DOMNode*> itk::DOMNode::ConstChildrenListType |
Definition at line 70 of file itkDOMNode.h.
typedef SmartPointer< const Self > itk::DOMNode::ConstPointer |
Definition at line 60 of file itkDOMNode.h.
typedef int itk::DOMNode::IdentifierType |
Definition at line 82 of file itkDOMNode.h.
typedef int itk::DOMNode::OffsetType |
Definition at line 83 of file itkDOMNode.h.
|
private |
Container to keep the inserting orders of the attributes.
Definition at line 249 of file itkDOMNode.h.
typedef SmartPointer< Self > itk::DOMNode::Pointer |
Definition at line 59 of file itkDOMNode.h.
typedef DOMNode itk::DOMNode::Self |
Standard class typedefs.
Definition at line 57 of file itkDOMNode.h.
typedef std::vcl_size_t itk::DOMNode::SizeType |
Definition at line 81 of file itkDOMNode.h.
typedef Object itk::DOMNode::Superclass |
Definition at line 58 of file itkDOMNode.h.
|
protected |
|
private |
|
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 |
Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.
Reimplemented from itk::Object.
Reimplemented in itk::DOMTextNode.
|
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 NULL 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 NULL 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 index (return NULL if i is out of range).
|
virtual |
Retrieve a child by index (return NULL if i is out of range).
|
virtual |
Retrieve a child by tag name and an index (multiple children can have a same tag name, return NULL if no such child).
|
virtual |
Retrieve a child by tag name and an index (multiple children can have a same tag name, return NULL if no such child).
|
virtual |
Retrieve a child by its unique "id" attribute value (return NULL if not found).
|
virtual |
Retrieve a child by its unique "id" attribute value (return NULL 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.
|
virtual |
Run-time type information (and related methods).
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 NULL if no such sibling).
|
virtual |
Retrieve an older or younger sibling by distance (return NULL if no such sibling).
|
virtual |
Get a child and cast it to a text node (return NULL if out of range or not a text node).
|
virtual |
Get a child and cast it to a text node (return NULL if out of range or not a text node).
|
virtual |
Check whether has an attribute.
|
static |
Method for creation through the object factory.
|
private |
|
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 246 of file itkDOMNode.h.
|
private |
Definition at line 242 of file itkDOMNode.h.
|
private |
The special attribute "id" of this node.
Definition at line 238 of file itkDOMNode.h.
|
private |
The XML tag of this node.
Definition at line 235 of file itkDOMNode.h.
|
private |
Definition at line 250 of file itkDOMNode.h.
|
private |
The parent node that this node was placed into.
Definition at line 232 of file itkDOMNode.h.