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 ()
QByteArrayView strippedFileName () const
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, ClassDef *containingClass)
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 ()
QByteArrayView lexemView ()
QByteArrayView unquotedLexemView ()
const Symbolsymbol ()
const SymbolsymbolAt (qsizetype idx)
Q_NORETURN void error (const Symbol &symbol)
Q_NORETURN void error (const char *msg=nullptr)
Q_NORETURN void error (const Symbol &symbol, const char *msg)
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
bool qmlMacroWarningIsFatal = 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 222 of file moc.h.

Member Enumeration Documentation

◆ EncounteredQmlMacro

enum class Moc::EncounteredQmlMacro
strong
Enumerator
Yes 
No 

Definition at line 281 of file moc.h.

◆ PropertyMode

Enumerator
Named 
Anonymous 

Definition at line 225 of file moc.h.

Constructor & Destructor Documentation

◆ Moc()

Moc::Moc ( )
inline

Definition at line 227 of file moc.h.

References mustIncludeQPluginH, noInclude, and requireCompleteTypes.

Member Function Documentation

◆ checkListSizes()

void Moc::checkListSizes ( const ClassDef & def)

Definition at line 641 of file moc.cpp.

Referenced by parse().

Here is the caller graph for this function:

◆ checkProperties()

void Moc::checkProperties ( ClassDef * cdef)

Definition at line 1977 of file moc.cpp.

Referenced by parse().

Here is the caller graph for this function:

◆ checkSuperClasses()

void Moc::checkSuperClasses ( ClassDef * def)

Definition at line 1919 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 1370 of file moc.cpp.

References PropertyDef::lineNumber, 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 1190 of file moc.cpp.

References mocOutputRevision, 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 252 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 256 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 1819 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 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 1690 of file moc.cpp.

References No, and Yes.

◆ parseClassInfo() [2/2]

void Moc::parseClassInfo ( ClassDef * def)

Definition at line 1717 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 1756 of file moc.cpp.

Referenced by parse().

Here is the caller graph for this function:

◆ parseDeclareMetatype()

void Moc::parseDeclareMetatype ( )

Definition at line 1779 of file moc.cpp.

Referenced by parse().

Here is the caller graph for this function:

◆ parseEnum()

bool Moc::parseEnum ( EnumDef * def,
ClassDef * containingClass )

Definition at line 246 of file moc.cpp.

References IncludeBegin, IncludeEnd, EnumDef::lineNumber, 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 1651 of file moc.cpp.

Referenced by parse().

Here is the caller graph for this function:

◆ parseFlag()

void Moc::parseFlag ( BaseDef * def)

Definition at line 1666 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 430 of file moc.cpp.

References FunctionDef::inlineCode, FunctionDef::isAbstract, FunctionDef::isConst, FunctionDef::isStatic, FunctionDef::isVirtual, FunctionDef::lineNumber, parseFunctionArguments(), 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 306 of file moc.cpp.

References ArgumentDef::isDefault, FunctionDef::isPrivateSignal, FunctionDef::isRawSlot, 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 1723 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 542 of file moc.cpp.

References FunctionDef::isConst, FunctionDef::isConstructor, FunctionDef::isDestructor, FunctionDef::isInvokable, FunctionDef::isSignal, FunctionDef::isSlot, FunctionDef::isStatic, FunctionDef::isVirtual, FunctionDef::lineNumber, parseFunctionArguments(), 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 1788 of file moc.cpp.

Referenced by parse().

Here is the caller graph for this function:

◆ parsePluginData()

void Moc::parsePluginData ( ClassDef * def)

Definition at line 1556 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 1638 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 1546 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 1620 of file moc.cpp.

◆ parsePropertyAttributes()

void Moc::parsePropertyAttributes ( PropertyDef & propDef)

Definition at line 1409 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 387 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 1326 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 1798 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 1284 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 HasClass, HasEnum, HasStruct, and skipCxxAttributes().

Here is the call graph for this function:

◆ prependNamespaces()

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

Definition at line 631 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 378 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:

◆ strippedFileName()

QByteArrayView Moc::strippedFileName ( ) const

Definition at line 1113 of file moc.cpp.

◆ testForFunctionModifiers()

bool Moc::testForFunctionModifiers ( FunctionDef * def)

Definition at line 534 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 346 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 418 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 1839 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 238 of file moc.h.

◆ filename

QByteArray Moc::filename

Definition at line 231 of file moc.h.

◆ includeFiles

QList<QByteArray> Moc::includeFiles

Definition at line 237 of file moc.h.

◆ includePath

QByteArray Moc::includePath

Definition at line 236 of file moc.h.

◆ interface2IdMap

QMap<QByteArray, QByteArray> Moc::interface2IdMap

Definition at line 239 of file moc.h.

◆ knownGadgets

QHash<QByteArray, QByteArray> Moc::knownGadgets

Definition at line 243 of file moc.h.

◆ knownQObjectClasses

QHash<QByteArray, QByteArray> Moc::knownQObjectClasses

Definition at line 242 of file moc.h.

◆ metaArgs

QMap<QString, QJsonArray> Moc::metaArgs

Definition at line 244 of file moc.h.

◆ metaTypes

QList<QByteArray> Moc::metaTypes

Definition at line 240 of file moc.h.

◆ mustIncludeQPluginH

bool Moc::mustIncludeQPluginH

Definition at line 234 of file moc.h.

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

◆ noInclude

bool Moc::noInclude

Definition at line 233 of file moc.h.

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

◆ parsedPluginMetadataFiles

QList<QString> Moc::parsedPluginMetadataFiles

Definition at line 245 of file moc.h.

◆ requireCompleteTypes

bool Moc::requireCompleteTypes

Definition at line 235 of file moc.h.

Referenced by Moc(), and runMoc().


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