#include <domutil.h>
Public Types | |
typedef TQPair< TQString, TQString > | Pair |
typedef TQValueList< Pair > | PairList |
Static Public Member Functions | |
static void | makeEmpty (TQDomElement &) |
static TQString | readEntry (const TQDomDocument &doc, const TQString &path, const TQString &defaultEntry=TQString()) |
static int | readIntEntry (const TQDomDocument &doc, const TQString &path, int defaultEntry=0) |
static bool | readBoolEntry (const TQDomDocument &doc, const TQString &path, bool defaultEntry=false) |
static TQStringList | readListEntry (const TQDomDocument &doc, const TQString &path, const TQString &tag) |
static PairList | readPairListEntry (const TQDomDocument &doc, const TQString &path, const TQString &tag, const TQString &firstAttr, const TQString &secondAttr) |
static TQMap< TQString, TQString > | readMapEntry (const TQDomDocument &doc, const TQString &path) |
static TQDomElement | elementByPath (const TQDomDocument &doc, const TQString &path) |
static TQDomElement | createElementByPath (TQDomDocument &doc, const TQString &path) |
static TQDomElement | namedChildElement (TQDomElement &el, const TQString &name) |
static void | writeEntry (TQDomDocument &doc, const TQString &path, const TQString &value) |
static void | writeIntEntry (TQDomDocument &doc, const TQString &path, int value) |
static void | writeBoolEntry (TQDomDocument &doc, const TQString &path, bool value) |
static void | writeListEntry (TQDomDocument &doc, const TQString &path, const TQString &tag, const TQStringList &value) |
static void | writePairListEntry (TQDomDocument &doc, const TQString &path, const TQString &tag, const TQString &firstAttr, const TQString &secondAttr, const PairList &value) |
static void | writeMapEntry (TQDomDocument &doc, const TQString &path, const TQMap< TQString, TQString > &map) |
static DomPath | resolvPathStringExt (const TQString pathstring) |
static TQDomElement | elementByPathExt (TQDomDocument &doc, const TQString &pathstring) |
static bool | openDOMFile (TQDomDocument &doc, TQString filename) |
static bool | saveDOMFile (TQDomDocument &doc, TQString filename) |
static bool | removeTextNodes (TQDomDocument doc, TQString pathExt) |
static bool | appendText (TQDomDocument doc, TQString pathExt, TQString text) |
static bool | replaceText (TQDomDocument doc, TQString pathExt, TQString text) |
Detailed Description
Utility class for conveniently accessing data in a DOM tree.
Member Function Documentation
◆ appendText()
|
static |
Add child text node to parent described in pathExt.
Definition at line 350 of file domutil.cpp.
◆ createElementByPath()
|
static |
Retrieves an element by path, creating the necessary nodes.
Definition at line 145 of file domutil.cpp.
◆ elementByPath()
|
static |
Retrieves an element by path, return null if any item along the path does not exist.
Definition at line 28 of file domutil.cpp.
◆ elementByPathExt()
|
static |
Retrieve an element specified with extended path examples:
- 1: "widget|class=TQDialog/property|name=geometry" or "widget|class=TQDialog/property||1"
- 2: "widget/property|name=caption/string" or "widget/property||2/string"
<widget class=TQDIALOG_OBJECT_NAME_STRING> <property name="name"> <cstring>KdevFormName</cstring> </property> <property name="geometry"> <-- 1. reaches this node <rect> <x>0</x> <y>0</y> <width>600</width> <height>480</height> </rect> </property> <property name="caption"> <string>KdevFormCaption</string> <-- 2. reaches this node </property> </widget>
Definition at line 259 of file domutil.cpp.
◆ makeEmpty()
|
static |
Remove all child elements from a given element.
Definition at line 22 of file domutil.cpp.
◆ namedChildElement()
|
static |
Retrieves a child element, creating it if it does not exist.
The return value is guaranteed to be non isNull()
Definition at line 134 of file domutil.cpp.
◆ openDOMFile()
|
static |
Open file - filename - and set setContents of doc.
Definition at line 313 of file domutil.cpp.
◆ readBoolEntry()
|
static |
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.
◆ readEntry()
|
static |
Reads a string entry.
Definition at line 43 of file domutil.cpp.
◆ readIntEntry()
|
static |
Reads a number entry.
Definition at line 65 of file domutil.cpp.
◆ readListEntry()
|
static |
◆ readMapEntry()
|
static |
◆ readPairListEntry()
|
static |
◆ removeTextNodes()
|
static |
Remove all child text nodes of parent described in pathExt.
Definition at line 337 of file domutil.cpp.
◆ replaceText()
|
static |
Replace all chilt text nodes of parent described in pathExt with one new.
Definition at line 360 of file domutil.cpp.
◆ resolvPathStringExt()
|
static |
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 221 of file domutil.cpp.
◆ saveDOMFile()
|
static |
Store contents of doc in file - filename.
Existing file will be truncated!
Definition at line 326 of file domutil.cpp.
◆ writeBoolEntry()
|
static |
Writes a boolean entry.
Booleans are stored as "true", "false" resp.
Definition at line 186 of file domutil.cpp.
◆ writeEntry()
|
static |
Writes a string entry.
For example,
<code> writeEntry(doc, "/general/special", "foo"); </code>
creates the DOM fragment:
<code> <general><special>foo</special></general> </code>
Definition at line 162 of file domutil.cpp.
◆ writeIntEntry()
|
static |
Writes a number entry.
Definition at line 180 of file domutil.cpp.
◆ writeListEntry()
|
static |
Writes a string list element.
The list elements are separated by tag. For example,
<code> TQStringList l; l << "one" << "two"; writeListEntry(doc, "/general/special", "el", l); </code>
creates the DOM fragment:
<code> <general><special><el>one</el><el>two</el></special></general> </code>
Definition at line 192 of file domutil.cpp.
◆ writeMapEntry()
|
static |
Writes a string to string map.
This map is stored in a way, that it can be read with readMapEntry() and readEntry()
Definition at line 168 of file domutil.cpp.
◆ writePairListEntry()
|
static |
Writes a list of string pairs.
The list elements are stored in the attributes firstAttr and secondAttr of elements named tag. For example,
<code> DomUtil::PairList l; l << DomUtil::StringPair("one", "1"); l << DomUtil::StringPair("two", "2"); writePairListEntry(doc, "/general/special", "el", "first", "second", l); </code>
creates the DOM fragment:
<code> <general><special> <el first="one" second="1"/> <el first="two" second="2"/> </special></general> </code>
Definition at line 206 of file domutil.cpp.
The documentation for this class was generated from the following files: