GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GXmlPI Class Reference

XML Processing Instruction node class. More...

#include <GXmlPI.hpp>

Inheritance diagram for GXmlPI:
GXmlNode GContainer GBase

Public Member Functions

 GXmlPI (void)
 Void constructor. More...
 
 GXmlPI (const GXmlPI &node)
 Copy constructor. More...
 
 GXmlPI (const std::string &segment)
 Segment constructor. More...
 
virtual ~GXmlPI (void)
 Destructor. More...
 
GXmlPIoperator= (const GXmlPI &node)
 Assignment operator. More...
 
virtual void clear (void)
 Clear XML Processing Instruction. More...
 
virtual GXmlPIclone (void) const
 Clone XML Processing Instruction. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual void write (GUrl &url, const int &indent=0) const
 Write Processing Instruction into URL. More...
 
virtual NodeType type (void) const
 Return XML node type. More...
 
virtual std::string print (const GChatter &chatter=NORMAL, const int &indent=0) const
 Print XML Processing Instruction. More...
 
const std::string & pi (void) const
 Return Processing Instruction. More...
 
void pi (const std::string &pi)
 Set Processing Instruction. More...
 
- Public Member Functions inherited from GXmlNode
 GXmlNode (void)
 Void constructor. More...
 
 GXmlNode (const GXmlNode &node)
 Copy constructor. More...
 
virtual ~GXmlNode (void)
 Destructor. More...
 
GXmlNodeoperator= (const GXmlNode &node)
 Assignment operator. More...
 
GXmlNodeoperator[] (const int &index)
 Return pointer to XML child node. More...
 
const GXmlNodeoperator[] (const int &index) const
 Return pointer to XML child node (const version) More...
 
virtual int size (void) const
 Return number of child nodes. More...
 
virtual bool is_empty (void) const
 Signals if node has no child nodes. More...
 
virtual GXmlNodeset (const int &index, const GXmlNode &node)
 Set XML child node. More...
 
virtual GXmlNodeappend (const GXmlNode &node)
 Append XML child node. More...
 
virtual GXmlElementappend (const std::string &segment)
 Append XML element child node. More...
 
virtual GXmlNodeinsert (const int &index, const GXmlNode &node)
 Insert XML child node. More...
 
virtual void remove (const int &index)
 Remove XML child node. More...
 
virtual void reserve (const int &num)
 Reserve space for child nodes. More...
 
virtual void extend (const GXmlNode &node)
 Append all XML child nodes from another XML node. More...
 
GXmlNodeparent (void) const
 Return parent XML node. More...
 
void parent (GXmlNode *parent)
 Set parent of XML node. More...
 
GFilename filename (void) const
 Return filename of XML file. More...
 
virtual int elements (void) const
 Return number of GXMLElement children of node. More...
 
virtual int elements (const std::string &name) const
 Return number of GXMLElement children with a given name. More...
 
virtual GXmlElementelement (const int &index)
 Return pointer to GXMLElement child. More...
 
virtual const GXmlElementelement (const int &index) const
 Return pointer to GXMLElement child (const variant) More...
 
virtual GXmlElementelement (const std::string &name)
 Return pointer on child walking down a hierarchy of tags. More...
 
virtual const GXmlElementelement (const std::string &name) const
 Return pointer on child walking down a hierarchy of tags (const version) More...
 
virtual GXmlElementelement (const std::string &name, const int &index)
 Return pointer on GXMLElement child of a given name. More...
 
virtual const GXmlElementelement (const std::string &name, const int &index) const
 Return pointer on GXMLElement child of a given name (const variant) More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print XML node in string. More...
 
- Public Member Functions inherited from GContainer
virtual ~GContainer (void)
 Destructor. More...
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor. More...
 

Protected Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const GXmlPI &node)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void parse (const std::string &segment)
 Parse comment segment string. More...
 
- Protected Member Functions inherited from GXmlNode
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GXmlNode &node)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
int extract_index (std::string &tag) const
 Extract index from tag. More...
 

Protected Attributes

std::string m_pi
 Processing instruction (without brackets) More...
 
- Protected Attributes inherited from GXmlNode
GXmlNodem_parent
 Pointer on parent node. More...
 
std::vector< GXmlNode * > m_nodes
 Pointer to child nodes. More...
 

Additional Inherited Members

- Public Types inherited from GXmlNode
enum  NodeType {
  NT_DOCUMENT, NT_ELEMENT, NT_COMMENT, NT_UNKNOWN,
  NT_TEXT, NT_DECLARATION, NT_PI, NT_TYPECOUNT
}
 

Detailed Description

XML Processing Instruction node class.

This class implements a XML Processing Instruction.

