Changeset View
Changeset View
Standalone View
Standalone View
src/kconfig_compiler/KConfigSourceGenerator.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | This file is part of KDE. | ||||
3 | | ||||
4 | Copyright (C) 2020 Tomaz Cananbrava (tcanabrava@kde.org) | ||||
5 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | ||||
6 | Copyright (c) 2003 Waldo Bastian <bastian@kde.org> | ||||
7 | Copyright (c) 2003 Zack Rusin <zack@kde.org> | ||||
8 | Copyright (c) 2006 Michaël Larouche <michael.larouche@kdemail.net> | ||||
9 | Copyright (c) 2008 Allen Winter <winter@kde.org> | ||||
10 | Copyright (C) 2020 Tomaz Cananbrava (tcanabrava@kde.org) | ||||
11 | | ||||
12 | This library is free software; you can redistribute it and/or | ||||
13 | modify it under the terms of the GNU Library General Public | ||||
14 | License as published by the Free Software Foundation; either | ||||
15 | version 2 of the License, or (at your option) any later version. | ||||
16 | | ||||
17 | This library is distributed in the hope that it will be useful, | ||||
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
20 | Library General Public License for more details. | ||||
21 | | ||||
22 | You should have received a copy of the GNU Library General Public License | ||||
23 | along with this library; see the file COPYING.LIB. If not, write to | ||||
24 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
25 | Boston, MA 02110-1301, USA. | ||||
26 | */ | ||||
27 | | ||||
28 | #ifndef KCONFIGSOURCEGENERATOR_H | ||||
29 | #define KCONFIGSOURCEGENERATOR_H | ||||
30 | | ||||
31 | #include "KConfigCodeGeneratorBase.h" | ||||
32 | #include "KConfigCommonStructs.h" | ||||
33 | | ||||
34 | #include <QString> | ||||
35 | #include <QList> | ||||
36 | | ||||
37 | class KConfigXTParameters; | ||||
38 | class CfgEntry; | ||||
39 | class QTextStream; | ||||
40 | struct ParseResult; | ||||
41 | | ||||
42 | class KConfigSourceGenerator : public KConfigCodeGeneratorBase { | ||||
43 | public: | ||||
44 | KConfigSourceGenerator( | ||||
45 | const QString& inputFile, | ||||
46 | const QString& baseDir, | ||||
47 | const KConfigXTParameters ¶meters, | ||||
48 | ParseResult &parseResult); | ||||
49 | | ||||
50 | void start() override; | ||||
51 | | ||||
52 | private: | ||||
53 | // Those are fairly self contained functions. | ||||
54 | void createHeaders(); | ||||
55 | void createPrivateDPointerImplementation(); | ||||
56 | void createSingletonImplementation(); | ||||
57 | void createPreamble(); | ||||
58 | void createDestructor(); | ||||
59 | void createConstructorParameterList(); | ||||
60 | void createParentConstructorCall(); | ||||
61 | void createInitializerList(); | ||||
62 | void createDefaultValueGetterSetter(); | ||||
63 | void createNonModifyingSignalsHelper(); | ||||
64 | void createSignalFlagsHandler(); | ||||
65 | void includeMoc(); | ||||
66 | | ||||
67 | // Constructor related methods | ||||
68 | // the `do` methods have related helper functions that are only related | ||||
69 | // to it. So we can break the function into many smaller ones and create | ||||
70 | // logic inside of the `do` function. | ||||
71 | void doConstructor(); | ||||
72 | void createEnums(const CfgEntry *entry); | ||||
73 | void createNormalEntry(const CfgEntry *entry, const QString& key); | ||||
74 | void createIndexedEntry(const CfgEntry *entry, const QString& key); | ||||
75 | void handleCurrentGroupChange(const CfgEntry *entry); | ||||
76 | | ||||
77 | void doGetterSetterDPointerMode(); | ||||
78 | void createGetterDPointerMode(const CfgEntry *entry); | ||||
79 | void createSetterDPointerMode(const CfgEntry *entry); | ||||
80 | void createItemGetterDPointerMode(const CfgEntry *entry); | ||||
81 | | ||||
82 | private: | ||||
83 | QString mCurrentGroup; | ||||
84 | }; | ||||
85 | | ||||
86 | #endif |