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
Moc Class Reference

#include <moc.h>

+ Inheritance diagram for Moc:
+ Collaboration diagram for Moc:

Public Types

enum  PropertyMode { Named , Anonymous }
 
enum class  EncounteredQmlMacro { Yes , No }
 

Public Member Functions

 Moc ()
 
void parse ()
 
void generate (FILE *out, FILE *jsonOutput)
 
bool parseClassHead (ClassDef *def)
 
bool inClass (const ClassDef *def) const
 
bool inNamespace (const NamespaceDef *def) const
 
const QByteArraytoFullyQualified (const QByteArray &name) const noexcept
 
void prependNamespaces (BaseDef &def, const QList< NamespaceDef > &namespaceList) const
 
Type parseType ()
 
bool parseEnum (EnumDef *def)
 
bool parseFunction (FunctionDef *def, bool inMacro=false)
 
bool parseMaybeFunction (const ClassDef *cdef, FunctionDef *def)
 
void parseSlots (ClassDef *def, FunctionDef::Access access)
 
void parseSignals (ClassDef *def)
 
void parseProperty (ClassDef *def, PropertyMode mode)
 
void parsePluginData (ClassDef *def)
 
void createPropertyDef (PropertyDef &def, int propertyIndex, PropertyMode mode)
 
void parsePropertyAttributes (PropertyDef &propDef)
 
void parseEnumOrFlag (BaseDef *def, QtMocConstants::EnumFlags flags)
 
void parseFlag (BaseDef *def)
 
EncounteredQmlMacro parseClassInfo (BaseDef *def)
 
void parseClassInfo (ClassDef *def)
 
void parseInterfaces (ClassDef *def)
 
void parseDeclareInterface ()
 
void parseDeclareMetatype ()
 
void parseMocInclude ()
 
void parseSlotInPrivate (ClassDef *def, FunctionDef::Access access)
 
QByteArray parsePropertyAccessor ()
 
void parsePrivateProperty (ClassDef *def, PropertyMode mode)
 
void parseFunctionArguments (FunctionDef *def)
 
QByteArray lexemUntil (Token)
 
bool until (Token)
 
bool testFunctionAttribute (FunctionDef *def)
 
bool testFunctionAttribute (Token tok, FunctionDef *def)
 
bool testFunctionRevision (FunctionDef *def)
 
QTypeRevision parseRevision ()
 
bool skipCxxAttributes ()
 
void checkSuperClasses (ClassDef *def)
 
void checkProperties (ClassDef *cdef)
 
bool testForFunctionModifiers (FunctionDef *def)
 
void checkListSizes (const ClassDef &def)
 
- Public Member Functions inherited from Parser
bool hasNext () const
 
Token next ()
 
Token peek ()
 
bool test (Token)
 
void next (Token)
 
void next (Token, const char *msg)
 
void prev ()
 
Token lookup (int k=1)
 
const Symbolsymbol_lookup (int k=1)
 
Token token ()
 
QByteArray lexem ()
 
QByteArray unquotedLexem ()
 
const Symbolsymbol ()
 
const SymbolsymbolAt (qsizetype idx)
 
Q_NORETURN void error (const Symbol &symbol)
 
Q_NORETURN void error (const char *msg=nullptr)
 
void warning (const char *=nullptr)
 
void warning (const Symbol &sym, QByteArrayView msg)
 
void note (const char *=nullptr)
 
void defaultErrorMsg (const Symbol &sym)
 
void printMsg (QByteArrayView formatStringSuffix, QByteArrayView msg, const Symbol &sym)
 
 Parser (const QString &provider)
 
void addIncludeDirs (const QStringList &list)
 
QString resolveInclude (const QString &filename)
 
void addIncludesRecursive (const QString &filename, QStringList &includes)
 
QStringList findEnumValues (const QString &name, const QStringList &includes)
 
void parseParamReplace (const QString &data, qsizetype offset, const QString &name)
 
void parseInstrument (const QString &data, qsizetype offset)
 
void parsePoint (const QString &data, qsizetype offset)
 
void parsePrefix (const QString &data, qsizetype offset)
 
void parseMetadata (const QString &data, qsizetype offset, const QStringList &includes)
 
int lineNumber (qsizetype offset) const
 
void parse (QIODevice &input, const QString &name)
 
