Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
generator.h
Go to the documentation of this file.
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
10
12{
13 Moc *parser = nullptr;
14 FILE *out;
15 ClassDef *cdef;
16 QList<uint> meta_data;
17
18public:
19 Generator(Moc *moc, ClassDef *classDef, const QList<QByteArray> &metaTypes,
20 const QHash<QByteArray, QByteArray> &knownQObjectClasses,
21 const QHash<QByteArray, QByteArray> &knownGadgets, FILE *outfile = nullptr,
22 bool requireCompleteTypes = false);
23 void generateCode();
24 qsizetype registeredStringsCount() { return strings.size(); };
25
26private:
27 bool registerableMetaType(const QByteArray &propertyType);
28 void registerClassInfoStrings();
29 void registerFunctionStrings(const QList<FunctionDef> &list);
30 void registerByteArrayVector(const QList<QByteArray> &list);
31 void addProperties();
32 void addEnums();
33 void addFunctions(const QList<FunctionDef> &list, const char *functype);
34 void addClassInfos();
35 void generateTypeInfo(const QByteArray &typeName, bool allowEmptyName = false);
36 void registerEnumStrings();
37 void registerPropertyStrings();
38 void generateMetacall();
39 void generateStaticMetacall();
40 void generateSignal(const FunctionDef *def, int index);
41 void generatePluginMetaData();
42 QMultiMap<QByteArray, int> automaticPropertyMetaTypesHelper();
43 QMap<int, QMultiMap<QByteArray, int>>
44 methodsWithAutomaticTypesHelper(const QList<FunctionDef> &methodList);
45
46 void strreg(const QByteArray &); // registers a string
47 int stridx(const QByteArray &); // returns a string's id
48 QList<QByteArray> strings;
49 QByteArray purestSuperClass;
50 QList<QByteArray> metaTypes;
51 QHash<QByteArray, QByteArray> knownQObjectClasses;
52 QHash<QByteArray, QByteArray> knownGadgets;
53 bool requireCompleteTypes;
54};
55
56QT_END_NAMESPACE
57
58#endif // GENERATOR_H
void nextItem(const char *comment=nullptr)
Definition cbordevice.h:22
CborDevice(FILE *out)
Definition cbordevice.h:20
qsizetype registeredStringsCount()
Definition generator.h:24
Generator(Moc *moc, ClassDef *classDef, const QList< QByteArray > &metaTypes, const QHash< QByteArray, QByteArray > &knownQObjectClasses, const QHash< QByteArray, QByteArray > &knownGadgets, FILE *outfile=nullptr, bool requireCompleteTypes=false)
Definition generator.cpp:61
void generateCode()
Definition moc.h:209
\inmodule QtCore\reentrant
Definition qjsonobject.h:20
Definition qlist.h:76
Combined button and popup list for selecting options.
static QByteArray generateQualifiedClassNameIdentifier(const QByteArray &identifier)
static CborError jsonValueToCbor(CborEncoder *parent, const QJsonValue &v)
static bool qualifiedNameEquals(const QByteArray &qualifiedName, const QByteArray &name)
uint nameToBuiltinType(const QByteArray &name)
Definition generator.cpp:29
static CborError jsonArrayToCbor(CborEncoder *parent, const QJsonArray &a)
bool isBuiltinType(const QByteArray &type)
Definition generator.cpp:41
static const char * metaTypeEnumValueString(int type)
Definition generator.cpp:49
static void printStringWithIndentation(FILE *out, const QByteArray &s)
static qsizetype lengthOfEscapeSequence(const QByteArray &s, qsizetype i)
Definition generator.cpp:77
static CborError jsonObjectToCbor(CborEncoder *parent, const QJsonObject &o)
bool hasQObject
Definition moc.h:192
bool hasQGadget
Definition moc.h:193
bool requireCompleteMethodTypes
Definition moc.h:195
bool hasQNamespace
Definition moc.h:194
Definition moc.h:43
bool wasCloned
Definition moc.h:83
bool isRawSlot
Definition moc.h:96
bool isConst
Definition moc.h:79
bool isAbstract
Definition moc.h:95
bool isPrivateSignal
Definition moc.h:92
@ Private
Definition moc.h:75
bool isStatic
Definition moc.h:81
int notifyId
Definition moc.h:115
bool constant
Definition moc.h:119
Specification gspec
Definition moc.h:117
@ ReferenceSpec
Definition moc.h:116
@ PointerSpec
Definition moc.h:116