Definition at line 43 of file GXmlPI.hpp.

Constructor & Destructor Documentation

GXmlPI::GXmlPI ( void  )

Void constructor.

Definition at line 54 of file GXmlPI.cpp.

References init_members().

Referenced by clone().

GXmlPI::GXmlPI ( const GXmlPI node)

Copy constructor.

Parameters
[in]nodeXML Processing Instruction.

Definition at line 69 of file GXmlPI.cpp.

References copy_members(), and init_members().

GXmlPI::GXmlPI ( const std::string &  segment)
explicit

Segment constructor.

Parameters
[in]segmentText segment.

Constructs a Processing Instruction from a text segment.

Definition at line 89 of file GXmlPI.cpp.

References init_members(), and parse().

GXmlPI::~GXmlPI ( void  )
virtual

Destructor.

Definition at line 105 of file GXmlPI.cpp.

References free_members().

Member Function Documentation

std::string GXmlPI::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GXmlPI").

Implements GXmlNode.

Definition at line 86 of file GXmlPI.hpp.

void GXmlPI::clear ( void  )
virtual

Clear XML Processing Instruction.

Resets the XML Processing Instruction to an initial state.

Implements GXmlNode.

Definition at line 162 of file GXmlPI.cpp.

References free_members(), GXmlNode::free_members(), init_members(), and GXmlNode::init_members().

GXmlPI * GXmlPI::clone ( void  ) const
virtual

Clone XML Processing Instruction.

Returns
Pointer to deep copy of XML Processing Instruction.

Implements GXmlNode.

Definition at line 182 of file GXmlPI.cpp.

References GXmlPI().

void GXmlPI::copy_members ( const GXmlPI node)
protected

Copy class members.

Parameters
[in]nodeProcessing Instruction.

Definition at line 266 of file GXmlPI.cpp.

References m_pi.

Referenced by GXmlPI(), and operator=().

void GXmlPI::free_members ( void  )
protected

Delete class members.

Definition at line 279 of file GXmlPI.cpp.

Referenced by clear(), operator=(), and ~GXmlPI().

void GXmlPI::init_members ( void  )
protected

Initialise class members.

Definition at line 251 of file GXmlPI.cpp.

References m_pi.

Referenced by clear(), GXmlPI(), and operator=().

GXmlPI & GXmlPI::operator= ( const GXmlPI node)

Assignment operator.

Parameters
[in]nodeXML Processing Instruction.
Returns
XML Processing Instruction.

Definition at line 127 of file GXmlPI.cpp.

References copy_members(), free_members(), init_members(), and GXmlNode::operator=().

void GXmlPI::parse ( const std::string &  segment)
protected

Parse comment segment string.

Parameters
[in]segmentSegment string.
Exceptions
GException::invalid_valueXML syntax error.

Parse the segment string.

Definition at line 296 of file GXmlPI.cpp.

References G_PARSE, and m_pi.

Referenced by GXmlPI().

const std::string & GXmlPI::pi ( void  ) const
inline

Return Processing Instruction.

Returns
Processing Instruction string.

Definition at line 98 of file GXmlPI.hpp.

References m_pi.

Referenced by pi().

void GXmlPI::pi ( const std::string &  pi)
inline

Set Processing Instruction.

Parameters
[in]piProcessing Instruction string.

Definition at line 110 of file GXmlPI.hpp.

References m_pi, and pi().

std::string GXmlPI::print ( const GChatter chatter = NORMAL,
const int &  indent = 0 
) const
virtual

Print XML Processing Instruction.

Parameters
[in]chatterChattiness (defaults to NORMAL).
[in]indentText indentation (default to 0).
Returns
String containing XML Processing Instruction.

Implements GXmlNode.

Definition at line 220 of file GXmlPI.cpp.

References gammalib::fill(), m_pi, and SILENT.

GXmlNode::NodeType GXmlPI::type ( void  ) const
inlinevirtual

Return XML node type.

Returns
XML node type (NT_PI).

Implements GXmlNode.

Definition at line 123 of file GXmlPI.hpp.

References GXmlNode::NT_PI.

void GXmlPI::write ( GUrl url,
const int &  indent = 0 
) const
virtual

Write Processing Instruction into URL.

Parameters
[in]urlUnified Resource Locator.
[in]indentText indentation (default = 0).

Writes a Processing Instruction into a url object.

Implements GXmlNode.

Definition at line 197 of file GXmlPI.cpp.

References m_pi, and GUrl::printf().

Member Data Documentation

std::string GXmlPI::m_pi
protected

Processing instruction (without brackets)

Definition at line 76 of file GXmlPI.hpp.

Referenced by copy_members(), init_members(), parse(), pi(), print(), and write().


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