void write (QIODevice &input) const
 
bool isEmpty () const
 

Public Attributes

QByteArray filename
 
bool noInclude
 
bool mustIncludeQPluginH
 
bool requireCompleteTypes
 
QByteArray includePath
 
QList< QByteArrayincludeFiles
 
QList< ClassDefclassList
 
QMap< QByteArray, QByteArrayinterface2IdMap
 
QList< QByteArraymetaTypes
 
QHash< QByteArray, QByteArrayknownQObjectClasses
 
QHash< QByteArray, QByteArrayknownGadgets
 
QMap< QString, QJsonArraymetaArgs
 
QList< QStringparsedPluginMetadataFiles
 
- Public Attributes inherited from Parser
Symbols symbols
 
qsizetype index = 0
 
bool displayWarnings = true
 
bool displayNotes = true
 
bool activeQtMode = false
 
QList< IncludePathincludes
 
std::stack< QByteArray, QByteArrayListcurrentFilenames
 
QList< Functionm_functions
 
QList< Pointm_points
 
QList< Replacem_replaces
 
QList< QStringm_prefixes
 
QList< QStringm_metadata
 
QList< LineNumberm_offsets
 
QList< QStringm_includeDirs
 
QString m_provider
 

Detailed Description

Definition at line 208 of file moc.h.

Member Enumeration Documentation

◆ EncounteredQmlMacro

enum class Moc::EncounteredQmlMacro
strong
Enumerator
Yes 
No 

Definition at line 266 of file moc.h.

◆ PropertyMode

Enumerator
Named 
Anonymous 

Definition at line 211 of file moc.h.

Constructor & Destructor Documentation

◆ Moc()

Moc::Moc ( )
inline

Definition at line 213 of file moc.h.

References mustIncludeQPluginH, noInclude, and requireCompleteTypes.

Member Function Documentation

◆ checkListSizes()

void Moc::checkListSizes ( const ClassDef & def)

Definition at line 628 of file moc.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ checkProperties()

void Moc::checkProperties ( ClassDef * cdef)

Definition at line 1928 of file moc.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ checkSuperClasses()

void Moc::checkSuperClasses ( ClassDef * def)

Definition at line 1870 of file moc.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ createPropertyDef()

void Moc::createPropertyDef ( PropertyDef & def,
int propertyIndex,
Moc::PropertyMode mode )

Definition at line 1324 of file moc.cpp.

References Named, parsePropertyAttributes(), and PropertyDef::relativeIndex.

Referenced by parsePrivateProperty(), and parseProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generate()

void Moc::generate ( FILE * out,
FILE * jsonOutput )

Definition at line 1139 of file moc.cpp.

References mustIncludeQPluginH, and noInclude.

Referenced by runMoc().

+ Here is the caller graph for this function:

◆ inClass()

bool Moc::inClass ( const ClassDef * def) const
inline

Definition at line 237 of file moc.h.

Referenced by parse(), parseSignals(), and parseSlots().

+ Here is the caller graph for this function:

◆ inNamespace()

bool Moc::inNamespace ( const NamespaceDef * def) const
inline

Definition at line 241 of file moc.h.

Referenced by parse(), and prependNamespaces().

+ Here is the caller graph for this function:

◆ lexemUntil()

QByteArray Moc::lexemUntil ( Token target)

Definition at line 1770 of file moc.cpp.

References is_ident_char(), and until().

+ Here is the call graph for this function:

◆ parse()

◆ parseClassHead()

bool Moc::parseClassHead ( ClassDef * def)

Definition at line 39 of file moc.cpp.

References parseType(), FunctionDef::Private, FunctionDef::Protected, FunctionDef::Public, skipCxxAttributes(), and until().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseClassInfo() [1/2]

Moc::EncounteredQmlMacro Moc::parseClassInfo ( BaseDef * def)

Definition at line 1641 of file moc.cpp.

References No, and Yes.

◆ parseClassInfo() [2/2]

void Moc::parseClassInfo ( ClassDef * def)

Definition at line 1668 of file moc.cpp.

References ClassDef::requireCompleteMethodTypes.

Referenced by parse().

+ Here is the caller graph for this function:

◆ parseDeclareInterface()

void Moc::parseDeclareInterface ( )

Definition at line 1707 of file moc.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ parseDeclareMetatype()

