pcl::XMLNode Class Referenceabstract

Abstract base class of all XML document node classes. More...

#include <XML.h>

+ Inheritance diagram for pcl::XMLNode:

Public Types

typedef XMLNodeType::mask_type node_type

Public Member Functions

 XMLNode (node_type type)
 XMLNode (const XMLNode &x)
virtual ~XMLNode ()
bool IsChildNode () const
bool IsComment () const
bool IsElement () const
bool IsText () const
const XMLNodeLocationLocation () const
virtual bool NLAfter (const XMLNode &previous) const
node_type NodeType () const
virtual void Serialize (IsoString &text, bool autoFormat, char indentChar, unsigned indentSize, unsigned level) const =0
- Public Member Functions inherited from pcl::XMLComponent
 XMLComponent ()=default
 XMLComponent (const XMLComponent &)=default
bool IsTopLevel () const
XMLElementParentElement () const

Detailed Description

XML document nodes can be elements, text, CDATA sections, processing instructions, comments, and unknown special elements. This class extends the XMLComponent root base class to implement XML document node classification and serialization.

Definition at line 498 of file XML.h.

Member Typedef Documentation

◆ node_type

typedef XMLNodeType::mask_type pcl::XMLNode::node_type

Represents the type of an XML document node. Supported/valid node types are defined in the XMLNodeType namespace.

Definition at line 506 of file XML.h.

Constructor & Destructor Documentation

◆ XMLNode() [1/2]

pcl::XMLNode::XMLNode ( node_type  type)

Default constructor. Constructs a default XMLNode object of the specified type, with no parent element and undefined source code location.

Definition at line 513 of file XML.h.

◆ XMLNode() [2/2]

pcl::XMLNode::XMLNode ( const XMLNode x)

Copy constructor.

The newly constructed node will be an orphan object, that is, it will have no parent element even if the source object x is a child node. This reflects the fact that document nodes are unique objects.

Definition at line 525 of file XML.h.

◆ ~XMLNode()

virtual pcl::XMLNode::~XMLNode ( )

Virtual destructor.

Definition at line 533 of file XML.h.

Member Function Documentation

◆ IsChildNode()

bool pcl::XMLNode::IsChildNode ( ) const

Returns true iff this is a child node of an existing XML element.

Definition at line 540 of file XML.h.

◆ IsComment()

bool pcl::XMLNode::IsComment ( ) const

Returns true iff this node represents an XML comment. If this member function returns true, this node can be statically casted to XMLComment.

Definition at line 575 of file XML.h.

◆ IsElement()

bool pcl::XMLNode::IsElement ( ) const

Returns true iff this node is an XML element. If this member function returns true, this node can be statically casted to XMLElement.

Definition at line 557 of file XML.h.

◆ IsText()

bool pcl::XMLNode::IsText ( ) const

Returns true iff this node represents an XML text block. If this member function returns true, this node can be statically casted to XMLText.

Definition at line 566 of file XML.h.

◆ Location()

const XMLNodeLocation& pcl::XMLNode::Location ( ) const

Returns a reference to the (immutable) source code location of this node.

Definition at line 583 of file XML.h.

◆ NLAfter()

virtual bool pcl::XMLNode::NLAfter ( const XMLNode previous) const

Returns true iff a new line character (#x0A) can be inserted before serializing this node after the specified previous node.

Reimplemented in pcl::XMLText.

◆ NodeType()

node_type pcl::XMLNode::NodeType ( ) const

Returns the type of this XML document node.

Definition at line 548 of file XML.h.

◆ Serialize()

virtual void pcl::XMLNode::Serialize ( IsoString text,
bool  autoFormat,
char  indentChar,
unsigned  indentSize,
unsigned  level 
) const
pure virtual

Serializes this document node as an XML fragment encoded in UTF-8.

textReference to an 8-bit string to which the UTF-8 encoded serialization of this node must be appended.
autoFormatTrue if line break characters (#x0A) and indentation strings must be used to improve readability of the generated XML code. False if no superfluous white space should be generated.
indentCharA character used for indentation of generated text lines, when autoFormat is true. This parameter should be either a white space (' ' or #x20) or a tabulator ('\t' or #x09) character.
indentSizeNumber of indentChar characters used for each indentation level, when autoFormat is true.
levelRecursion level. A value greater than zero denotes that this function is being called from a parent XML element. The recursion level determines the number of indentChar characters prepended to each text line for indentation, when autoFormat is true.

Implemented in pcl::XMLUnknownElement, pcl::XMLComment, pcl::XMLProcessingInstructions, pcl::XMLCDATA, pcl::XMLText, and pcl::XMLElement.

The documentation for this class was generated from the following file: