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 GENERATOR_H
5#define GENERATOR_H
6
7#include "moc.h"
8
9// -- QtScxml
10#include <QtCore/qhash.h>
11#include <QtCore/qlist.h>
12#include <QtCore/qiodevice.h>
13// -- QtScxml
14
15QT_BEGIN_NAMESPACE
16
17class Generator
18{
19 QIODevice &out; // -- QtScxml
20 ClassDef *cdef;
21 QList<uint> meta_data;
22
23public:
24 Generator(ClassDef *classDef, const QList<QByteArray> &metaTypes,
25 const QHash<QByteArray, QByteArray> &knownQObjectClasses,
26 const QHash<QByteArray, QByteArray> &knownGadgets,
27 QIODevice &outfile, // -- QtScxml
28 bool requireCompleteTypes = false);
29 void generateCode();
30
31// -- QtScxml
32 void generateAccessorDefs();
33 void generateSignalDefs();
34// -- QtScxml
35
36private:
37 bool registerableMetaType(const QByteArray &propertyType);
38 void registerClassInfoStrings();
39 void generateClassInfos();
40 void registerFunctionStrings(const QList<FunctionDef> &list);
41 void registerByteArrayVector(const QList<QByteArray> &list);
42 void generateFunctions(const QList<FunctionDef> &list, const char *functype, int type,
43 int &paramsIndex, int &initialMetatypeOffset);
44 void generateFunctionRevisions(const QList<FunctionDef> &list, const char *functype);
45 void generateFunctionParameters(const QList<FunctionDef> &list, const char *functype);
46 void generateTypeInfo(const QByteArray &typeName, bool allowEmptyName = false);
47 void registerEnumStrings();
48 void generateEnums(int index);
49 void registerPropertyStrings();
50 void generateProperties();
51 void generateMetacall();
52 void generateStaticMetacall();
53 void generateSignal(FunctionDef *def, int index);
54 void generateQPropertyApi();
55#if 0 // -- QtScxml
56 void generatePluginMetaData();
57#endif // -- QtScxml
58 QMultiMap<QByteArray, int> automaticPropertyMetaTypesHelper();
59 QMap<int, QMultiMap<QByteArray, int>>
60 methodsWithAutomaticTypesHelper(const QList<FunctionDef> &methodList);
61
62 void strreg(const QByteArray &); // registers a string
63 int stridx(const QByteArray &); // returns a string's id
64 QList<QByteArray> strings;
65 QByteArray purestSuperClass;
66 QList<QByteArray> metaTypes;
67 QHash<QByteArray, QByteArray> knownQObjectClasses;
68 QHash<QByteArray, QByteArray> knownGadgets;
69 bool requireCompleteTypes;
70};
71
72QT_END_NAMESPACE
73
74#endif // GENERATOR_H
75

source code of qtscxml/tools/qscxmlc/generator.h