File indexing completed on 2022-09-27 16:29:29

0001 /**
0002  * SPDX-FileCopyrightText: (C) 2003 Sébastien Laoût <slaout@linux62.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef XMLWORKXMLWORK_H
0008 #define XMLWORKXMLWORK_H
0009 
0010 #include <QXmlStreamWriter>
0011 #include <QtCore/QString>
0012 
0013 class QDomDocument;
0014 class QDomElement;
0015 
0016 /** All related functions to manage XML files and trees
0017  * @author Sébastien Laoût
0018  */
0019 namespace XMLWork
0020 {
0021 // Manage XML files :
0022 QDomDocument *openFile(const QString &name, const QString &filePath);
0023 // Manage XML trees :
0024 QDomElement getElement(const QDomElement &startElement, const QString &elementPath);
0025 QString getElementText(const QDomElement &startElement, const QString &elementPath, const QString &defaultTxt = QString());
0026 void addElement(QDomDocument &document, QDomElement &parent, const QString &name, const QString &text);
0027 QString innerXml(QDomElement &element);
0028 void setupXmlStream(QXmlStreamWriter &stream, QString startElement); ///< Set XML options and write document start
0029 // Not directly related to XML :
0030 bool trueOrFalse(const QString &value, bool defaultValue = true);
0031 QString trueOrFalse(bool value);
0032 }
0033 
0034 #endif // XMLWORKXMLWORK_H