Fraxinus  16.5.0-fx-rc6
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cx::XmlOptionFile Class Reference

Helper class for xml files used to store ssc/cx data. More...

#include <cxXmlOptionItem.h>

Public Member Functions

 XmlOptionFile (QString filename)
 create from filename, create trivial document of type name and root node if no file exists. More...
 
 XmlOptionFile ()
 
 ~XmlOptionFile ()
 
QString getFileName ()
 
bool isNull () const
 checks if this is null More...
 
XmlOptionFile root () const
 set the current element to root More...
 
XmlOptionFile descend (QString element) const
 step one level down in the xml tree More...
 
XmlOptionFile descend (QString element, QString attributeName, QString attributeValue) const
 
XmlOptionFile ascend () const
 step one level up in the xml tree More...
 
XmlOptionFile tryDescend (QString element, QString attributeName, QString attributeValue) const
 
QDomDocument getDocument ()
 returns the document More...
 
QDomElement getElement ()
 return the current element More...
 
QDomElement getElement (QString level1)
 return a element below the current element. Guaranteed to exist. More...
 
QDomElement getElement (QString level1, QString level2)
 return a element two levels below the current element. Guaranteed to exist. More...
 
void save ()
 save entire document. More...
 
void removeChildren ()
 remove all child nodes of the current element. More...
 
void deleteNode ()
 Delete the current node. More...
 
QDomElement safeGetElement (QDomElement parent, QString childName)
 
void printDocument ()
 print the entire document More...
 
void printElement ()
 print just the current element More...
 

Static Public Member Functions

static XmlOptionFile createNull ()
 create an empty document More...
 
static void printDocument (QDomDocument document)
 
static void printElement (QDomElement element)
 

Detailed Description

Helper class for xml files used to store ssc/cx data.

Both the xml document and filename are stored, and save/load are provided.

Several instances of the same file points to the same internal object, in the same way as QSettings. This means that they share the QDomDocument, and is NOT threadsafe.

The object has a current element, which is used to ease work at a specified level in the hierarchy. Use descend/ascend to change the current element.

The getElement() methods are used to retrieve QDomElements relative to the current element.

Definition at line 99 of file cxXmlOptionItem.h.

Constructor & Destructor Documentation

cx::XmlOptionFile::XmlOptionFile ( QString  filename)
explicit

create from filename, create trivial document of type name and root node if no file exists.

Definition at line 255 of file cxXmlOptionItem.cpp.

cx::XmlOptionFile::XmlOptionFile ( )

Definition at line 249 of file cxXmlOptionItem.cpp.

cx::XmlOptionFile::~XmlOptionFile ( )

Definition at line 269 of file cxXmlOptionItem.cpp.

Member Function Documentation

XmlOptionFile cx::XmlOptionFile::ascend ( ) const

step one level up in the xml tree

Definition at line 333 of file cxXmlOptionItem.cpp.

XmlOptionFile cx::XmlOptionFile::createNull ( )
static

create an empty document

----------------------------------------------------—


Definition at line 241 of file cxXmlOptionItem.cpp.

void cx::XmlOptionFile::deleteNode ( )

Delete the current node.

Definition at line 410 of file cxXmlOptionItem.cpp.

XmlOptionFile cx::XmlOptionFile::descend ( QString  element) const

step one level down in the xml tree

Definition at line 292 of file cxXmlOptionItem.cpp.

XmlOptionFile cx::XmlOptionFile::descend ( QString  element,
QString  attributeName,
QString  attributeValue 
) const

Definition at line 299 of file cxXmlOptionItem.cpp.

QDomDocument cx::XmlOptionFile::getDocument ( )

returns the document

Definition at line 381 of file cxXmlOptionItem.cpp.

QDomElement cx::XmlOptionFile::getElement ( )

return the current element

Definition at line 386 of file cxXmlOptionItem.cpp.

QDomElement cx::XmlOptionFile::getElement ( QString  level1)

return a element below the current element. Guaranteed to exist.

Definition at line 391 of file cxXmlOptionItem.cpp.

QDomElement cx::XmlOptionFile::getElement ( QString  level1,
QString  level2 
)

return a element two levels below the current element. Guaranteed to exist.

Definition at line 397 of file cxXmlOptionItem.cpp.

QString cx::XmlOptionFile::getFileName ( )

Definition at line 273 of file cxXmlOptionItem.cpp.

bool cx::XmlOptionFile::isNull ( ) const

checks if this is null

Definition at line 278 of file cxXmlOptionItem.cpp.

void cx::XmlOptionFile::printDocument ( )

print the entire document

Definition at line 357 of file cxXmlOptionItem.cpp.

void cx::XmlOptionFile::printDocument ( QDomDocument  document)
static

Definition at line 367 of file cxXmlOptionItem.cpp.

void cx::XmlOptionFile::printElement ( )

print just the current element

Definition at line 362 of file cxXmlOptionItem.cpp.

void cx::XmlOptionFile::printElement ( QDomElement  element)
static

Definition at line 373 of file cxXmlOptionItem.cpp.

void cx::XmlOptionFile::removeChildren ( )

remove all child nodes of the current element.

Definition at line 404 of file cxXmlOptionItem.cpp.

XmlOptionFile cx::XmlOptionFile::root ( ) const

set the current element to root

Definition at line 285 of file cxXmlOptionItem.cpp.

QDomElement cx::XmlOptionFile::safeGetElement ( QDomElement  parent,
QString  childName 
)

return an element child of parent. Create if not existing.

Definition at line 344 of file cxXmlOptionItem.cpp.

void cx::XmlOptionFile::save ( )

save entire document.

Definition at line 417 of file cxXmlOptionItem.cpp.

XmlOptionFile cx::XmlOptionFile::tryDescend ( QString  element,
QString  attributeName,
QString  attributeValue 
) const

Definition at line 314 of file cxXmlOptionItem.cpp.


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