Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
QtXmlDocument Class Reference

An XML DOM Document handler using the Qt XML module. More...

#include <QtXmlDocument.h>

Inheritance diagram for QtXmlDocument:
Inheritance graph
[legend]
Collaboration diagram for QtXmlDocument:
Collaboration graph
[legend]

Public Types

enum  Status { Success, OpenError, ParseError, WriteError }
 Status codes for opening an XML document. More...

Public Member Functions

virtual void appendChild (XmlElement &)
 Appends the root element to the document.
virtual XmlElementcreateElement (const std::string &tagName)
 Creates a new DOM element wrapper object and returns a pointer to it.
virtual XmlTextNodecreateTextNode (const std::string &tag)
 Creates a new DOM Text node.
virtual XmlElementdocumentElement () const
 Returns the root document element.
 QtXmlDocument (QDomDocument document)
 The public constructor taking a Qt XML module QDocument as argument.
 QtXmlDocument (const std::string &name)
virtual Status saveToFile (const std::string &filename)
 Saves the document to the file.
virtual Status setContent (const std::string &filename)
 Sets the content of the XML document from the text in the file filename.
 ~QtXmlDocument ()
 The dstructor.

Private Member Functions

 QtXmlDocument (const QtXmlDocument &)
 A private copy constructor in order to avoid copying.

Private Attributes

QDomDocument m_document
 The DOM element wrapped by this object.

Detailed Description

An XML DOM Document handler using the Qt XML module.

Author
Paul F. Kunz Paul_.nosp@m.Kunz.nosp@m.@slac.nosp@m..sta.nosp@m.nford.nosp@m..edu

Definition at line 30 of file QtXmlDocument.h.

Member Enumeration Documentation

enum Status
inherited

Status codes for opening an XML document.

Enumerator:
Success 
OpenError 
ParseError 
WriteError 

Definition at line 37 of file XmlDocument.h.

Constructor & Destructor Documentation

QtXmlDocument ( const QtXmlDocument )
private

A private copy constructor in order to avoid copying.

QtXmlDocument ( QDomDocument  document)

The public constructor taking a Qt XML module QDocument as argument.

Definition at line 25 of file QtXmlDocument.cxx.

QtXmlDocument ( const std::string &  name)

Definition at line 31 of file QtXmlDocument.cxx.

References QtXmlDocument::m_document.

The dstructor.

Definition at line 37 of file QtXmlDocument.cxx.

Member Function Documentation

void appendChild ( XmlElement )
virtual

Appends the root element to the document.

Implements XmlDocument.

Definition at line 67 of file QtXmlDocument.cxx.

References QtXmlDocument::m_document, and QtXmlNode::m_node.

XmlElement * createElement ( const std::string &  tagName)
virtual

Creates a new DOM element wrapper object and returns a pointer to it.

The receiver takes procession of the object and is responsible for its deletion.

Implements XmlDocument.

Definition at line 50 of file QtXmlDocument.cxx.

References QDomDocument::createElement(), and QtXmlDocument::m_document.

XmlTextNode * createTextNode ( const std::string &  tag)
virtual

Creates a new DOM Text node.

Implements XmlDocument.

Definition at line 59 of file QtXmlDocument.cxx.

References QDomDocument::createTextNode(), and QtXmlDocument::m_document.

XmlElement * documentElement ( ) const
virtual

Returns the root document element.

Implements XmlDocument.

Definition at line 41 of file QtXmlDocument.cxx.

References QDomDocument::documentElement(), and QtXmlDocument::m_document.

XmlDocument::Status saveToFile ( const std::string &  filename)
virtual

Saves the document to the file.

Returns
XmlDocument::Success if successful, otherwise XmlDocument::WriteError.

Implements XmlDocument.

Definition at line 77 of file QtXmlDocument.cxx.

References QtXmlDocument::m_document, QFile::open(), XmlDocument::Success, and XmlDocument::WriteError.

XmlDocument::Status setContent ( const std::string &  filename)
virtual

Sets the content of the XML document from the text in the file filename.

Also sets the application's current working directory to the path to the file. This is done so that files referenced by the XML document can be found relative to the document itself.

Returns
XmlDocument::Success if successful. XmlDocument::OpenError if the file could not be opened or XmlDocument::ParseError if the file was not successfully parsed.

Implements XmlDocument.

Definition at line 100 of file QtXmlDocument.cxx.

References QFileInfo::dirPath(), QtXmlDocument::m_document, QFile::open(), XmlDocument::OpenError, XmlDocument::ParseError, QDomDocument::setContent(), QDir::setCurrent(), and XmlDocument::Success.

Member Data Documentation

QDomDocument m_document
private

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

Generated for HippoDraw Class Library by doxygen