25 #include <qtextstream.h>
34 #define SAFE_DELETE(_p) \
85 return (!resultnode.isNull());
102 QFile filehandle(filename);
104 if (filehandle.open(QIODevice::ReadOnly) ==
FALSE)
156 if (rootnode->isNull() ==
TRUE)
161 QFile filehandle(filename);
163 if (filehandle.open(QIODevice::WriteOnly) ==
FALSE)
169 QTextStream textstream(&filehandle);
171 rootnode->save(textstream, 0);
180 QDomAttr resultattribute;
189 QDomAttr resultattribute;
193 value = resultattribute.value();
194 value.toFloat(&bConv);
201 value.toLong(&bConv);
259 QDomAttr resultattribute;
264 value = resultattribute.value().toLong();
273 QDomAttr resultattribute;
278 value = resultattribute.value().toFloat();
287 QDomAttr resultattribute;
292 value = resultattribute.value();
334 bool bSuccess =
false;
337 bSuccess =
findDirectory(directory, startnode, absolute, index);
338 if (bSuccess ==
TRUE)
348 signed long currentindex = index;
353 while ((i < childnodes.count()) && (currentindex >= 0))
355 QDomNode readnode = childnodes.item(i);
356 QDomElement e = readnode.toElement();
357 if (e.isNull() ==
FALSE)
359 if (currentindex == 0)
361 foundnode = readnode;
368 if (currentindex == -1)
381 bool bSuccess =
FALSE;
399 QDomElement e = node.toElement();
402 path = e.tagName() +
"." + path;
404 node = node.parentNode();
416 QDomElement e = node.toElement();
429 QDomNodeList childnodes;
431 childnodes = node.childNodes();
435 for (
int i = 0; i < childnodes.count(); i++)
437 QDomNode readnode = childnodes.item(i);
438 QDomElement e = readnode.toElement();
439 if (e.isNull() ==
FALSE)
441 if ((directory.isNull()) || (e.tagName() == directory))
454 QDomNamedNodeMap namednodemap = node.toElement().attributes();
456 return namednodemap.length();
476 return (!resultnode.isNull());
490 return (resultnode.isNull());
501 QString workname = directory;
503 if (absolute ==
TRUE)
512 while ((workname !=
"") && (bError ==
FALSE))
515 signed long dotindex = 0;
516 QString currentsearch;
518 dotindex = workname.indexOf(
".");
521 currentsearch = workname;
526 currentsearch = workname;
527 currentsearch.truncate(dotindex);
528 workname.remove(0, dotindex + 1);
531 QDomNode node = startnode.firstChild();
534 while ((node.isNull() ==
FALSE) && (bError ==
TRUE))
536 QDomElement e = node.toElement();
537 if (e.isNull() ==
FALSE)
539 if (e.tagName() == currentsearch)
542 if ((dotindex == -1) && (index > 0))
552 node = node.nextSibling();
558 foundnode = startnode;
569 QDomNode readnode = currentnode;
570 QDomElement currentelement = readnode.toElement();
571 bool bFound = currentelement.hasAttribute(field);
573 attribute = currentelement.attributeNode(field);
bool findField(const QString &field, const QDomNode ¤tnode, QDomAttr &attribute)
unsigned long getFieldCount()
bool getFieldFloatValue(const QString &field, float &value)
QString getCurrentSubDirectory()
QDomDocument * m_pDomDocument
static bool isRoot(const QDomNode &node)
bool setCurrentDirectoryUp()
bool setFieldStringValue(const QString &field, const QString &value)
void setCurrentDomNode(const QDomNode &node)
unsigned long getSubDirectoryCount(const QString &directory=QString())
bool setCurrentDirectory(const QString &directory, bool absolute=false, int index=0)
bool setFieldFloatValue(const QString &field, float value)
QString getCurrentDirectory()
bool findDirectory(const QString &directory, QDomNode &foundnode, bool absolute, int index=0)
bool isFieldPresent(const QString &field)
bool setCurrentSubDirectory(int index)
bool getFieldType(const QString &field, FIELDTYPE &type)
virtual bool load(const QString &filename)
bool getFieldStringValue(const QString &field, QString &value)
bool isDirectoryPresent(const QString &directory, bool absolute=false, int index=0)
QDomNode getCurrentDomNode()
virtual bool save(const QString &filename)
bool addField(const QString &field, long value)
bool create(const QString &docname)
bool getFieldLongValue(const QString &field, long &value)
bool addDirectory(const QString &directory)
QDomNode m_CurrentDomNode
bool remDirectory(const QString &directory)
virtual ~OXMLTreeManager()
bool setFieldLongValue(const QString &field, long value)
QDomNode getRootDomNode()