Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

DomUtil Class Reference

#include <domutil.h>

List of all members.

Public Types

typedef QPair< QString, QString > Pair
typedef QValueList< PairPairList
typedef QValueList< QStringList > TupleList

Static Public Member Functions

void makeEmpty (QDomElement &)
QString readEntry (const QDomDocument &doc, const QString &path, const QString &defaultEntry=QString::null)
int readIntEntry (const QDomDocument &doc, const QString &path, int defaultEntry=0)
bool readBoolEntry (const QDomDocument &doc, const QString &path, bool defaultEntry=false)
QStringList readListEntry (const QDomDocument &doc, const QString &path, const QString &tag)
PairList readPairListEntry (const QDomDocument &doc, const QString &path, const QString &tag, const QString &firstAttr, const QString &secondAttr)
TupleList readTupleListEntry (const QDomDocument &doc, const QString &path, const QString &tag, const QStringList &attrList)
QDomElement elementByPath (const QDomDocument &doc, const QString &path)
QDomElement createElementByPath (QDomDocument &doc, const QString &path)
QDomElement namedChildElement (QDomElement &el, const QString &name)
void writeEntry (QDomDocument &doc, const QString &path, const QString &value)
void writeIntEntry (QDomDocument &doc, const QString &path, int value)
void writeBoolEntry (QDomDocument &doc, const QString &path, bool value)
void writeListEntry (QDomDocument &doc, const QString &path, const QString &tag, const QStringList &value)
void writePairListEntry (QDomDocument &doc, const QString &path, const QString &tag, const QString &firstAttr, const QString &secondAttr, const PairList &value)
void writeTupleListEntry (QDomDocument &doc, const QString &path, const QString &tag, const QStringList &attrList, const TupleList &value)

Static Private Member Functions

QString readEntryAux (const QDomDocument &doc, const QString &path)


Detailed Description

Utility class for conveniently accessing data in a DOM tree.

Definition at line 24 of file domutil.h.


Member Typedef Documentation

typedef QPair<QString, QString> DomUtil::Pair
 

Definition at line 27 of file domutil.h.

Referenced by readPairListEntry().

typedef QValueList<Pair> DomUtil::PairList
 

Definition at line 28 of file domutil.h.

Referenced by readPairListEntry().

typedef QValueList<QStringList> DomUtil::TupleList
 

Definition at line 29 of file domutil.h.

Referenced by readTupleListEntry().


Member Function Documentation

QDomElement DomUtil::createElementByPath QDomDocument &  doc,
const QString &  path
[static]
 

Retrieves an element by path, creating the necessary nodes.

Definition at line 144 of file domutil.cpp.

References namedChildElement().

Referenced by writeEntry(), writeListEntry(), writePairListEntry(), and writeTupleListEntry().

QDomElement DomUtil::elementByPath const QDomDocument &  doc,
const QString &  path
[static]
 

Retrieves an element by path, return null if any item along the path does not exist.

Definition at line 24 of file domutil.cpp.

Referenced by MtpFiltersSettings::delBlock(), MtpFiltersSettings::delGlobal(), MtpFiltersSettings::delInput(), MtpFiltersSettings::delItem(), MtpFiltersSettings::delLine(), QMtp::fileSessions(), readEntry(), readEntryAux(), readListEntry(), readPairListEntry(), readTupleListEntry(), and MtpFilter::~MtpFilter().

void DomUtil::makeEmpty QDomElement &   )  [static]
 

Remove all child elements from a given element.

Definition at line 18 of file domutil.cpp.

QDomElement DomUtil::namedChildElement QDomElement &  el,
const QString &  name
[static]
 

Retrieves a child element, creating it if it does not exist. The return value is guaranteed to be non isNull()

Definition at line 133 of file domutil.cpp.

Referenced by createElementByPath().

bool DomUtil::readBoolEntry const QDomDocument &  doc,
const QString &  path,
bool  defaultEntry = false
[static]
 

Reads a boolean entry. The strings "true" and "TRUE" are interpreted as true, all other as false.

Definition at line 70 of file domutil.cpp.

References readEntryAux().

Referenced by MtpFiltersSettings::displayBlock(), MtpFiltersSettings::displayGlobal(), MtpFiltersSettings::displayInput(), MtpFiltersSettings::displayItem(), MtpFiltersSettings::displayLine(), QMtp::fileSessions(), MtpFilter::MtpFilter(), and QMtp::QMtp().

QString DomUtil::readEntry const QDomDocument &  doc,
const QString &  path,
const QString &  defaultEntry = QString::null
[static]
 

Reads a string entry.

Definition at line 38 of file domutil.cpp.

References elementByPath().

Referenced by ChatSession::ChatSession(), ChatSession::createTelnetManager(), MtpFiltersSettings::displayBlock(), MtpFiltersSettings::displayGlobal(), MtpFiltersSettings::displayInput(), MtpFiltersSettings::displayItem(), MtpFiltersSettings::displayLine(), QMtp::fileSessions(), MtpFilter::MtpFilter(), QMtp::slotConfigure(), QMtp::slotDisplayFortune(), and ChatSession::slotLinkClicked().

