Alkimia API

alkdom.h
1/*
2 SPDX-FileCopyrightText: 2024 Ralf Habacker ralf.habacker @freenet.de
3
4 This file is part of libalkimia.
5
6 SPDX-License-Identifier: LGPL-2.1-or-later
7*/
8
9#ifndef ALKDOM_H
10#define ALKDOM_H
11
12#include <alkimia/alk_export.h>
13
14#include <QString>
15#include <QStringList>
16
17class AlkDomDocument;
18
19/**
20 * The class AlkDomElement is a replacement for QDomElement
21 * with the possibility to store attributes sorted.
22 *
23 * Sorted attributes are important for a textual comparison.
24 *
25 * @author Ralf Habacker <ralf.habacker@freenet.de>
26 */
27class ALK_EXPORT AlkDomElement
28{
29public:
30 explicit AlkDomElement(const QString &tag = QString());
31 virtual ~AlkDomElement();
32
33 void setComment(const QString &comment);
34 void setAttribute(const QString &name, const QString &value);
35 void setAttribute(const QString &name, double value);
36 void appendChild(const AlkDomElement &element);
37 virtual QString toString(bool withIndentation = true, int level = 0) const;
38
39protected:
40 QString m_tag;
41 QString m_comment;
42 QStringList m_attributes;
43 QList<AlkDomElement> m_childs;
44};
45
46/**
47 * The class AlkDomDocument is a simple replacement for QDomDocument.
48 *
49 * @author Ralf Habacker <ralf.habacker@freenet.de>
50 */
51class ALK_EXPORT AlkDomDocument : public AlkDomElement
52{
53public:
54 AlkDomDocument(const QString &type = QString());
55 virtual ~AlkDomDocument() override;
56
57 AlkDomElement createElement(const QString &name);
58 QString toString(bool withIndentation = true, int level = 0) const override;
59
60protected:
61 QString m_type;
62};
63
64#endif // ALKDOM_H
The class AlkDomDocument is a simple replacement for QDomDocument.
Definition alkdom.h:52
The class AlkDomElement is a replacement for QDomElement with the possibility to store attributes sor...
Definition alkdom.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.