13#include <QtCore/qcborarray.h>
14#include <QtCore/qcbormap.h>
15#include <QtCore/qdir.h>
16#include <QtCore/qfile.h>
17#include <QtCore/qjsondocument.h>
18#include <QtCore/qqueue.h>
22using namespace Qt::StringLiterals;
31std::vector<std::unique_ptr<MetaTypePrivate>> s_pool;
35 const QJsonDocument jsonValue = QJsonDocument::fromJson(json, error);
36 if (jsonValue.isArray())
37 return QCborValue::fromJsonValue(jsonValue.array());
38 if (jsonValue.isObject())
39 return QCborValue::fromJsonValue(jsonValue.object());
45 const QAnyStringView unqualified = classDef.className();
46 const QAnyStringView qualified = classDef.qualifiedClassName();
48 QList<QAnyStringView> namespaces;
49 if (qualified != unqualified) {
50 namespaces = split(qualified,
"::"_L1);
51 Q_ASSERT(namespaces.last() == unqualified);
52 namespaces.pop_back();
60 for (
const QString &source: files) {
61 if (m_seenMetaTypesFiles.hasSeen(QDir::cleanPath(source)))
64 QCborValue metaObjects;
67 if (!f.open(QIODevice::ReadOnly)) {
68 error(source) <<
"Cannot open file for reading";
71 QJsonParseError parseError = {0, QJsonParseError::NoError};
72 metaObjects = fromJson(f.readAll(), &parseError);
73 if (parseError.error != QJsonParseError::NoError) {
75 <<
"Failed to parse JSON:" << parseError.error
76 << parseError.errorString();
81 if (metaObjects.isArray()) {
82 const QCborArray metaObjectsArray = metaObjects.toArray();
83 for (
const QCborValue &metaObject : metaObjectsArray) {
84 if (!metaObject.isMap()) {
85 error(source) <<
"JSON is not an object";
89 processTypes(metaObject.toMap());
91 }
else if (metaObjects.isMap()) {
92 processTypes(metaObjects.toMap());
94 error(source) <<
"JSON is not an object or an array";
104 QFile typesFile(types);
105 if (!typesFile.open(QIODevice::ReadOnly)) {
106 error(types) <<
"Cannot open foreign types file";
110 QJsonParseError parseError = {0, QJsonParseError::NoError};
111 QCborValue foreignMetaObjects = fromJson(typesFile.readAll(), &parseError);
112 if (parseError.error != QJsonParseError::NoError) {
114 <<
"Failed to parse JSON:" << parseError.error
115 << parseError.errorString();
119 const QCborArray foreignObjectsArray = foreignMetaObjects.toArray();
120 for (
const QCborValue &metaObject : foreignObjectsArray) {
121 if (!metaObject.isMap()) {
122 error(types) <<
"JSON is not an object";
126 processForeignTypes(metaObject.toMap());
136 for (
const QString &types : foreignTypesFiles) {
137 if (m_seenMetaTypesFiles.hasSeen(QDir::cleanPath(types)))
140 if (!processForeignTypes(types))
146template<
typename String>
149 std::sort(list->begin(), list->end());
150 const auto newEnd = std::unique(list->begin(), list->end());
151 list->erase(
typename QList<String>::const_iterator(newEnd), list->constEnd());
161 sortTypes(m_foreignTypes);
162 sortStringList(&m_primitiveTypes);
163 sortStringList(&m_usingDeclarations);
165 sortStringList(&m_referencedTypes);
166 sortStringList(&m_includes);
171 QString registrationHelper;
172 for (
const auto &obj: m_types) {
173 const QString className = obj.className().toString();
174 const QString qualifiedClassName = obj.qualifiedClassName().toString();
175 const QString foreignClassName = className + u"Foreign";
176 QStringList qmlElements;
177 QString qmlUncreatable;
179 bool isSingleton =
false;
180 bool isExplicitlyUncreatable =
false;
181 bool isNamespace = obj.kind() == MetaType::Kind::Namespace;
182 for (
const ClassInfo &entry: obj.classInfos()) {
183 const auto name = entry.name;
184 const auto value = entry.value;
185 if (name == S_ELEMENT) {
186 if (value == S_AUTO) {
187 qmlElements.append(u"QML_NAMED_ELEMENT("_s + className + u")"_s);
188 }
else if (value == S_ANONYMOUS) {
189 qmlElements.append(u"QML_ANONYMOUS"_s);
191 qmlElements.append(u"QML_NAMED_ELEMENT("_s + value.toString() + u")");
193 }
else if (name == S_CREATABLE && value == S_FALSE) {
194 isExplicitlyUncreatable =
true;
195 }
else if (name == S_UNCREATABLE_REASON) {
196 qmlUncreatable = u"QML_UNCREATABLE(\""_s + value.toString() + u"\")";
197 }
else if (name == S_ATTACHED) {
198 qmlAttached = u"QML_ATTACHED("_s + value.toString() + u")";
199 }
else if (name == S_SINGLETON) {
203 if (qmlElements.isEmpty())
205 const QString spaces = u" "_s;
207 registrationHelper += u"\nnamespace "_s + foreignClassName + u"{\n Q_NAMESPACE\n"_s;
208 registrationHelper += spaces + u"QML_FOREIGN_NAMESPACE(" + qualifiedClassName + u")\n"_s;
210 registrationHelper += u"\nstruct "_s + foreignClassName + u"{\n Q_GADGET\n"_s;
211 registrationHelper += spaces + u"QML_FOREIGN(" + qualifiedClassName + u")\n"_s;
213 registrationHelper += spaces + qmlElements.join(u"\n"_s) + u"\n"_s;
215 registrationHelper += spaces + u"QML_SINGLETON\n"_s;
216 if (isExplicitlyUncreatable) {
217 if (qmlUncreatable.isEmpty())
218 registrationHelper += spaces + uR"(QML_UNCREATABLE(""))" + u"n";
220 registrationHelper += spaces + qmlUncreatable + u"\n";
222 if (!qmlAttached.isEmpty())
223 registrationHelper += spaces + qmlAttached + u"\n";
224 registrationHelper += u"}";
226 registrationHelper += u";";
227 registrationHelper += u"\n";
229 return registrationHelper;
233 const MetaType &classDef, PopulateMode populateMode)
239 QList<QAnyStringView> primitiveAliases;
242 RegistrationMode mode = NoRegistration;
243 bool isSelfExtendingValueType =
false;
244 bool hasJavaScriptExtension =
false;
245 bool isRootObject =
false;
246 bool isSequence =
false;
248 for (
const ClassInfo &classInfo : classDef.classInfos()) {
249 if (classInfo.name == S_FOREIGN)
250 usingDeclaration.alias = classInfo.value;
251 else if (classInfo.name == S_PRIMITIVE_ALIAS)
252 primitiveAliases.append(classInfo.value);
253 else if (classInfo.name == S_EXTENSION_IS_JAVA_SCRIPT)
254 hasJavaScriptExtension = (classInfo.value == S_TRUE);
255 else if (classInfo.name == S_EXTENDED && classDef.kind() == MetaType::Kind::Gadget)
256 isSelfExtendingValueType = classInfo.value == classDef.className();
257 else if (classInfo.name == S_ROOT)
258 isRootObject = (classInfo.value == S_TRUE);
259 else if (classInfo.name == S_SEQUENCE)
261 else if (classInfo.name == S_USING)
262 usingDeclaration.original = classInfo.value;
263 else if (populateMode == PopulateMode::Yes && classInfo.name == S_ELEMENT) {
264 switch (classDef.kind()) {
265 case MetaType::Kind::Object:
266 mode = ObjectRegistration;
268 case MetaType::Kind::Gadget:
269 mode = GadgetRegistration;
271 case MetaType::Kind::Namespace:
272 mode = NamespaceRegistration;
276 <<
"Not registering a classInfo which is neither an object,"
277 <<
"nor a gadget, nor a namespace:"
278 << classInfo.name.toString();
284 return PreProcessResult {
285 std::move(primitiveAliases),
287 (!isRootObject && (isSequence || isSelfExtendingValueType || hasJavaScriptExtension))
288 ? usingDeclaration.alias
298 return string.visit([seed](
auto view) {
299 if constexpr (std::is_same_v<
decltype(view), QStringView>)
300 return qHash(view, seed);
301 if constexpr (std::is_same_v<
decltype(view), QLatin1StringView>)
302 return qHash(view, seed);
303 if constexpr (std::is_same_v<
decltype(view), QUtf8StringView>)
304 return qHash(QByteArrayView(view.data(), view.length()), seed);
310 return a.qualifiedClassName() < b.qualifiedClassName();
316 const auto remove = std::equal_range(
317 typeList.constBegin(), typeList.constEnd(), toBeRemoved,
318 qualifiedClassNameLessThan);
319 if (remove.first == remove.second)
321 for (
auto it = remove.first; it != remove.second; ++it) {
322 if (*it == toBeRemoved) {
333 const auto [lower, upper] = std::equal_range(
334 typeList.constBegin(), typeList.constEnd(), toBeAdded,
335 qualifiedClassNameLessThan);
337 typeList.insert(lower, toBeAdded);
342 const auto [first, last] = std::equal_range(
343 typeList.constBegin(), typeList.constEnd(), type, qualifiedClassNameLessThan);
344 for (
auto it = first; it != last; ++it) {
365 case TypeRelation::Property:
return "property"_L1;
366 case TypeRelation::Argument:
return "argument"_L1;
367 case TypeRelation::Return:
return "return"_L1;
368 case TypeRelation::Enum:
return "enum"_L1;
369 case TypeRelation::Attached:
return "attached"_L1;
370 case TypeRelation::SequenceValue:
return "sequence value"_L1;
371 case TypeRelation::Extension:
return "extension"_L1;
376 Q_UNREACHABLE_RETURN(QLatin1StringView());
381 QSet<QAnyStringView> processedRelatedNativeNames;
382 QSet<QAnyStringView> processedRelatedJavaScriptNames;
383 QSet<QAnyStringView> unresolvedForeignNames;
384 QQueue<MetaType> typeQueue;
385 typeQueue.append(m_types);
387 const auto addRelatedName
388 = [&](QAnyStringView relatedName,
const QList<QAnyStringView> &namespaces) {
389 if (
const FoundType related = QmlTypesClassDescription::findType(
390 m_types, m_foreignTypes, relatedName, namespaces)) {
393 processedRelatedJavaScriptNames.insert(related
.javaScript.qualifiedClassName());
396 processedRelatedNativeNames.insert(related
.native.qualifiedClassName());
404 const auto addRelatedType = [&](
const MetaType &type) {
405 const QAnyStringView qualifiedName = type.qualifiedClassName();
406 if (type.inputFile().isEmpty())
407 processedRelatedJavaScriptNames.insert(qualifiedName);
409 processedRelatedNativeNames.insert(qualifiedName);
413 for (
const MetaType &type : std::as_const(m_types)) {
414 addRelatedType(type);
415 for (
const ClassInfo &obj : type.classInfos()) {
416 if (obj.name == S_FOREIGN) {
417 const QAnyStringView foreign = obj.value;
418 if (!addRelatedName(foreign, namespaces(type)))
419 unresolvedForeignNames.insert(foreign);
427 for (
const MetaType &foreignType : std::as_const(m_foreignTypes)) {
428 bool seenQmlPrefix =
false;
429 for (
const ClassInfo &obj : foreignType.classInfos()) {
430 const QAnyStringView name = obj.name;
431 if (!seenQmlPrefix && startsWith(name,
"QML."_L1)) {
432 addRelatedType(foreignType);
433 seenQmlPrefix =
true;
435 if (name == S_FOREIGN
436 || name == S_EXTENDED
437 || name == S_ATTACHED
438 || name == S_SEQUENCE) {
439 ResolvedTypeAlias foreign(obj.value, m_usingDeclarations);
440 if (!addRelatedName(foreign.type, namespaces(foreignType)))
441 unresolvedForeignNames.insert(foreign.type);
446 const auto addReference
447 = [&](
const MetaType &type, QSet<QAnyStringView> *processedRelatedNames,
452 QAnyStringView qualifiedName = type.qualifiedClassName();
453 m_referencedTypes.append(qualifiedName);
454 const qsizetype size = processedRelatedNames->size();
455 processedRelatedNames->insert(qualifiedName);
457 if (processedRelatedNames->size() == size) {
478 if (removeFromSortedMetaTypeList(m_opaqueTypes, type) ==
NotFound)
481 typeQueue.enqueue(type);
491 insertIntoSortedMetaTypeList(m_opaqueTypes, type);
497 insertIntoSortedMetaTypeList(m_opaqueTypes, type);
506 insertIntoSortedMetaTypeList(m_types, type);
513 removeFromSortedMetaTypeList(m_foreignTypes, type);
516 const auto addInterface
517 = [&](QAnyStringView typeName,
const QList<QAnyStringView> &namespaces,
519 if (
const FoundType other = QmlTypesClassDescription::findType(
520 m_types, m_foreignTypes, typeName, namespaces)) {
530 unresolvedForeignNames.insert(typeName);
533 processedRelatedNativeNames.insert(typeName);
537 const auto doAddReferences = [&](QAnyStringView typeName,
538 const QList<QAnyStringView> &namespaces,
541 if (
const FoundType other = QmlTypesClassDescription::findType(
542 m_types, m_foreignTypes, typeName, namespaces)) {
548 relation, contextOpacity);
555 const auto addType = [&](
const MetaType &context, QAnyStringView typeName,
556 const QList<QAnyStringView> &namespaces,
TypeRelation relation) {
557 if (doAddReferences(typeName, namespaces, relation))
561 const QLatin1StringView separator(
"::");
562 if (
const qsizetype index = lastIndexOf(typeName, separator); index > 0) {
563 if (
const FoundType other = QmlTypesClassDescription::findType(
564 m_types, m_foreignTypes, typeName.left(index), namespaces)) {
566 const QAnyStringView enumName = typeName.mid(index + separator.length());
568 for (
const Enum &enumerator : other.native.enums()) {
569 if (enumerator.name != enumName && enumerator.alias != enumName)
573 other.native, &processedRelatedNativeNames, other.nativeOrigin,
576 other.javaScript, &processedRelatedJavaScriptNames,
577 other.javaScriptOrigin, relation);
584 for (
const Enum &enumerator : context.enums()) {
585 if (enumerator.name == typeName || enumerator.alias == typeName)
592 if (!unresolvedForeignNames.contains(typeName) && !isPrimitive(typeName)) {
599 MetaType type = MetaType::createOpaqueType(typeName);
600 insertIntoSortedMetaTypeList(m_opaqueTypes, type);
604 warning(context) << typeName <<
"is used as" << typeRelationString(relation)
605 <<
"type but cannot be found.";
609 processedRelatedNativeNames.insert(typeName);
610 processedRelatedJavaScriptNames.insert(typeName);
616 const auto addSupers = [&](
const MetaType &context,
const QList<QAnyStringView> &namespaces,
618 for (
const Interface &iface : context.ifaces())
619 addInterface(interfaceName(iface), namespaces, TypeRelation::Base, contextOpacity);
622 bool warnAboutSupers = context.kind() != MetaType::Kind::Gadget;
624 QList<QAnyStringView> missingSupers;
626 for (
const BaseType &superObject : context.superClasses()) {
627 if (superObject.access != Access::Public)
630 QAnyStringView typeName = superObject.name;
631 if (doAddReferences(typeName, namespaces, TypeRelation::Base, contextOpacity))
632 warnAboutSupers =
false;
634 missingSupers.append(typeName);
637 for (QAnyStringView typeName : std::as_const(missingSupers)) {
640 && !unresolvedForeignNames.contains(typeName)
641 && !isPrimitive(typeName)) {
642 warning(context) << typeName <<
"is used as base type but cannot be found.";
645 processedRelatedNativeNames.insert(typeName);
646 processedRelatedJavaScriptNames.insert(typeName);
650 const auto addProperties = [&](
const MetaType &context,
651 const QList<QAnyStringView> &namespaces) {
652 for (
const Property &property : context.properties()) {
653 ResolvedTypeAlias resolved(property.type, m_usingDeclarations);
654 if (!resolved.type.isEmpty())
655 addType(context, resolved.type, namespaces, TypeRelation::Property);
659 const auto addMethods = [&](
const MetaType &context,
660 const QList<QAnyStringView> &namespaces) {
661 for (
const Method::Container &methods
662 : {context.methods(), context.constructors(), context.sigs() }) {
663 for (
const Method &methodObject : methods) {
664 if (methodObject.access != Access::Public)
666 for (
const Argument &argument : std::as_const(methodObject.arguments)) {
667 ResolvedTypeAlias resolved(argument.type, m_usingDeclarations);
668 if (!resolved.type.isEmpty())
669 addType(context, resolved.type, namespaces, TypeRelation::Argument);
672 ResolvedTypeAlias resolved(methodObject.returnType, m_usingDeclarations);
673 if (!resolved.type.isEmpty())
674 addType(context, resolved.type, namespaces, TypeRelation::Return);
679 const auto addEnums = [&](
const MetaType &context,
680 const QList<QAnyStringView> &namespaces) {
681 for (
const Enum &enumerator : context.enums()) {
682 ResolvedTypeAlias resolved(enumerator.type, m_usingDeclarations);
683 if (!resolved.type.isEmpty())
684 addType(context, resolved.type, namespaces, TypeRelation::Enum);
689 const QList<QAnyStringView> &namespaces) {
690 const QAnyStringView objNameValue = obj.name;
691 if (objNameValue == S_ATTACHED) {
694 }
else if (objNameValue == S_SEQUENCE) {
698 }
else if (objNameValue == S_EXTENDED) {
699 const QAnyStringView value = obj.value;
708 while (!typeQueue.isEmpty()) {
709 QAnyStringView unresolvedForeign;
711 const MetaType classDef = typeQueue.dequeue();
712 const QList<QAnyStringView> namespaces = MetaTypesJsonProcessor::namespaces(classDef);
713 const ContextOpacity classDefOpacity = sortedMetaTypeListContains(m_opaqueTypes, classDef)
714 ? ContextOpacity::Opaque
715 : ContextOpacity::FullyRegistered;
717 for (
const ClassInfo &obj : classDef.classInfos()) {
718 if (addRelation(classDef, obj, namespaces))
720 if (obj.name != S_FOREIGN)
723 const QAnyStringView foreignClassName = obj.value;
727 if (
const FoundType found = QmlTypesClassDescription::findType(
728 m_foreignTypes, {}, foreignClassName, namespaces)) {
729 const MetaType other = found.select(classDef,
"Foreign");
730 const QList<QAnyStringView> otherNamespaces
731 = MetaTypesJsonProcessor::namespaces(other);
732 addSupers(other, otherNamespaces, classDefOpacity);
733 addProperties(other, otherNamespaces);
734 addMethods(other, otherNamespaces);
735 addEnums(other, otherNamespaces);
737 for (
const ClassInfo &obj : other.classInfos()) {
738 if (addRelation(classDef, obj, otherNamespaces))
742 }
else if (!QmlTypesClassDescription::findType(
743 m_types, {}, foreignClassName, namespaces)) {
744 unresolvedForeign = foreignClassName;
748 if (!unresolvedForeign.isEmpty() && !isPrimitive(unresolvedForeign)) {
751 <<
"is declared as foreign type, but cannot be found.";
754 addSupers(classDef, namespaces, classDefOpacity);
755 addProperties(classDef, namespaces);
756 addMethods(classDef, namespaces);
757 addEnums(classDef, namespaces);
763 std::sort(types.begin(), types.end(), qualifiedClassNameLessThan);
768 if (!m_privateIncludes)
769 return include.toString();
771 if (endsWith(include,
"_p.h"_L1))
772 return QLatin1String(
"private/") + include.toString();
774 if (startsWith(include,
"qplatform"_L1) || startsWith(include,
"qwindowsystem"_L1))
775 return QLatin1String(
"qpa/") + include.toString();
777 return include.toString();
782 const QString include = resolvedInclude(types[S_INPUT_FILE].toStringView());
783 const QCborArray classes = types[S_CLASSES].toArray();
784 for (
const QCborValue &cls : classes) {
785 const MetaType classDef(cls.toMap(), include);
787 const PreProcessResult preprocessed = preProcess(classDef, PopulateMode::Yes);
788 switch (preprocessed.mode) {
789 case NamespaceRegistration:
790 case GadgetRegistration:
791 case ObjectRegistration: {
792 if (!endsWith(include, QLatin1String(
".h"))
793 && !endsWith(include, QLatin1String(
".hpp"))
794 && !endsWith(include, QLatin1String(
".hxx"))
795 && !endsWith(include, QLatin1String(
".hh"))
796 && !endsWith(include, QLatin1String(
".py"))
797 && contains(include, QLatin1Char(
'.'))) {
799 <<
"Class" << classDef.qualifiedClassName()
800 <<
"is declared in" << include <<
"which appears not to be a header."
801 <<
"The compilation of its registration to QML may fail.";
803 m_includes.append(include);
804 m_types.emplaceBack(classDef);
808 m_foreignTypes.emplaceBack(classDef);
812 if (!preprocessed.foreignPrimitive.isEmpty()) {
813 m_primitiveTypes.emplaceBack(preprocessed.foreignPrimitive);
814 m_primitiveTypes.append(preprocessed.primitiveAliases);
817 if (preprocessed.usingDeclaration.isValid())
818 m_usingDeclarations.append(preprocessed.usingDeclaration);
824 const QString include = resolvedInclude(types[S_INPUT_FILE].toStringView());
825 const QCborArray classes = types[S_CLASSES].toArray();
826 for (
const QCborValue &cls : classes) {
827 const MetaType classDef(cls.toMap(), include);
828 PreProcessResult preprocessed = preProcess(classDef, PopulateMode::No);
830 m_foreignTypes.emplaceBack(classDef);
831 if (!preprocessed.foreignPrimitive.isEmpty()) {
832 m_primitiveTypes.emplaceBack(preprocessed.foreignPrimitive);
833 m_primitiveTypes.append(preprocessed.primitiveAliases);
836 if (preprocessed.usingDeclaration.isValid())
837 m_usingDeclarations.append(preprocessed.usingDeclaration);
843 const auto it = cbor.find(S_REVISION);
844 return it == cbor.end()
846 : QTypeRevision::fromEncodedVersion(it->toInteger());
851 const QAnyStringView access = cbor[S_ACCESS].toStringView();
852 if (access == S_PUBLIC)
853 return Access::Public;
854 if (access == S_PROTECTED)
855 return Access::Protected;
856 return Access::Private;
873 if (cbor.isArray()) {
874 QCborArray needlessWrapping = cbor.toArray();
875 className = needlessWrapping.size() > 0
876 ? needlessWrapping[0].toMap()[S_CLASS_NAME].toStringView()
879 className = cbor.toMap()[S_CLASS_NAME].toStringView();
893 ,
index(cbor[S_INDEX].toInteger(-1))
896 ,
isFinal(cbor[S_FINAL].toBool())
917 ,
isCloned(cbor[S_IS_CLONED].toBool())
919 ,
isConstructor(isConstructor || cbor[S_IS_CONSTRUCTOR].toBool())
920 ,
isConst(cbor[S_IS_CONST].toBool())
922 const QCborArray args = cbor[S_ARGUMENTS].toArray();
923 for (
const QCborValue &argument : args)
924 arguments.emplace_back(argument.toMap());
926 if (arguments.size() == 1) {
927 const QAnyStringView type = arguments[0].type;
928 if (type ==
"QQmlV4FunctionPtr"_L1 || type ==
"QQmlV4Function*"_L1) {
940 ,
isFlag(cbor[S_IS_FLAG].toBool())
941 ,
isClass(cbor[S_IS_CLASS].toBool())
943 const QCborArray vals = cbor[S_VALUES].toArray();
944 for (
const QCborValue &value : vals)
945 values.emplace_back(value.toStringView());
952 className = cbor[S_CLASS_NAME].toStringView();
954 qualifiedClassName = cbor[S_QUALIFIED_CLASS_NAME].toStringView();
956 const QCborArray cborSuperClasses = cbor[S_SUPER_CLASSES].toArray();
957 for (
const QCborValue &superClass : cborSuperClasses)
958 superClasses.emplace_back(superClass.toMap());
960 const QCborArray cborClassInfos = cbor[S_CLASS_INFOS].toArray();
961 for (
const QCborValue &classInfo : cborClassInfos)
962 classInfos.emplace_back(classInfo.toMap());
964 const QCborArray cborIfaces = cbor[S_INTERFACES].toArray();
965 for (
const QCborValue &iface : cborIfaces)
966 ifaces.emplace_back(iface);
968 const QCborArray cborProperties = cbor[S_PROPERTIES].toArray();
969 for (
const QCborValue &property : cborProperties)
970 properties.emplace_back(property.toMap());
972 for (
const QCborArray &cborMethods : { cbor[S_SLOTS].toArray(), cbor[S_METHODS].toArray() }) {
973 for (
const QCborValue &method : cborMethods)
974 methods.emplace_back(method.toMap(),
false);
977 const QCborArray cborSigs = cbor[S_SIGNALS].toArray();
978 for (
const QCborValue &sig : cborSigs)
979 sigs.emplace_back(sig.toMap(),
false);
981 const QCborArray cborConstructors = cbor[S_CONSTRUCTORS].toArray();
982 for (
const QCborValue &constructor : cborConstructors)
983 constructors.emplace_back(constructor.toMap(),
true);
985 const QCborArray cborEnums = cbor[S_ENUMS].toArray();
986 for (
const QCborValue &enumerator : cborEnums)
987 enums.emplace_back(enumerator.toMap());
989 if (cbor[S_GADGET].toBool())
991 else if (cbor[S_OBJECT].toBool())
993 else if (cbor[S_NAMESPACE].toBool())
994 kind = Kind::Namespace;
1002
1003
1004
1007 auto priv = s_pool.emplace_back(std::make_unique<MetaTypePrivate>()).get();
1008 priv->className = typeName;
1009 priv->qualifiedClassName = typeName;
1010 priv->kind = MetaType::Kind::Gadget;
Combined button and popup list for selecting options.
QDebug warning(const MetaType &classDef)
Argument(const QCborMap &cbor)
BaseType(const QCborMap &cbor)
ClassInfo(const QCborMap &cbor)
Enum(const QCborMap &cbor)
Interface(const QCborValue &cbor)
bool isJavaScriptFunction
Method(const QCborMap &cbor, bool isConstructor)
static constexpr int InvalidIndex
Property(const QCborMap &cbor)