QString DomUtil::readEntryAux const QDomDocument &  doc,
const QString &  path
[static, private]
 

Definition at line 51 of file domutil.cpp.

References elementByPath().

Referenced by readBoolEntry(), and readIntEntry().

int DomUtil::readIntEntry const QDomDocument &  doc,
const QString &  path,
int  defaultEntry = 0
[static]
 

Reads a number entry.

Definition at line 60 of file domutil.cpp.

References readEntryAux().

Referenced by MtpFiltersSettings::displayBlock(), MtpFiltersSettings::displayGlobal(), MtpFiltersSettings::displayLine(), MtpFilter::MtpFilter(), QMtp::QMtp(), and QMtp::slotConfigure().

QStringList DomUtil::readListEntry const QDomDocument &  doc,
const QString &  path,
const QString &  tag
[static]
 

Reads a list entry. See writeListEntry().

Definition at line 80 of file domutil.cpp.

References elementByPath().

Referenced by RemoteControlServerInfo::connectCommand(), QMtp::fileNew(), QMtp::fileSessions(), RemoteControlServerInfo::listCommand(), MtpFilter::MtpFilter(), QMtp::QMtp(), ChatSession::send(), MtpFiltersSettings::setDom(), QMtp::slotConfigure(), and ChatSession::slotLinkClicked().

DomUtil::PairList DomUtil::readPairListEntry const QDomDocument &  doc,
const QString &  path,
const QString &  tag,
const QString &  firstAttr,
const QString &  secondAttr
[static]
 

Reads a list of string pairs. See writePairListEntry().

Definition at line 96 of file domutil.cpp.

References elementByPath(), Pair, and PairList.

DomUtil::TupleList DomUtil::readTupleListEntry const QDomDocument &  doc,
const QString &  path,
const QString &  tag,
const QStringList &  attrList
[static]
 

Definition at line 115 of file domutil.cpp.

References elementByPath(), and TupleList.

void DomUtil::writeBoolEntry QDomDocument &  doc,
const QString &  path,
bool  value
[static]
 

Writes a boolean entry. Booleans are stored as "true", "false" resp.

Definition at line 173 of file domutil.cpp.

References writeEntry().

Referenced by MtpFiltersSettings::changedBlock(), MtpFiltersSettings::changedGlobal(), MtpFiltersSettings::changedInput(), MtpFiltersSettings::changedItem(), MtpFiltersSettings::changedLine(), QMtp::fileSessions(), and MtpFilter::~MtpFilter().

void DomUtil::writeEntry QDomDocument &  doc,
const QString &  path,
const QString &  value
[static]
 

Writes a string entry. For example, writeEntry(doc, "/general/special", "foo"); creates the DOM fragment foo

Definition at line 160 of file domutil.cpp.

References createElementByPath().

Referenced by MtpFiltersSettings::changedBlock(), MtpFiltersSettings::changedGlobal(), MtpFiltersSettings::changedInput(), MtpFiltersSettings::changedItem(), MtpFiltersSettings::changedLine(), QMtp::fileSessions(), QMtp::slotConfigure(), writeBoolEntry(), writeIntEntry(), and MtpFilter::~MtpFilter().

void DomUtil::writeIntEntry QDomDocument &  doc,
const QString &  path,
int  value
[static]
 

Writes a number entry.

Definition at line 167 of file domutil.cpp.

References writeEntry().

Referenced by MtpFiltersSettings::changedBlock(), MtpFiltersSettings::changedGlobal(), MtpFiltersSettings::changedLine(), QMtp::slotConfigure(), and MtpFilter::~MtpFilter().

void DomUtil::writeListEntry QDomDocument &  doc,
const QString &  path,
const QString &  tag,
const QStringList &  value
[static]
 

Writes a string list element. The list elements are separated by tag. For example, QStringList l; l << "one" << "two"; writeEntry(doc, "/general/special", "el", l); creates the DOM fragment onetwo

Definition at line 179 of file domutil.cpp.

References createElementByPath().

Referenced by QMtp::fileSessions(), QMtp::slotConfigure(), MtpFiltersSettings::updateList(), and MtpFilter::~MtpFilter().

void DomUtil::writePairListEntry QDomDocument &  doc,
const QString &  path,
const QString &  tag,
const QString &  firstAttr,
const QString &  secondAttr,
const PairList value
[static]
 

Writes a list of string pairs. The list elements are stored in the attributes firstAttr and secondAttr of elements named tag. For example, DomUtil::StringPairList l; l << DomUtil::StringPair("one", "1"); l << DomUtil::StringPair("two", "2"); writeEntry(doc, "/general/special", "el", "first", "second", l); creates the DOM fragment <el first="one" second="1"/> <el first="two" second="2"/>

Definition at line 193 of file domutil.cpp.

References createElementByPath().

void DomUtil::writeTupleListEntry QDomDocument &  doc,
const QString &  path,
const QString &  tag,
const QStringList &  attrList,
const TupleList value
[static]
 

Definition at line 208 of file domutil.cpp.

References createElementByPath().


The documentation for this class was generated from the following files:
Generated on Sat May 10 15:09:59 2003 for qnet by doxygen1.3