| 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 | |
| 49 | // Constructor related methods |
| 50 | // the `do` methods have related helper functions that are only related |
| 51 | // to it. So we can break the function into many smaller ones and create |
| 52 | // logic inside of the `do` function. |
| 53 | void doConstructor(); |
| 54 | void createEnums(const CfgEntry *entry); |
| 55 | void createNormalEntry(const CfgEntry *entry, const QString &key); |
| 56 | void createIndexedEntry(const CfgEntry *entry, const QString &key); |
| 57 | void handleCurrentGroupChange(const CfgEntry *entry); |
| 58 | |
| 59 | void doGetterSetterDPointerMode(); |
| 60 | void createGetterDPointerMode(const CfgEntry *entry); |
| 61 | void createImmutableGetterDPointerMode(const CfgEntry *entry); |
| 62 | void createSetterDPointerMode(const CfgEntry *entry); |
| 63 | void createItemGetterDPointerMode(const CfgEntry *entry); |
| 64 | |
| 65 | private: |
| 66 | QString mCurrentGroup; |
| 67 | QStringList mConfigGroupList; // keeps track of generated KConfigGroup; |
| 68 | }; |
| 69 | |
| 70 | #endif |
| 71 |
