1 | // Copyright (C) 2016 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 CPPWRITEINCLUDES_H |
5 | #define CPPWRITEINCLUDES_H |
6 | |
7 | #include <writeincludesbase.h> |
8 | |
9 | #include <QtCore/qmap.h> |
10 | |
11 | #include <set> |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | class QTextStream; |
16 | |
17 | namespace CPP { |
18 | |
19 | class WriteIncludes : public WriteIncludesBase |
20 | { |
21 | public: |
22 | WriteIncludes(Uic *uic); |
23 | |
24 | void acceptUI(DomUI *node) override; |
25 | void acceptInclude(DomInclude *node) override; |
26 | |
27 | protected: |
28 | QTextStream &output() const { return m_output; } |
29 | void doAdd(const QString &className, const DomCustomWidget *dcw = nullptr) override; |
30 | |
31 | private: |
32 | using OrderedSet = std::set<QString>; |
33 | void addCppCustomWidget(const QString &className, const DomCustomWidget *dcw); |
34 | void insertIncludeForClass(const QString &className, QString header = QString(), bool global = false); |
35 | void insertInclude(const QString &header, bool global); |
36 | void writeHeaders(const OrderedSet &headers, bool global); |
37 | QString headerForClassName(const QString &className) const; |
38 | |
39 | QTextStream &m_output; |
40 | |
41 | OrderedSet m_localIncludes; |
42 | OrderedSet m_globalIncludes; |
43 | QSet<QString> m_includeBaseNames; |
44 | using StringMap = QMap<QString, QString>; |
45 | StringMap m_classToHeader; |
46 | StringMap m_oldHeaderToNewHeader; |
47 | }; |
48 | |
49 | } // namespace CPP |
50 | |
51 | QT_END_NAMESPACE |
52 | |
53 | #endif // CPPWRITEINCLUDES_H |
54 |