1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef XMLSTREAMREADER_H
6#define XMLSTREAMREADER_H
7
8#include <QObject>
9#include <QXmlStreamReader>
10
11struct Tip {
12 QString function;
13 QString pointer;
14 QString object;
15 QString dir;
16 QString file;
17 QString line;
18};
19class QTreeWidget;
20class QTreeWidgetItem;
21class XmlStreamReaderPrivate;
22class XmlStreamReader : public QObject
23{
24 Q_OBJECT;
25public:
26 XmlStreamReader(QTreeWidget *tree);
27
28 bool readFile(const QString &fileName = NULL);
29
30private:
31 void readErrorElement();
32 void readWhatElement();
33 void readXWhatElement();
34 void readStackElement(QTreeWidgetItem *parent);
35 void readFrameElement(QTreeWidgetItem *parent);
36 void skipUnknownElement();
37
38 void saveTip(Tip &tip, const QString &name, const QString &text);
39 void setItem(Tip &tip, QTreeWidgetItem *parent);
40 QString toolTipContent(Tip &tip);
41
42 QTreeWidget *treeWidget = nullptr;
43 QXmlStreamReader reader;
44 QString currentIssue;
45};
46
47#endif // XMLSTREAMREADER_H
48