void Moc::parseDeclareMetatype ( )

Definition at line 1730 of file moc.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ parseEnum()

bool Moc::parseEnum ( EnumDef * def)

Definition at line 241 of file moc.cpp.

References IncludeBegin, IncludeEnd, NoInclude, skipCxxAttributes(), and until().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseEnumOrFlag()

void Moc::parseEnumOrFlag ( BaseDef * def,
QtMocConstants::EnumFlags flags )

Definition at line 1602 of file moc.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ parseFlag()

void Moc::parseFlag ( BaseDef * def)

Definition at line 1617 of file moc.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ parseFunction()

bool Moc::parseFunction ( FunctionDef * def,
bool inMacro = false )

Definition at line 421 of file moc.cpp.

References FunctionDef::inlineCode, FunctionDef::isAbstract, FunctionDef::isConst, Type::isScoped, FunctionDef::isStatic, FunctionDef::isVirtual, parseFunctionArguments(), parseType(), Type::Reference, skipCxxAttributes(), testForFunctionModifiers(), testFunctionAttribute(), testFunctionRevision(), and until().

Referenced by parseSignals(), parseSlotInPrivate(), and parseSlots().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseFunctionArguments()

void Moc::parseFunctionArguments ( FunctionDef * def)

Definition at line 296 of file moc.cpp.

References ArgumentDef::isDefault, FunctionDef::isPrivateSignal, FunctionDef::isRawSlot, parseType(), and until().

Referenced by parseFunction(), and parseMaybeFunction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseInterfaces()

void Moc::parseInterfaces ( ClassDef * def)

Definition at line 1674 of file moc.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ parseMaybeFunction()

bool Moc::parseMaybeFunction ( const ClassDef * cdef,
FunctionDef * def )

Definition at line 531 of file moc.cpp.

References Type::Type(), FunctionDef::isConst, FunctionDef::isConstructor, FunctionDef::isDestructor, FunctionDef::isInvokable, Type::isScoped, FunctionDef::isSignal, FunctionDef::isSlot, FunctionDef::isStatic, FunctionDef::isVirtual, parseFunctionArguments(), parseType(), Type::Reference, skipCxxAttributes(), testForFunctionModifiers(), testFunctionAttribute(), and testFunctionRevision().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseMocInclude()

void Moc::parseMocInclude ( )

Definition at line 1739 of file moc.cpp.

Referenced by parse().

+ Here is the caller graph for this function:

◆ parsePluginData()

void Moc::parsePluginData ( ClassDef * def)

Definition at line 1507 of file moc.cpp.

References mustIncludeQPluginH.

Referenced by parse().

+ Here is the caller graph for this function:

◆ parsePrivateProperty()

void Moc::parsePrivateProperty ( ClassDef * def,
Moc::PropertyMode mode )

Definition at line 1589 of file moc.cpp.

References createPropertyDef().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseProperty()

void Moc::parseProperty ( ClassDef * def,
Moc::PropertyMode mode )

Definition at line 1497 of file moc.cpp.

References createPropertyDef().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parsePropertyAccessor()

QByteArray Moc::parsePropertyAccessor ( )

Definition at line 1571 of file moc.cpp.

◆ parsePropertyAttributes()

void Moc::parsePropertyAttributes ( PropertyDef & propDef)

Definition at line 1360 of file moc.cpp.

References PropertyDef::constant, PropertyDef::final, parseRevision(), PropertyDef::required, and PropertyDef::revision.

Referenced by createPropertyDef().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseRevision()

QTypeRevision Moc::parseRevision ( )

Definition at line 378 of file moc.cpp.

References QTypeRevision::QTypeRevision().

Referenced by parsePropertyAttributes(), parseSignals(), parseSlots(), and testFunctionRevision().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseSignals()

void Moc::parseSignals ( ClassDef * def)

Definition at line 1280 of file moc.cpp.

References FunctionDef::access, inClass(), FunctionDef::isVirtual, parseFunction(), parseRevision(), FunctionDef::Public, FunctionDef::revision, ClassDef::revisionedMethods, and until().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseSlotInPrivate()

void Moc::parseSlotInPrivate ( ClassDef * def,
FunctionDef::Access access )

Definition at line 1749 of file moc.cpp.

References FunctionDef::access, parseFunction(), FunctionDef::revision, and ClassDef::revisionedMethods.

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseSlots()

