DomUtil Class Reference
Utility class for conveniently accessing data in a DOM tree. More...
#include <domutil.h>
Public Types | |
typedef QPair< QString, QString > | Pair |
typedef QValueList< Pair > | PairList |
Static Public Member Functions | |
void | makeEmpty (QDomElement &) |
Remove all child elements from a given element. | |
QString | readEntry (const QDomDocument &doc, const QString &path, const QString &defaultEntry=QString::null) |
Reads a string entry. | |
int | readIntEntry (const QDomDocument &doc, const QString &path, int defaultEntry=0) |
Reads a number entry. | |
bool | readBoolEntry (const QDomDocument &doc, const QString &path, bool defaultEntry=false) |
Reads a boolean entry. | |
QStringList | readListEntry (const QDomDocument &doc, const QString &path, const QString &tag) |
Reads a list entry. | |
PairList | readPairListEntry (const QDomDocument &doc, const QString &path, const QString &tag, const QString &firstAttr, const QString &secondAttr) |
Reads a list of string pairs. | |
QDomElement | elementByPath (const QDomDocument &doc, const QString &path) |
Retrieves an element by path, return null if any item along the path does not exist. | |
QDomElement | createElementByPath (QDomDocument &doc, const QString &path) |
Retrieves an element by path, creating the necessary nodes. | |
QDomElement | namedChildElement (QDomElement &el, const QString &name) |
Retrieves a child element, creating it if it does not exist. | |
void | writeEntry (QDomDocument &doc, const QString &path, const QString &value) |
Writes a string entry. | |
void | writeIntEntry (QDomDocument &doc, const QString &path, int value) |
Writes a number entry. | |
void | writeBoolEntry (QDomDocument &doc, const QString &path, bool value) |
Writes a boolean entry. | |
void | writeListEntry (QDomDocument &doc, const QString &path, const QString &tag, const QStringList &value) |
Writes a string list element. | |
void | writePairListEntry (QDomDocument &doc, const QString &path, const QString &tag, const QString &firstAttr, const QString &secondAttr, const PairList &value) |
Writes a list of string pairs. | |
DomPath | resolvPathStringExt (const QString pathstring) |
Resolves an extended path Extended path format: pathpart: tag[|attr1=value[;attr2=value;..][|matchNumber]] where matchNumber is zero-based path: pathpart[/pathpart/..]. | |
QDomElement | elementByPathExt (QDomDocument &doc, const QString &pathstring) |
Retrieve an element specified with extended path examples:. | |
bool | openDOMFile (QDomDocument &doc, QString filename) |
Open file - filename - and set setContents of doc. | |
bool | saveDOMFile (QDomDocument &doc, QString filename) |
Store contents of doc in file - filename. | |
bool | removeTextNodes (QDomDocument doc, QString pathExt) |
Remove all child text nodes of parent described in pathExt. | |
bool | appendText (QDomDocument doc, QString pathExt, QString text) |
Add child text node to parent described in pathExt. | |
bool | replaceText (QDomDocument doc, QString pathExt, QString text) |
Replace all chilt text nodes of parent described in pathExt with one new. | |
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 40 of file domutil.h.
Member Typedef Documentation
|
Definition at line 43 of file domutil.h. Referenced by SubclassesDlg::accept(), EnvironmentVariablesWidget::accept(), readPairListEntry(), AutoProjectPart::setWantautotools(), AutoDetailsView::slotDetailsContextMenu(), TrollProjectWidget::slotExecuteTarget(), and FileGroupsConfigWidget::storeConfig(). |
|
Member Function Documentation
|
Add child text node to parent described in pathExt.
Definition at line 326 of file domutil.cpp. References appendText(), elementByPathExt(), and text(). Referenced by appendText(), and replaceText(). |
|
Retrieves an element by path, creating the necessary nodes.
Definition at line 132 of file domutil.cpp. References createElementByPath(), and namedChildElement(). Referenced by createElementByPath(), writeEntry(), writeListEntry(), and writePairListEntry(). |
|
Retrieves an element by path, return null if any item along the path does not exist.
Definition at line 28 of file domutil.cpp. References elementByPath(). Referenced by elementByPath(), readEntry(), readEntryAux(), readListEntry(), and readPairListEntry(). |
|
Retrieve an element specified with extended path examples:.
Definition at line 235 of file domutil.cpp. References DomPathElement::attribute, elementByPathExt(), DomPathElement::matchNumber, DomAttribute::name, resolvPathStringExt(), rightchild, DomPathElement::tagName, and DomAttribute::value. Referenced by appendText(), elementByPathExt(), and removeTextNodes(). |
|
Remove all child elements from a given element.
Definition at line 22 of file domutil.cpp. References makeEmpty(). Referenced by makeEmpty(). |
|
Retrieves a child element, creating it if it does not exist. The return value is guaranteed to be non isNull() Definition at line 121 of file domutil.cpp. References namedChildElement(). Referenced by createElementByPath(), and namedChildElement(). |
|
Open file - filename - and set setContents of doc.
Definition at line 289 of file domutil.cpp. References file, and openDOMFile(). Referenced by openDOMFile(). |
|
Reads a boolean entry. The strings "true" and "TRUE" are interpreted as true, all other as false. Definition at line 75 of file domutil.cpp. References readBoolEntry(), and readEntryAux(). Referenced by readBoolEntry(). |
|
Reads a string entry.
Definition at line 43 of file domutil.cpp. References elementByPath(), and readEntry(). Referenced by readEntry(). |
|
Definition at line 56 of file domutil.cpp. References elementByPath(), and readEntryAux(). Referenced by readBoolEntry(), readEntryAux(), and readIntEntry(). |
|
Reads a number entry.
Definition at line 65 of file domutil.cpp. References readEntryAux(), and readIntEntry(). Referenced by readIntEntry(). |
|
Reads a list entry. See writeListEntry(). Definition at line 85 of file domutil.cpp. References elementByPath(), and readListEntry(). Referenced by readListEntry(). |
|
Reads a list of string pairs. See writePairListEntry(). Definition at line 101 of file domutil.cpp. References elementByPath(), first(), Pair, PairList, and readPairListEntry(). Referenced by readPairListEntry(). |
|
Remove all child text nodes of parent described in pathExt.
Definition at line 313 of file domutil.cpp. References elementByPathExt(), and removeTextNodes(). Referenced by removeTextNodes(), and replaceText(). |
|
Replace all chilt text nodes of parent described in pathExt with one new.
Definition at line 336 of file domutil.cpp. References appendText(), removeTextNodes(), replaceText(), and text(). Referenced by replaceText(). |
|
Resolves an extended path Extended path format: pathpart: tag[|attr1=value[;attr2=value;..][|matchNumber]] where matchNumber is zero-based path: pathpart[/pathpart/..].
Definition at line 197 of file domutil.cpp. References DomPathElement::attribute, DomPath, DomPathElement::matchNumber, DomAttribute::name, resolvPathStringExt(), DomPathElement::tagName, and DomAttribute::value. Referenced by elementByPathExt(), and resolvPathStringExt(). |
|
Store contents of doc in file - filename. Existing file will be truncated! Definition at line 302 of file domutil.cpp. References file, and saveDOMFile(). Referenced by saveDOMFile(). |
|
Writes a boolean entry. Booleans are stored as "true", "false" resp. Definition at line 162 of file domutil.cpp. References writeBoolEntry(), and writeEntry(). Referenced by writeBoolEntry(). |
|
Writes a string entry. For example, creates the DOM fragment:
Definition at line 149 of file domutil.cpp. References createElementByPath(), and writeEntry(). Referenced by writeBoolEntry(), writeEntry(), and writeIntEntry(). |
|
Writes a number entry.
Definition at line 156 of file domutil.cpp. References writeEntry(), and writeIntEntry(). Referenced by writeIntEntry(). |
|
Writes a string list element. The list elements are separated by tag. For example, creates the DOM fragment:
Definition at line 168 of file domutil.cpp. References createElementByPath(), and writeListEntry(). Referenced by writeListEntry(). |
|
Writes a list of string pairs. The list elements are stored in the attributes firstAttr and secondAttr of elements named tag. For example, creates the DOM fragment:
Definition at line 182 of file domutil.cpp. References createElementByPath(), and writePairListEntry(). Referenced by writePairListEntry(). |
The documentation for this class was generated from the following files:
- lib/util/domutil.h
- lib/util/domutil.cpp