QtXmlElement Class Reference

#include <QtXmlElement.h>

Inheritance diagram for QtXmlElement:

Inheritance graph
XmlElementXmlNodeQtXmlNode
[legend]
Collaboration diagram for QtXmlElement:

Collaboration graph
XmlElementXmlNodeQtXmlNodeQDomNodeQDomElement
[legend]
List of all members.

Detailed Description

An XML element using the Qt XML module.

Author:
Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 38 of file QtXmlElement.h.

Public Types

typedef std::list< XmlElement * > NodeList_t
 The type of container used to store XmlElement nodes.

Public Member Functions

virtual void appendChild (const XmlNode &child)
 Appends a child element to the element.
virtual void appendChild (const XmlNode &child)=0
 Appends a child element to the element.
virtual bool attribute (const std::string &name, std::string &value) const
 Sets value to the attribute name's value.
virtual bool attribute (const std::string &name, double &value) const
 Sets value to the attribute name's value.
virtual bool attribute (const std::string &name, float &value) const
 Sets value to the attribute name's value.
virtual bool attribute (const std::string &name, unsigned int &value) const
 Sets value to the attribute name's value.
virtual bool attribute (const std::string &name, int &value) const
 Sets value to the attribute name's value.
virtual bool attribute (const std::string &name, bool &value) const
 Sets value to the attribute name's value.
XmlElementcreate () const
virtual void fillNodeList (const std::string &tagName, std::list< XmlElement * > &nodeList) const
virtual int getID () const
 Returns the ID of the element, if it has one.
virtual QtXmlElementgetNode (const std::string &tagName) const
 Returns the single direct child element node with name tagName.
virtual const std::string & getText () const
 Gets the text node from the element.
 QtXmlElement (const QtXmlElement &)
 The copy constructor.
virtual void setAttribute (const std::string &name, const std::string &value)
 Sets attribute named name to the string value value.
virtual void setAttribute (const std::string &name, double value)
 Sets attribute named name to the double value value.
virtual void setAttribute (const std::string &name, float value)
 Sets attribute named name to the float value value.
virtual void setAttribute (const std::string &name, unsigned int value)
 Sets attribute named name to the unsigned int value value.
virtual void setAttribute (const std::string &name, bool value)
 Sets attribute named name to the int value value.
virtual void setAttribute (const std::string &name, int value)
 Sets attribute named name to the int value value.
virtual std::string tagName () const
 Returns the tag name of the element.
virtual ~QtXmlElement ()
 The destructor.

Protected Attributes

QDomNode m_node
 The DOM node wrapped by this object.

Private Member Functions

 QtXmlElement (const QDomElement &)
 A constructor used internally.

Private Attributes

QDomElement m_element
 The DOM element node wrapped by this object.

Friends

class QtXmlDocument


Member Typedef Documentation

typedef std::list< XmlElement * > NodeList_t [inherited]

The type of container used to store XmlElement nodes.

Definition at line 47 of file XmlElement.h.


Constructor & Destructor Documentation

QtXmlElement ( const QDomElement  )  [private]

A constructor used internally.

Definition at line 46 of file QtXmlElement.cxx.

References QtXmlElement::m_element, and QtXmlNode::m_node.

Referenced by QtXmlElement::getNode().

QtXmlElement ( const QtXmlElement  ) 

The copy constructor.

Definition at line 25 of file QtXmlElement.cxx.

References QtXmlElement::m_element, and QtXmlNode::m_node.

~QtXmlElement (  )  [virtual]

The destructor.

Definition at line 55 of file QtXmlElement.cxx.


Member Function Documentation

void appendChild ( const XmlNode child  )  [virtual, inherited]

Appends a child element to the element.

Implements XmlNode.

Definition at line 34 of file QtXmlNode.cxx.

References QDomNode::appendChild(), and QtXmlNode::m_node.

virtual void appendChild ( const XmlNode child  )  [pure virtual, inherited]

Appends a child element to the element.

Implemented in QtXmlNode.

Referenced by XmlController::addDataSource(), XmlController::addViews(), PlotterBaseXML::createAxisModel(), ViewBaseXML::createChild(), PlotterBaseXML::createChildren(), NTupleProjectorXML::createChildren(), DataRepXML::createChildren(), BinsBaseXML::createChildren(), BinningProjectorXML::createChildren(), AxisModelXML::createChildren(), PlotterBaseXML::createCutChildren(), PointRepXML::createElement(), PlotterBaseXML::createFontElement(), PlotterBaseXML::createFontElements(), DataRepXML::createFunctionTargetChild(), and PlotterBaseXML::createTextChildren().

bool attribute ( const std::string &  name,
std::string &  value 
) const [virtual]

Sets value to the attribute name's value.

If attribute of name name exists returns true, otherwise does not change value and returns false.

Implements XmlElement.

Definition at line 268 of file QtXmlElement.cxx.

References QDomElement::attribute(), QString::latin1(), and QtXmlElement::m_element.

bool attribute ( const std::string &  name,
double &  value 
) const [virtual]

Sets value to the attribute name's value.

If attribute of name name exists returns true, otherwise does not change value and returns false.

Implements XmlElement.

Definition at line 252 of file QtXmlElement.cxx.

References QDomElement::attribute(), QtXmlElement::m_element, and QString::toDouble().

bool attribute ( const std::string &  name,
float &  value 
) const [virtual]

Sets value to the attribute name's value.

If attribute of name name exists returns true, otherwise does not change value and returns false.

Implements XmlElement.