void Moc::parseSlots ( ClassDef * def,
FunctionDef::Access access )

Definition at line 1238 of file moc.cpp.

References FunctionDef::access, inClass(), parseFunction(), parseRevision(), FunctionDef::revision, ClassDef::revisionedMethods, and until().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseType()

Type Moc::parseType ( )

Definition at line 126 of file moc.cpp.

References Type::firstToken, Type::isScoped, Type::isVolatile, Type::NoReference, Type::Pointer, Type::Reference, Type::referenceType, Type::RValueReference, and skipCxxAttributes().

Referenced by parseClassHead(), parseFunction(), parseFunctionArguments(), and parseMaybeFunction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prependNamespaces()

void Moc::prependNamespaces ( BaseDef & def,
const QList< NamespaceDef > & namespaceList ) const

Definition at line 618 of file moc.cpp.

References inNamespace().

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ skipCxxAttributes()

bool Moc::skipCxxAttributes ( )

Definition at line 369 of file moc.cpp.

References until().

Referenced by parseClassHead(), parseEnum(), parseFunction(), parseMaybeFunction(), and parseType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testForFunctionModifiers()

bool Moc::testForFunctionModifiers ( FunctionDef * def)

Definition at line 523 of file moc.cpp.

References FunctionDef::isStatic, and FunctionDef::isVirtual.

Referenced by parseFunction(), and parseMaybeFunction().

+ Here is the caller graph for this function:

◆ testFunctionAttribute() [1/2]

bool Moc::testFunctionAttribute ( FunctionDef * def)

Definition at line 337 of file moc.cpp.

Referenced by parseFunction(), and parseMaybeFunction().

+ Here is the caller graph for this function:

◆ testFunctionAttribute() [2/2]

bool Moc::testFunctionAttribute ( Token tok,
FunctionDef * def )

◆ testFunctionRevision()

bool Moc::testFunctionRevision ( FunctionDef * def)

Definition at line 409 of file moc.cpp.

References parseRevision(), and FunctionDef::revision.

Referenced by parseFunction(), and parseMaybeFunction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toFullyQualified()

const QByteArray & Moc::toFullyQualified ( const QByteArray & name) const
noexcept

Definition at line 30 of file moc.cpp.

◆ until()

bool Moc::until ( Token target)

Definition at line 1790 of file moc.cpp.

Referenced by lexemUntil(), parse(), parseClassHead(), parseEnum(), parseFunction(), parseFunctionArguments(), parseSignals(), parseSlots(), and skipCxxAttributes().

+ Here is the caller graph for this function:

Member Data Documentation

◆ classList

QList<ClassDef> Moc::classList

Definition at line 224 of file moc.h.

◆ filename

QByteArray Moc::filename

Definition at line 217 of file moc.h.

◆ includeFiles

QList<QByteArray> Moc::includeFiles

Definition at line 223 of file moc.h.

◆ includePath

QByteArray Moc::includePath

Definition at line 222 of file moc.h.

◆ interface2IdMap

QMap<QByteArray, QByteArray> Moc::interface2IdMap

Definition at line 225 of file moc.h.

◆ knownGadgets

QHash<QByteArray, QByteArray> Moc::knownGadgets

Definition at line 229 of file moc.h.

◆ knownQObjectClasses

QHash<QByteArray, QByteArray> Moc::knownQObjectClasses

Definition at line 228 of file moc.h.

◆ metaArgs

QMap<QString, QJsonArray> Moc::metaArgs

Definition at line 230 of file moc.h.

◆ metaTypes

QList<QByteArray> Moc::metaTypes

Definition at line 226 of file moc.h.

◆ mustIncludeQPluginH

bool Moc::mustIncludeQPluginH

Definition at line 220 of file moc.h.

Referenced by Moc(), generate(), and parsePluginData().

◆ noInclude

bool Moc::noInclude

Definition at line 219 of file moc.h.

Referenced by Moc(), generate(), and runMoc().

◆ parsedPluginMetadataFiles

QList<QString> Moc::parsedPluginMetadataFiles

Definition at line 231 of file moc.h.

◆ requireCompleteTypes

bool Moc::requireCompleteTypes

Definition at line 221 of file moc.h.

Referenced by Moc(), and runMoc().


The documentation for this class was generated from the following files: