Debian Codegraph @

src/tools/uic/shared/writeincludesbase.h

raw
1 // Copyright (C) 2021 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4 #ifndef WRITEINCLUDES_BASE_H
5 #define WRITEINCLUDES_BASE_H
6
7 #include <treewalker.h>
8
9 #include <QtCore/qset.h>
10 #include <QtCore/qstring.h>
11
12 QT_BEGIN_NAMESPACE
13
14 class DomCustomWidget;
15 class Uic;
16
17 struct ClassInfoEntry
18 {
19 const char *klass;
20 const char *module;
21 const char *header;
22 };
23
24 struct ClassInfoEntries
25 {
26 const ClassInfoEntry *begin() const { return m_begin; }
27 const ClassInfoEntry *end() const { return m_end; }
28
29 const ClassInfoEntry *m_begin;
30 const ClassInfoEntry *m_end;
31 };
32
33 ClassInfoEntries classInfoEntries();
34
35 class WriteIncludesBase : public TreeWalker
36 {
37 public:
38 explicit WriteIncludesBase(Uic *uic);
39
40 void acceptUI(DomUI *node) override;
41 void acceptWidget(DomWidget *node) override;
42 void acceptLayout(DomLayout *node) override;
43 void acceptSpacer(DomSpacer *node) override;
44 void acceptProperty(DomProperty *node) override;
45
46 //
47 // actions
48 //
49 void acceptActionGroup(DomActionGroup *node) override;
50 void acceptAction(DomAction *node) override;
51 void acceptActionRef(DomActionRef *node) override;
52
53 //
54 // custom widgets
55 //
56 void acceptCustomWidget(DomCustomWidget *node) override;
57
58 protected:
59 void add(const QString &className, const DomCustomWidget *dcw = nullptr);
60
61 virtual void doAdd(const QString &className, const DomCustomWidget *dcw = nullptr) = 0;
62
63 const Uic *uic() const { return m_uic; }
64 Uic *uic() { return m_uic; }
65
66 private:
67 QSet<QString> m_knownClasses;
68 Uic *m_uic;
69 bool m_laidOut = false;
70 };
71
72 QT_END_NAMESPACE
73
74 #endif // WRITEINCLUDES_BASE_H