Definition at line 236 of file QtXmlElement.cxx.

References QDomElement::attribute(), QtXmlElement::m_element, and QString::toFloat().

bool attribute ( const std::string &  name,
unsigned int &  value 
) const [virtual]

Sets value to the attribute name's value.

If attribute of name name exists returns true, otherwise does not change value and returns false.

Implements XmlElement.

Definition at line 220 of file QtXmlElement.cxx.

References QDomElement::attribute(), QtXmlElement::m_element, and QString::toUInt().

bool attribute ( const std::string &  name,
int &  value 
) const [virtual]

Sets value to the attribute name's value.

If attribute of name name exists returns true, otherwise does not change value and returns false.

Implements XmlElement.

Definition at line 188 of file QtXmlElement.cxx.

References QDomElement::attribute(), QtXmlElement::m_element, and QString::toInt().

bool attribute ( const std::string &  name,
bool &  value 
) const [virtual]

Sets value to the attribute name's value.

If attribute of name name exists returns true, otherwise does not change value and returns false.

Implements XmlElement.

Definition at line 204 of file QtXmlElement.cxx.

References QDomElement::attribute(), QtXmlElement::m_element, and QString::toInt().

XmlElement* create (  )  const

void fillNodeList ( const std::string &  tagName,
std::list< XmlElement * > &  nodeList 
) const [virtual]

Todo:
This needs to return only immediate children with given name. Doesn't hurt us yet.

Implements XmlElement.

Definition at line 105 of file QtXmlElement.cxx.

References QDomElement::elementsByTagName(), QtXmlElement::m_element, and num_util::size().

int getID (  )  const [virtual]

Returns the ID of the element, if it has one.

Implements XmlElement.

Definition at line 71 of file QtXmlElement.cxx.

References QDomElement::attribute(), QtXmlElement::m_element, and QString::toInt().

QtXmlElement * getNode ( const std::string &  tagName  )  const [virtual]

Returns the single direct child element node with name tagName.

If a child of that name doesn't exist returns a null pointer. if child exists but is not an element node, an assertion is made.

Implements XmlElement.

Definition at line 89 of file QtXmlElement.cxx.

References QtXmlElement::m_element, and QtXmlElement::QtXmlElement().

const string & getText (  )  const [virtual]

Gets the text node from the element.

Implements XmlElement.

Definition at line 283 of file QtXmlElement.cxx.

References QString::latin1(), QtXmlElement::m_element, and QDomElement::text().

void setAttribute ( const std::string &  name,
const std::string &  value 
) [virtual]

Sets attribute named name to the string value value.

Implements XmlElement.

Definition at line 179 of file QtXmlElement.cxx.

References QtXmlElement::m_element, and QDomElement::setAttribute().

void setAttribute ( const std::string &  name,
double  value 
) [virtual]

Sets attribute named name to the double value value.

Implements XmlElement.

Definition at line 160 of file QtXmlElement.cxx.

References hippodraw::String::convert(), QtXmlElement::m_element, and QDomElement::setAttribute().

void setAttribute ( const std::string &  name,
float  value 
) [virtual]

Sets attribute named name to the float value value.

Implements XmlElement.

Definition at line 150 of file QtXmlElement.cxx.

References QtXmlElement::setAttribute().

void setAttribute ( const std::string &  name,
unsigned int  value 
) [virtual]

Sets attribute named name to the unsigned int value value.

Implements XmlElement.

Definition at line 142 of file QtXmlElement.cxx.

References QtXmlElement::m_element, and QDomElement::setAttribute().

void setAttribute ( const std::string &  name,
bool  value 
) [virtual]

Sets attribute named name to the int value value.

Implements XmlElement.

Definition at line 132 of file QtXmlElement.cxx.

References QtXmlElement::m_element, and QDomElement::setAttribute().

void setAttribute ( const std::string &  name,
int  value 
) [virtual]

Sets attribute named name to the int value value.

Implements XmlElement.

Definition at line 123 of file QtXmlElement.cxx.

References QtXmlElement::m_element, and QDomElement::setAttribute().

Referenced by QtXmlElement::setAttribute().

string tagName (  )  const [virtual]

Returns the tag name of the element.

This function is not needed for XML processing. It is only here as an aid in debugging.

Implements XmlElement.

Definition at line 60 of file QtXmlElement.cxx.

References QString::latin1(), QtXmlElement::m_element, and QDomElement::tagName().


Friends And Related Function Documentation

friend class QtXmlDocument [friend]

Reimplemented from QtXmlNode.

Definition at line 56 of file QtXmlElement.h.


Member Data Documentation

QDomElement m_element [private]

The DOM element node wrapped by this object.

Note:
When initialized, must also copy pointer value to inherited m_node data member so that base class can work correctly.

Definition at line 49 of file QtXmlElement.h.

Referenced by QtXmlElement::attribute(), QtXmlElement::fillNodeList(), QtXmlElement::getID(), QtXmlElement::getNode(), QtXmlElement::getText(), QtXmlElement::QtXmlElement(), QtXmlElement::setAttribute(), and QtXmlElement::tagName().

QDomNode m_node [protected, inherited]

The DOM node wrapped by this object.

Definition at line 41 of file QtXmlNode.h.

Referenced by QtXmlNode::appendChild(), QtXmlDocument::appendChild(), QtXmlElement::QtXmlElement(), and QtXmlTextNode::QtXmlTextNode().


The documentation for this class was generated from the following files:
Generated for HippoDraw Class Library by doxygen