8#include <QtCore/qcompare.h>
9#include <QtCore/qjsonparseerror.h>
10#if (QT_VERSION >= QT_VERSION_CHECK(7
, 0
, 0
)) || defined(QT_BOOTSTRAPPED)
11#include <QtCore/qjsonvalue.h>
13#include <QtCore/qlatin1stringview.h>
14#include <QtCore/qscopedpointer.h>
15#include <QtCore/qstringview.h>
32 static const uint BinaryFormatTag = (
'q') | (
'b' << 8) | (
'j' << 16) | (
's' << 24);
34 static const uint BinaryFormatTag = (
'q' << 24) | (
'b' << 16) | (
'j' << 8) | (
's');
38 explicit QJsonDocument(
const QJsonObject &object);
39 explicit QJsonDocument(QJsonObject &&object);
40 explicit QJsonDocument(
const QJsonArray &array);
41 explicit QJsonDocument(QJsonArray &&array);
44 QJsonDocument(
const QJsonDocument &other);
45 QJsonDocument &operator =(
const QJsonDocument &other);
47 QT_CORE_INLINE_SINCE(6, 12)
48 QJsonDocument(QJsonDocument &&other)
noexcept;
49 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QJsonDocument)
51 QT_CORE_INLINE_SINCE(6, 12)
52 void swap(QJsonDocument &other)
noexcept;
54 static QJsonDocument fromVariant(
const QVariant &variant);
55 QVariant toVariant()
const;
57#if (QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)) && !defined(QT_BOOTSTRAPPED)
63 using JsonFormat = QJsonValue::JsonFormat;
64# ifdef __cpp_using_enum
65 using enum QJsonValue::JsonFormat;
68 static constexpr auto Indented = JsonFormat::Indented;
69 static constexpr auto Compact = JsonFormat::Compact;
73 static QJsonDocument fromJson(
const QByteArray &json, QJsonParseError *error =
nullptr);
75 QByteArray toJson(JsonFormat format = JsonFormat::Indented)
const;
79 bool isObject()
const;
81 QJsonObject object()
const;
82 QJsonArray array()
const;
84 void setObject(
const QJsonObject &object);
85 void setArray(
const QJsonArray &array);
87 const QJsonValue operator[](
const QString &key)
const;
88 const QJsonValue operator[](QStringView key)
const;
89 const QJsonValue operator[](QLatin1StringView key)
const;
90 const QJsonValue operator[](qsizetype i)
const;
91#if QT_CORE_REMOVED_SINCE(6
, 8
)
92 bool operator==(
const QJsonDocument &other)
const;
93 bool operator!=(
const QJsonDocument &other)
const {
return !operator==(other); }
98 friend class QJsonValue;
99 friend class QJsonPrivate::Parser;
100 friend Q_CORE_EXPORT QDebug operator<<(QDebug,
const QJsonDocument &);
101 friend Q_CORE_EXPORT
bool comparesEqual(
const QJsonDocument &lhs,
102 const QJsonDocument &rhs)
noexcept;
103 Q_DECLARE_EQUALITY_COMPARABLE(QJsonDocument)
105 inline explicit QJsonDocument(QCborValue data);
107 QJsonDocumentPrivate *d =
nullptr;
112#if QT_CORE_INLINE_IMPL_SINCE(6
, 12
)
113QJsonDocument::QJsonDocument(QJsonDocument &&other)
noexcept
114 : d(std::exchange(other.d,
nullptr))
118void QJsonDocument::swap(QJsonDocument &other)
noexcept
120 qt_ptr_swap(d, other.d);
124#if !defined(QT_NO_DEBUG_STREAM)
125Q_CORE_EXPORT
QDebug operator<<(QDebug,
const QJsonDocument &);
128#ifndef QT_NO_DATASTREAM
129Q_CORE_EXPORT
QDataStream &operator<<(QDataStream &,
const QJsonDocument &);
130Q_CORE_EXPORT
QDataStream &operator>>(QDataStream &, QJsonDocument &);
bool testFunctionAttribute(Token tok, FunctionDef *def)
void parseEnumOrFlag(BaseDef *def, QtMocConstants::EnumFlags flags)
bool hasGlobalModuleFragment
void checkSuperClasses(ClassDef *def)
bool inPrivateModuleFragment
bool parseEnum(EnumDef *def, ClassDef *containingClass)
void parseProperty(ClassDef *def, PropertyMode mode)
QByteArray lexemUntil(Token)
EncounteredQmlMacro parseClassInfo(BaseDef *def)
QList< QByteArray > includeFiles
QList< QByteArray > moduleFragmentIncludes
bool requireCompleteTypes
QHash< QByteArray, QByteArray > knownQObjectClasses
void createPropertyDef(PropertyDef &def, int propertyIndex, PropertyMode mode)
void parseClassInfo(ClassDef *def)
QByteArrayView strippedFileName() const
bool parseClassHead(ClassDef *def)
void parsePrivateProperty(ClassDef *def, PropertyMode mode)
void parseFlag(BaseDef *def)
void parsePrivateModuleFragment(qsizetype rewind)
void parseSignals(ClassDef *def)
void parseDeclareMetatype()
void parsePropertyAttributes(PropertyDef &propDef)
void parseInterfaces(ClassDef *def)
bool testFunctionRevision(FunctionDef *def)
bool testFunctionAttribute(FunctionDef *def)
void prependNamespaces(BaseDef &def, const QList< NamespaceDef > &namespaceList) const
QHash< QByteArray, QByteArray > knownGadgets
QList< QByteArray > metaTypes
bool parseFunction(FunctionDef *def, bool inMacro=false)
QByteArray parsePropertyAccessor()
QMap< QString, QJsonArray > metaArgs
bool testForFunctionModifiers(FunctionDef *def)
const QByteArray & toFullyQualified(const QByteArray &name) const noexcept
void parseSlots(ClassDef *def, FunctionDef::Access access)
void parseDeclareInterface()
void checkListSizes(const ClassDef &def)
QTypeRevision parseRevision()
QList< QString > parsedPluginMetadataFiles
qsizetype firstSourceSymbolIndex
ModuleUnitKind moduleUnitKind
bool parseMaybeFunction(const ClassDef *cdef, FunctionDef *def)
void checkProperties(ClassDef *cdef)
void parseModuleDeclaration(qsizetype rewind, bool exported)
void parseFunctionArguments(FunctionDef *def)
void parseSlotInPrivate(ClassDef *def, FunctionDef::Access access)
bool inClass(const ClassDef *def) const
void parsePluginData(ClassDef *def)
QByteArray modulePartitionName
void generate(FILE *out, FILE *jsonOutput)
QMap< QByteArray, QByteArray > interface2IdMap
bool inNamespace(const NamespaceDef *def) const
QList< ClassDef > classList
QByteArray resolveIncludeNext(const QByteArray &filename, qsizetype startIndex, qsizetype *foundIndex=nullptr)
void setDebugIncludes(bool value)
void parseDefineArguments(Macro *m)
Symbols preprocessed(const QByteArray &filename, QFile *device)
void substituteUntilNewline(Symbols &substituted)
QList< QByteArray > frameworks
QHash< QByteArray, IncludeResolution > nonlocalIncludePathResolutionCache
static bool preprocessOnly
QByteArray resolveInclude(const QByteArray &filename, const QByteArray &relativeTo, qsizetype *foundIndex=nullptr)
static Symbols macroExpandIdentifier(Preprocessor *that, SymbolStack &symbols, int lineNum, QByteArray *macroName)
static Symbols tokenize(const QByteArray &input, int lineNum=1, TokenizeMode mode=TokenizeCpp)
static void macroExpand(Symbols *into, Preprocessor *that, const Symbols &toExpand, qsizetype &index, int lineNum, bool one, const QSet< QByteArray > &excludeSymbols=QSet< QByteArray >())
@ PreparePreprocessorStatement
@ TokenizePreprocessorStatement
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
The QCommandLineParser class provides a means for handling the command line options.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
std::map< Key, T > toStdMap() const &
friend size_t qHash(const M &key, size_t seed=0) noexcept(QHashPrivate::noexceptPairHash< typename M::key_type, typename M::mapped_type >())
QMap(std::map< Key, T > &&other)
std::map< Key, T > toStdMap() &&
QMap(const std::map< Key, T > &other)
friend bool comparesEqual(const QMap &lhs, const QMap &rhs)
QMap(std::initializer_list< std::pair< Key, T > > list)
void swap(QMap< Key, T > &other) noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
QByteArray unquotedLexem()
const Symbol & symbol() const
bool dontReplaceSymbol(const QByteArray &name) const
const SafeSymbols & constTop() const
Q_DECLARE_TYPEINFO(EnumDef, Q_RELOCATABLE_TYPE)
QByteArray noRef(const QByteArray &type)
Q_DECLARE_TYPEINFO(PropertyDef, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(NamespaceDef, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(ClassDef, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(ClassInfoDef, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(ClassDef::Interface, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(SuperClass, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(ArgumentDef, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(PrivateQPropertyDef, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(FunctionDef, Q_RELOCATABLE_TYPE)
std::conditional_t< std::is_same_v< HashKey, q20::remove_cvref_t< KeyArgument > >, KeyArgument, HashKey > HeterogenousConstructProxy
Combined button and popup list for selecting options.
QString && asString(QString &&s)
constexpr QAnyStringArg qStringLikeToArg(QAnyStringView s) noexcept
const QString & asString(const QString &s)
std::is_same< Char, char32_t > IsCompatibleChar32TypeHelper
constexpr bool isLatin1(QLatin1StringView s) noexcept
QHash< MacroName, Macro > Macros
Q_DECLARE_TYPEINFO(QDateTime::Data, Q_RELOCATABLE_TYPE)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
qsizetype erase_if(QMultiHash< Key, T > &hash, Predicate pred)
#define QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_CREF(Class)
#define QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH(Class, Arguments)
#define QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH_BY_VALUE(Class)
#define QT_MK_QHASH_COMPAT(X)
QMultiMap< Key, T > operator+=(QMultiMap< Key, T > &lhs, const QMultiMap< Key, T > &rhs)
QSet(InputIterator, InputIterator) -> QSet< ValueType >
size_t qHash(const QSet< T > &key, size_t seed=0) noexcept(noexcept(qHashRangeCommutative(key.begin(), key.end(), seed)))
qsizetype erase_if(QSet< T > &set, Predicate pred)
QString operator+(const QString &s1, QChar s2)
QString operator+(QString &&lhs, const QString &rhs)
qsizetype erase_if(QString &s, Predicate pred)
#define QT_UNICODE_LITERAL(str)
#define qPrintable(string)
QString operator+(QString &&lhs, QChar rhs)
QString operator+(QChar s1, const QString &s2)
#define QStringLiteral(str)
QString operator+(const QString &s1, const QString &s2)
qsizetype erase(QString &s, const T &t)
static QByteArray combinePath(const QString &infile, const QString &outfile)
static bool hasNext(const Symbols &symbols, int i)
static const Symbol & next(const Symbols &symbols, int &i)
int runMoc(int argc, char **argv)
static auto openFileForWriting(const QString &name)
void error(const char *msg="Invalid argument")
static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments, bool &hasOptionFiles)
QByteArray composePreprocessorOutput(const Symbols &symbols)
int main(int argc, char *argv[])
[ctor_close]
QByteArray normalizedType
QJsonObject toJson() const
QMap< QByteArray, QByteArray > flagAliases
QList< ClassInfoDef > classInfoList
QList< EnumDef > enumList
Interface(const QByteArray &_className)
QMap< QString, QJsonArray > metaArgs
QList< QList< Interface > > interfaceList
QList< FunctionDef > publicList
QList< FunctionDef > methodList
QList< PropertyDef > propertyList
QList< FunctionDef > constructorList
QList< SuperClass > superclassList
bool requireCompleteMethodTypes
QList< FunctionDef > slotList
QList< FunctionDef > signalList
QJsonObject toJson() const
QList< QByteArray > nonClassSignalList
QFlags< QtMocConstants::EnumFlags > flags
QByteArray qualifiedType(const ClassDef *cdef) const
QJsonObject toJson(const ClassDef &cdef) const
QList< QByteArray > values
QByteArray normalizedType
QJsonObject toJson(int index) const
static void accessToJson(QJsonObject *obj, Access acs)
QByteArray inPrivateClass
QList< ArgumentDef > arguments
bool returnTypeIsVolatile
Simple structure used by the Doc and DocParser classes.
QByteArray inPrivateClass
QJsonObject toJson() const
constexpr QAnyStringArg(QAnyStringView v) noexcept
constexpr QLatin1StringArg(QLatin1StringView v) noexcept
QLatin1StringArg()=default
constexpr QStringViewArg(QStringView v) noexcept
bool operator==(const SubArray &other) const
SubArray(const QByteArray &a)
SubArray(const QByteArray &a, qsizetype from, qsizetype len)
FunctionDef::Access access
QByteArrayView unquotedLexemView() const
Symbol(int lineNum, Token token)
operator SubArray() const
QByteArrayView lexemView() const
void mergeStringLiteral(const Symbol &next)
bool operator==(const Symbol &o) const
Symbol(int lineNum, Token token, const QByteArray &lexem, qsizetype from, qsizetype len)
QByteArray unquotedLexem() const
Symbol(int lineNum, Token token, const QByteArray &lexem)
size_t qHash(const SubArray &key, size_t seed=0)
Q_DECLARE_TYPEINFO(Symbol, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(SafeSymbols, Q_RELOCATABLE_TYPE)
#define FOR_ALL_TOKENS(F)