1 | /* |
---|---|
2 | This file is part of KDE. |
3 | |
4 | SPDX-FileCopyrightText: 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | SPDX-FileCopyrightText: 2003 Waldo Bastian <bastian@kde.org> |
6 | SPDX-FileCopyrightText: 2003 Zack Rusin <zack@kde.org> |
7 | SPDX-FileCopyrightText: 2006 Michaƫl Larouche <michael.larouche@kdemail.net> |
8 | SPDX-FileCopyrightText: 2008 Allen Winter <winter@kde.org> |
9 | SPDX-FileCopyrightText: 2020 Tomaz Cananbrava <tcanabrava@kde.org> |
10 | |
11 | SPDX-License-Identifier: LGPL-2.0-or-later |
12 | */ |
13 | |
14 | #ifndef KCONFIGSOURCEGENERATOR_H |
15 | #define KCONFIGSOURCEGENERATOR_H |
16 | |
17 | #include "KConfigCodeGeneratorBase.h" |
18 | #include "KConfigCommonStructs.h" |
19 | |
20 | #include <QList> |
21 | #include <QString> |
22 | |
23 | class KConfigParameters; |
24 | class CfgEntry; |
25 | class QTextStream; |
26 | struct ParseResult; |
27 | |
28 | class KConfigSourceGenerator : public KConfigCodeGeneratorBase |
29 | { |
30 | public: |
31 | KConfigSourceGenerator(const QString &inputFile, const QString &baseDir, const KConfigParameters ¶meters, ParseResult &parseResult); |
32 | |
33 | void start() override; |
34 | |
35 | private: |
36 | // Those are fairly self contained functions. |
37 | void createHeaders(); |
38 | void createPrivateDPointerImplementation(); |
39 | void createSingletonImplementation(); |
40 | void createPreamble(); |
41 | void createDestructor(); |
42 | void createConstructorParameterList(); |
43 | void createParentConstructorCall(); |
44 | void createInitializerList(); |
45 | void createDefaultValueGetterSetter(); |
46 | void createNonModifyingSignalsHelper(); |
47 | void createSignalFlagsHandler(); |
48 | void includeMoc(); |
49 | |
50 | // Constructor related methods |
51 | // the `do` methods have related helper functions that are only related |
52 | // to it. So we can break the function into many smaller ones and create |
53 | // logic inside of the `do` function. |
54 | void doConstructor(); |
55 | void createEnums(const CfgEntry *entry); |
56 | void createNormalEntry(const CfgEntry *entry, const QString &key); |
57 | void createIndexedEntry(const CfgEntry *entry, const QString &key); |
58 | void handleCurrentGroupChange(const CfgEntry *entry); |
59 | |
60 | void doGetterSetterDPointerMode(); |
61 | void createGetterDPointerMode(const CfgEntry *entry); |
62 | void createImmutableGetterDPointerMode(const CfgEntry *entry); |
63 | void createSetterDPointerMode(const CfgEntry *entry); |
64 | void createItemGetterDPointerMode(const CfgEntry *entry); |
65 | |
66 | private: |
67 | QString mCurrentGroup; |
68 | QStringList mConfigGroupList; // keeps track of generated KConfigGroup; |
69 | }; |
70 | |
71 | #endif |
72 |