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. | |
QMap< QString, QString > | readMapEntry (const QDomDocument &doc, const QString &path) |
Reads a string to string map. | |
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. | |
void | writeMapEntry (QDomDocument &doc, const QString &path, const QMap< QString, QString > &map) |
Writes a string to string map. | |
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
|
|
Member Function Documentation
|
Add child text node to parent described in pathExt.
Definition at line 350 of file domutil.cpp. References elementByPathExt(), and text(). Referenced by replaceText(). |
|
Retrieves an element by path, creating the necessary nodes.
Definition at line 145 of file domutil.cpp. References namedChildElement(). Referenced by CustomProjectPart::openProject(), QtDesignerIntegration::saveSettings(), 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. Referenced by CustomProjectPart::allMakeEnvironments(), CustomMakeConfigWidget::envRemoved(), FCConfigWidget::loadGlobalConfig(), QtDesignerIntegration::loadSettings(), CustomProjectPart::openProject(), readEntry(), readEntryAux(), readListEntry(), readMapEntry(), readPairListEntry(), FileCreatePart::readTypes(), TrollProjectWidget::removeFile(), CppSupportPart::setupCatalog(), AutoProjectPart::setWantautotools(), TrollProjectWidget::slotDetailsContextMenu(), AutoDetailsView::slotDetailsContextMenu(), FileCreatePart::slotGlobalInitialize(), and FileCreatePart::slotInitialize(). |
|
Retrieve an element specified with extended path examples:.
<widget class="QDialog"> <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. References DomPathElement::attribute, DomPath, DomPathElement::matchNumber, DomAttribute::name, resolvPathStringExt(), DomPathElement::tagName, and DomAttribute::value. Referenced by NewWidgetDlg::accept(), appendText(), ImplementationWidget::ImplementationWidget(), SubclassingDlg::readBaseClassName(), SubclassingDlg::readUiFile(), and removeTextNodes(). |
|
Remove all child elements from a given element.
Definition at line 22 of file domutil.cpp. Referenced by CustomProjectPart::openProject(). |
|
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. Referenced by createElementByPath(). |
|
Open file - filename - and set setContents of doc.
Definition at line 313 of file domutil.cpp. References file. Referenced by NewWidgetDlg::accept(), ImplementationWidget::ImplementationWidget(), FCConfigWidget::loadGlobalConfig(), GenericProjectPart::loadProjectConfig(), SubclassingDlg::readBaseClassName(), SubclassingDlg::readUiFile(), and FileCreatePart::slotGlobalInitialize(). |
|
|
|
Definition at line 56 of file domutil.cpp. References elementByPath(). Referenced by readBoolEntry(), and readIntEntry(). |
|
Reads a number entry.
Definition at line 65 of file domutil.cpp. References readEntryAux(). Referenced by GDBDebugger::GDBController::configure(), TrollProjectWidget::constructMakeCommandLine(), AutoProjectPart::constructMakeCommandLine(), GDBDebugger::DebuggerConfigWidget::DebuggerConfigWidget(), CppCodeCompletionConfig::init(), AutoProjectPart::makefileCvsCommand(), PHPConfigData::PHPConfigData(), and CustomProjectPart::startMakeCommand(). |
|
Reads a list entry. See writeListEntry(). Definition at line 85 of file domutil.cpp. References elementByPath(). Referenced by DocTreeGlobalConfigWidget::DocTreeGlobalConfigWidget(), SQLSupportPart::loadConfig(), DocTreeViewWidget::projectChanged(), DocTreeProjectConfigWidget::readConfig(), PartSelectWidget::readProjectConfig(), LanguageSelectWidget::readProjectConfig(), and CppSupportPart::setupCatalog(). |
|
Reads a string to string map. See writeMapEntry() Definition at line 120 of file domutil.cpp. References elementByPath(). |
|
|
Remove all child text nodes of parent described in pathExt.
Definition at line 337 of file domutil.cpp. References elementByPathExt(). Referenced by replaceText(). |
|
Replace all chilt text nodes of parent described in pathExt with one new.
Definition at line 360 of file domutil.cpp. References appendText(), removeTextNodes(), and text(). Referenced by NewWidgetDlg::accept(). |
|
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. References DomPathElement::attribute, DomPath, DomPathElement::matchNumber, DomAttribute::name, DomPathElement::tagName, and DomAttribute::value. Referenced by elementByPathExt(). |
|
Store contents of doc in file - filename. Existing file will be truncated! Definition at line 326 of file domutil.cpp. References file. Referenced by NewWidgetDlg::accept(). |
|
Writes a boolean entry. Booleans are stored as "true", "false" resp. Definition at line 186 of file domutil.cpp. References writeEntry(). Referenced by RunOptionsWidget::accept(), MakeOptionsWidget::accept(), RubyConfigWidget::accept(), PythonConfigWidget::accept(), PerlConfigWidget::accept(), GDBDebugger::DebuggerConfigWidget::accept(), CustomMakeConfigWidget::accept(), AutoProjectWidget::addFiles(), CvsOptions::save(), CppCodeCompletionConfig::store(), DocIndexDialog::storeConfig(), PHPConfigData::storeConfig(), FtnchekConfigWidget::storeConfig(), DistpartDialog::storeSettings(), GeneralInfoWidget::writeConfig(), FileGroupsWidget::~FileGroupsWidget(), FileTreeViewWidgetImpl::~FileTreeViewWidgetImpl(), and VCSFileTreeWidgetImpl::~VCSFileTreeWidgetImpl(). |
|
|
Writes a number entry.
Definition at line 180 of file domutil.cpp. References writeEntry(). Referenced by MakeOptionsWidget::accept(), GDBDebugger::DebuggerConfigWidget::accept(), CustomMakeConfigWidget::accept(), CppCodeCompletionConfig::store(), PHPConfigData::storeConfig(), and DistpartDialog::storeSettings(). |
|
Writes a string list element. The list elements are separated by tag. For example, <code> QStringList l; l << "one" << "two"; writeListEntry(doc, "/general/special", "el", l); </code> <code> <general><special><el>one</el><el>two</el></special></general> </code> Definition at line 192 of file domutil.cpp. References createElementByPath(). Referenced by AppWizardDialog::openAfterGeneration(), CppSupportPart::projectClosed(), PartSelectWidget::saveProjectConfig(), LanguageSelectWidget::saveProjectConfig(), and DocTreeProjectConfigWidget::storeConfig(). |
|
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. References kdDebug(), and writeEntry(). Referenced by AppWizardDialog::openAfterGeneration(). |
|
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> <code> <general><special> <el first="one" second="1"/> <el first="two" second="2"/> </special></general> </code> Definition at line 206 of file domutil.cpp. References createElementByPath(), and PairList. Referenced by EnvironmentVariablesWidget::accept(), TrollProjectWidget::removeFile(), AutoProjectPart::setWantautotools(), TrollProjectWidget::slotDetailsContextMenu(), AutoDetailsView::slotDetailsContextMenu(), and FileGroupsConfigWidget::storeConfig(). |
The documentation for this class was generated from the following files:
- lib/util/domutil.h
- lib/util/domutil.cpp