QtBase  v6.3.1
qmetaobjectbuilder.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #include "qmetaobjectbuilder_p.h"
41 
42 #include "qobject_p.h"
43 #include "qmetaobject_p.h"
44 
45 #include <vector>
46 #include <stdlib.h>
47 
49 
80 // copied from moc's generator.cpp
81 namespace QtPrivate {
82 Q_CORE_EXPORT bool isBuiltinType(const QByteArray &type)
83 {
84  int id = QMetaType::fromName(type).id();
85  if (!id && !type.isEmpty() && type != "void")
86  return false;
87  return (id < QMetaType::User);
88 }
89 } // namespace QtPrivate
90 
91 // copied from qmetaobject.cpp
92 [[maybe_unused]] static inline const QMetaObjectPrivate *priv(const uint* data)
93 { return reinterpret_cast<const QMetaObjectPrivate*>(data); }
94 
96 {
97 public:
99  (QMetaMethod::MethodType _methodType,
100  const QByteArray& _signature,
101  const QByteArray& _returnType = QByteArray("void"),
103  int _revision = 0)
104  : signature(QMetaObject::normalizedSignature(_signature.constData())),
105  returnType(QMetaObject::normalizedType(_returnType)),
106  attributes(((int)_access) | (((int)_methodType) << 2)),
107  revision(_revision)
108  {
109  Q_ASSERT((_methodType == QMetaMethod::Constructor) == returnType.isNull());
110  }
111 
117  int revision;
118 
120  {
122  }
123 
125  {
127  }
128 
130  {
131  attributes = ((attributes & ~AccessMask) | (int)value);
132  }
133 
135  {
137  }
138 
139  int parameterCount() const
140  {
141  return parameterTypes().size();
142  }
143 
144  QByteArray name() const
145  {
146  return signature.left(qMax(signature.indexOf('('), 0));
147  }
148 };
150 
152 {
153 public:
155  (const QByteArray& _name, const QByteArray& _type, QMetaType _metaType, int notifierIdx=-1,
156  int _revision = 0)
157  : name(_name),
158  type(QMetaObject::normalizedType(_type.constData())),
159  metaType(_metaType),
160  flags(Readable | Writable | Scriptable), notifySignal(notifierIdx),
161  revision(_revision)
162  {
163 
164  }
165 
169  int flags;
171  int revision;
172 
173  bool flag(int f) const
174  {
175  return ((flags & f) != 0);
176  }
177 
178  void setFlag(int f, bool value)
179  {
180  if (value)
181  flags |= f;
182  else
183  flags &= ~f;
184  }
185 };
187 
189 {
190 public:
192  : name(_name), enumName(_name), isFlag(false), isScoped(false)
193  {
194  }
195 
198  bool isFlag;
199  bool isScoped;
202 };
204 
206 {
207 public:
209  : flags(0)
210  {
211  superClass = &QObject::staticMetaObject;
212  staticMetacallFunction = nullptr;
213  }
214 
215  bool hasRevisionedMethods() const;
216 
220  std::vector<QMetaMethodBuilderPrivate> methods;
221  std::vector<QMetaMethodBuilderPrivate> constructors;
222  std::vector<QMetaPropertyBuilderPrivate> properties;
225  std::vector<QMetaEnumBuilderPrivate> enumerators;
227  MetaObjectFlags flags;
228 };
229 
231 {
232  for (const auto &method : methods) {
233  if (method.revision)
234  return true;
235  }
236  return false;
237 }
238 
243 {
244  d = new QMetaObjectBuilderPrivate();
245 }
246 
259  QMetaObjectBuilder::AddMembers members)
260 {
261  d = new QMetaObjectBuilderPrivate();
262  addMetaObject(prototype, members);
263 }
264 
269 {
270  delete d;
271 }
272 
280 {
281  return d->className;
282 }
283 
291 {
292  d->className = name;
293 }
294 
303 {
304  return d->superClass;
305 }
306 
315 {
316  Q_ASSERT(meta);
317  d->superClass = meta;
318 }
319 
326 MetaObjectFlags QMetaObjectBuilder::flags() const
327 {
328  return d->flags;
329 }
330 
337 void QMetaObjectBuilder::setFlags(MetaObjectFlags flags)
338 {
339  d->flags = flags;
340 }
341 
350 {
351  return int(d->methods.size());
352 }
353 
360 {
361  return int(d->constructors.size());
362 }
363 
371 {
372  return int(d->properties.size());
373 }
374 
383 {
384  return int(d->enumerators.size());
385 }
386 
395 {
396  return d->classInfoNames.size();
397 }
398 
411 {
412  return d->relatedMetaObjects.size();
413 }
414 
424 {
425  int index = int(d->methods.size());
427  return QMetaMethodBuilder(this, index);
428 }
429 
440  const QByteArray &returnType)
441 {
442  int index = int(d->methods.size());
444  return QMetaMethodBuilder(this, index);
445 }
446 
459 {
461  if (prototype.methodType() == QMetaMethod::Method)
462  method = addMethod(prototype.methodSignature());
463  else if (prototype.methodType() == QMetaMethod::Signal)
464  method = addSignal(prototype.methodSignature());
465  else if (prototype.methodType() == QMetaMethod::Slot)
466  method = addSlot(prototype.methodSignature());
467  else if (prototype.methodType() == QMetaMethod::Constructor)
468  method = addConstructor(prototype.methodSignature());
469  method.setReturnType(prototype.typeName());
471  method.setTag(prototype.tag());
472  method.setAccess(prototype.access());
473  method.setAttributes(prototype.attributes());
474  method.setRevision(prototype.revision());
475  return method;
476 }
477 
487 {
488  int index = int(d->methods.size());
490  return QMetaMethodBuilder(this, index);
491 }
492 
502 {
503  int index = int(d->methods.size());
505  QByteArray("void"), QMetaMethod::Public));
506  return QMetaMethodBuilder(this, index);
507 }
508 
519 {
520  int index = int(d->constructors.size());
522  /*returnType=*/QByteArray()));
523  return QMetaMethodBuilder(this, -(index + 1));
524 }
525 
538 {
541  ctor.setReturnType(prototype.typeName());
542  ctor.setParameterNames(prototype.parameterNames());
543  ctor.setTag(prototype.tag());
544  ctor.setAccess(prototype.access());
545  ctor.setAttributes(prototype.attributes());
546  return ctor;
547 }
548 
559  int notifierId)
560 {
561  return addProperty(name, type, QMetaType::fromName(type), notifierId);
562 }
563 
568 {
569  int index = int(d->properties.size());
570  d->properties.push_back(QMetaPropertyBuilderPrivate(name, type, metaType, notifierId));
571  return QMetaPropertyBuilder(this, index);
572 }
573 
583 {
584  QMetaPropertyBuilder property = addProperty(prototype.name(), prototype.typeName(), prototype.metaType());
585  property.setReadable(prototype.isReadable());
586  property.setWritable(prototype.isWritable());
587  property.setResettable(prototype.isResettable());
588  property.setDesignable(prototype.isDesignable());
589  property.setScriptable(prototype.isScriptable());
590  property.setStored(prototype.isStored());
591  property.setUser(prototype.isUser());
592  property.setStdCppSet(prototype.hasStdCppSet());
593  property.setEnumOrFlag(prototype.isEnumType());
594  property.setConstant(prototype.isConstant());
595  property.setFinal(prototype.isFinal());
596  property.setRevision(prototype.revision());
597  if (prototype.hasNotifySignal()) {
598  // Find an existing method for the notify signal, or add a new one.
599  QMetaMethod method = prototype.notifySignal();
600  int index = indexOfMethod(method.methodSignature());
601  if (index == -1)
603  d->properties[property._index].notifySignal = index;
604  }
605  return property;
606 }
607 
617 {
618  int index = int(d->enumerators.size());
620  return QMetaEnumBuilder(this, index);
621 }
622 
633 {
634  QMetaEnumBuilder en = addEnumerator(prototype.name());
635  en.setEnumName(prototype.enumName());
636  en.setIsFlag(prototype.isFlag());
637  en.setIsScoped(prototype.isScoped());
638  int count = prototype.keyCount();
639  for (int index = 0; index < count; ++index)
640  en.addKey(prototype.key(index), prototype.value(index));
641  return en;
642 }
643 
652 {
653  int index = d->classInfoNames.size();
654  d->classInfoNames += name;
655  d->classInfoValues += value;
656  return index;
657 }
658 
671 {
672  Q_ASSERT(meta);
673  int index = d->relatedMetaObjects.size();
674  d->relatedMetaObjects.append(meta);
675  return index;
676 }
677 
686  QMetaObjectBuilder::AddMembers members)
687 {
688  Q_ASSERT(prototype);
689  int index;
690 
691  if ((members & ClassName) != 0)
692  d->className = prototype->className();
693 
694  if ((members & SuperClass) != 0)
695  d->superClass = prototype->superClass();
696 
697  if ((members & (Methods | Signals | Slots)) != 0) {
698  for (index = prototype->methodOffset(); index < prototype->methodCount(); ++index) {
699  QMetaMethod method = prototype->method(index);
701  if (method.access() == QMetaMethod::Public && (members & PublicMethods) == 0)
702  continue;
703  if (method.access() == QMetaMethod::Private && (members & PrivateMethods) == 0)
704  continue;
705  if (method.access() == QMetaMethod::Protected && (members & ProtectedMethods) == 0)
706  continue;
707  }
708  if (method.methodType() == QMetaMethod::Method && (members & Methods) != 0) {
709  addMethod(method);
710  } else if (method.methodType() == QMetaMethod::Signal &&
711  (members & Signals) != 0) {
712  addMethod(method);
713  } else if (method.methodType() == QMetaMethod::Slot &&
714  (members & Slots) != 0) {
715  addMethod(method);
716  }
717  }
718  }
719 
720  if ((members & Constructors) != 0) {
721  for (index = 0; index < prototype->constructorCount(); ++index)
722  addConstructor(prototype->constructor(index));
723  }
724 
725  if ((members & Properties) != 0) {
727  addProperty(prototype->property(index));
728  }
729 
730  if ((members & Enumerators) != 0) {
732  addEnumerator(prototype->enumerator(index));
733  }
734 
735  if ((members & ClassInfos) != 0) {
736  for (index = prototype->classInfoOffset(); index < prototype->classInfoCount(); ++index) {
737  QMetaClassInfo ci = prototype->classInfo(index);
738  addClassInfo(ci.name(), ci.value());
739  }
740  }
741 
742  if ((members & RelatedMetaObjects) != 0) {
743  Q_ASSERT(priv(prototype->d.data)->revision >= 2);
744  const auto *objects = prototype->d.relatedMetaObjects;
745  if (objects) {
746  while (*objects != nullptr) {
747  addRelatedMetaObject(*objects);
748  ++objects;
749  }
750  }
751  }
752 
753  if ((members & StaticMetacall) != 0) {
754  Q_ASSERT(priv(prototype->d.data)->revision >= 6);
755  if (prototype->d.static_metacall)
757  }
758 }
759 
766 {
767  if (uint(index) < d->methods.size())
768  return QMetaMethodBuilder(this, index);
769  else
770  return QMetaMethodBuilder();
771 }
772 
779 {
780  if (uint(index) < d->constructors.size())
781  return QMetaMethodBuilder(this, -(index + 1));
782  else
783  return QMetaMethodBuilder();
784 }
785 
792 {
793  if (uint(index) < d->properties.size())
794  return QMetaPropertyBuilder(this, index);
795  else
796  return QMetaPropertyBuilder();
797 }
798 
806 {
807  if (uint(index) < d->enumerators.size())
808  return QMetaEnumBuilder(this, index);
809  else
810  return QMetaEnumBuilder();
811 }
812 
824 {
825  if (index >= 0 && index < d->relatedMetaObjects.size())
826  return d->relatedMetaObjects[index];
827  else
828  return nullptr;
829 }
830 
839 {
840  if (index >= 0 && index < d->classInfoNames.size())
841  return d->classInfoNames[index];
842  else
843  return QByteArray();
844 }
845 
854 {
855  if (index >= 0 && index < d->classInfoValues.size())
856  return d->classInfoValues[index];
857  else
858  return QByteArray();
859 }
860 
870 {
871  if (uint(index) < d->methods.size()) {
872  d->methods.erase(d->methods.begin() + index);
873  for (auto &property : d->properties) {
874  // Adjust the indices of property notify signal references.
875  if (property.notifySignal == index) {
876  property.notifySignal = -1;
877  } else if (property.notifySignal > index)
878  property.notifySignal--;
879  }
880  }
881 }
882 
891 {
892  if (uint(index) < d->constructors.size())
893  d->constructors.erase(d->constructors.begin() + index);
894 }
895 
903 {
904  if (uint(index) < d->properties.size())
905  d->properties.erase(d->properties.begin() + index);
906 }
907 
916 {
917  if (uint(index) < d->enumerators.size())
918  d->enumerators.erase(d->enumerators.begin() + index);
919 }
920 
929 {
930  if (index >= 0 && index < d->classInfoNames.size()) {
933  }
934 }
935 
949 {
950  if (index >= 0 && index < d->relatedMetaObjects.size())
952 }
953 
961 {
963  for (const auto &method : d->methods) {
964  if (sig == method.signature)
965  return int(&method - &d->methods.front());
966  }
967  return -1;
968 }
969 
977 {
979  for (const auto &method : d->methods) {
981  return int(&method - &d->methods.front());
982  }
983  return -1;
984 }
985 
993 {
995  for (const auto &method : d->methods) {
997  return int(&method - &d->methods.front());
998  }
999  return -1;
1000 }
1001 
1009 {
1011  for (const auto &constructor : d->constructors) {
1012  if (sig == constructor.signature)
1013  return int(&constructor - &d->constructors.front());
1014  }
1015  return -1;
1016 }
1017 
1025 {
1026  for (const auto &property : d->properties) {
1027  if (name == property.name)
1028  return int(&property - &d->properties.front());
1029  }
1030  return -1;
1031 }
1032 
1040 {
1041  for (const auto &enumerator : d->enumerators) {
1042  if (name == enumerator.name)
1043  return int(&enumerator - &d->enumerators.front());
1044  }
1045  return -1;
1046 }
1047 
1056 {
1057  for (int index = 0; index < d->classInfoNames.size(); ++index) {
1058  if (name == d->classInfoNames[index])
1059  return index;
1060  }
1061  return -1;
1062 }
1063 
1064 // Align on a specific type boundary.
1065 #define ALIGN(size,type) \
1066  (size) = ((size) + sizeof(type) - 1) & ~(sizeof(type) - 1)
1067 
1076  : m_index(0)
1077  , m_className(className)
1078 {
1079  const int index = enter(m_className);
1080  Q_ASSERT(index == 0);
1081  Q_UNUSED(index);
1082 }
1083 
1084 // Enters the given value into the string table (if it hasn't already been
1085 // entered). Returns the index of the string.
1087 {
1088  Entries::iterator it = m_entries.find(value);
1089  if (it != m_entries.end())
1090  return it.value();
1091  int pos = m_index;
1092  m_entries.insert(value, pos);
1093  ++m_index;
1094  return pos;
1095 }
1096 
1098 {
1099  return alignof(uint);
1100 }
1101 
1102 // Returns the size (in bytes) required for serializing this string table.
1104 {
1105  int size = int(m_entries.size() * 2 * sizeof(uint));
1107  for (it = m_entries.constBegin(); it != m_entries.constEnd(); ++it)
1108  size += it.key().size() + 1;
1109  return size;
1110 }
1111 
1112 static void writeString(char *out, int i, const QByteArray &str,
1113  const int offsetOfStringdataMember, int &stringdataOffset)
1114 {
1115  int size = str.size();
1116  int offset = offsetOfStringdataMember + stringdataOffset;
1117  uint offsetLen[2] = { uint(offset), uint(size) };
1118 
1119  memcpy(out + 2 * i * sizeof(uint), &offsetLen, 2 * sizeof(uint));
1120 
1121  memcpy(out + offset, str.constData(), size);
1122  out[offset + size] = '\0';
1123 
1124  stringdataOffset += size + 1;
1125 }
1126 
1127 // Writes strings to string data struct.
1128 // The struct consists of an array of QByteArrayData, followed by a char array
1129 // containing the actual strings. This format must match the one produced by
1130 // moc (see generator.cpp).
1132 {
1133  Q_ASSERT(!(reinterpret_cast<quintptr>(out) & (preferredAlignment() - 1)));
1134 
1135  int offsetOfStringdataMember = int(m_entries.size() * 2 * sizeof(uint));
1136  int stringdataOffset = 0;
1137 
1138  // qt_metacast expects the first string in the string table to be the class name.
1139  writeString(out, /*index*/ 0, m_className, offsetOfStringdataMember, stringdataOffset);
1140 
1141  for (Entries::ConstIterator it = m_entries.constBegin(), end = m_entries.constEnd();
1142  it != end; ++it) {
1143  const int i = it.value();
1144  if (i == 0)
1145  continue;
1146  const QByteArray &str = it.key();
1147 
1148  writeString(out, i, str, offsetOfStringdataMember, stringdataOffset);
1149  }
1150 }
1151 
1152 // Returns the sum of all parameters (including return type) for the given
1153 // \a methods. This is needed for calculating the size of the methods'
1154 // parameter type/name meta-data.
1155 static int aggregateParameterCount(const std::vector<QMetaMethodBuilderPrivate> &methods)
1156 {
1157  int sum = 0;
1158  for (const auto &method : methods)
1159  sum += method.parameterCount() + 1; // +1 for return type
1160  return sum;
1161 }
1162 
1163 enum Mode {
1164  Prepare, // compute the size of the metaobject
1165  Construct // construct metaobject in pre-allocated buffer
1166 };
1167 // Build a QMetaObject in "buf" based on the information in "d".
1168 // If the mode is prepare, then return the number of bytes needed to
1169 // build the QMetaObject.
1170 template<Mode mode>
1171 static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
1172  int expectedSize)
1173 {
1174  Q_UNUSED(expectedSize); // Avoid warning in release mode
1175  Q_UNUSED(buf);
1176  qsizetype size = 0;
1177  int dataIndex;
1178  int paramsIndex;
1179  int enumIndex;
1180  int index;
1181  bool hasRevisionedMethods = d->hasRevisionedMethods();
1182 
1183  // Create the main QMetaObject structure at the start of the buffer.
1184  QMetaObject *meta = reinterpret_cast<QMetaObject *>(buf);
1185  size += sizeof(QMetaObject);
1186  ALIGN(size, int);
1187  if constexpr (mode == Construct) {
1188  meta->d.superdata = d->superClass;
1189  meta->d.relatedMetaObjects = nullptr;
1190  meta->d.extradata = nullptr;
1191  meta->d.metaTypes = nullptr;
1192  meta->d.static_metacall = d->staticMetacallFunction;
1193  }
1194 
1195  // Populate the QMetaObjectPrivate structure.
1196  QMetaObjectPrivate *pmeta
1197  = reinterpret_cast<QMetaObjectPrivate *>(buf + size);
1198  //int pmetaSize = size;
1199  dataIndex = MetaObjectPrivateFieldCount;
1200  int methodParametersDataSize =
1201  ((aggregateParameterCount(d->methods)
1202  + aggregateParameterCount(d->constructors)) * 2) // types and parameter names
1203  - int(d->methods.size()) // return "parameters" don't have names
1204  - int(d->constructors.size()); // "this" parameters don't have names
1205  if constexpr (mode == Construct) {
1206  static_assert(QMetaObjectPrivate::OutputRevision == 10, "QMetaObjectBuilder should generate the same version as moc");
1208  pmeta->flags = d->flags.toInt();
1209  pmeta->className = 0; // Class name is always the first string.
1210  //pmeta->signalCount is handled in the "output method loop" as an optimization.
1211 
1212  pmeta->classInfoCount = d->classInfoNames.size();
1213  pmeta->classInfoData = dataIndex;
1214  dataIndex += 2 * d->classInfoNames.size();
1215 
1216  pmeta->methodCount = int(d->methods.size());
1217  pmeta->methodData = dataIndex;
1218  dataIndex += QMetaObjectPrivate::IntsPerMethod * int(d->methods.size());
1219  if (hasRevisionedMethods)
1220  dataIndex += int(d->methods.size());
1221  paramsIndex = dataIndex;
1222  dataIndex += methodParametersDataSize;
1223 
1224  pmeta->propertyCount = int(d->properties.size());
1225  pmeta->propertyData = dataIndex;
1226  dataIndex += QMetaObjectPrivate::IntsPerProperty * int(d->properties.size());
1227 
1228  pmeta->enumeratorCount = int(d->enumerators.size());
1229  pmeta->enumeratorData = dataIndex;
1230  dataIndex += QMetaObjectPrivate::IntsPerEnum * int(d->enumerators.size());
1231 
1232  pmeta->constructorCount = int(d->constructors.size());
1233  pmeta->constructorData = dataIndex;
1234  dataIndex += QMetaObjectPrivate::IntsPerMethod * int(d->constructors.size());
1235  } else {
1236  dataIndex += 2 * int(d->classInfoNames.size());
1237  dataIndex += QMetaObjectPrivate::IntsPerMethod * int(d->methods.size());
1238  if (hasRevisionedMethods)
1239  dataIndex += int(d->methods.size());
1240  paramsIndex = dataIndex;
1241  dataIndex += methodParametersDataSize;
1242  dataIndex += QMetaObjectPrivate::IntsPerProperty * int(d->properties.size());
1243  dataIndex += QMetaObjectPrivate::IntsPerEnum * int(d->enumerators.size());
1244  dataIndex += QMetaObjectPrivate::IntsPerMethod * int(d->constructors.size());
1245  }
1246 
1247  // Allocate space for the enumerator key names and values.
1248  enumIndex = dataIndex;
1249  for (const auto &enumerator : d->enumerators)
1250  dataIndex += 2 * enumerator.keys.size();
1251 
1252  // Zero terminator at the end of the data offset table.
1253  ++dataIndex;
1254 
1255  // Find the start of the data and string tables.
1256  int *data = reinterpret_cast<int *>(pmeta);
1257  size += dataIndex * sizeof(int);
1258  ALIGN(size, void *);
1259  [[maybe_unused]] char *str = reinterpret_cast<char *>(buf + size);
1260  if constexpr (mode == Construct) {
1261  meta->d.stringdata = reinterpret_cast<const uint *>(str);
1262  meta->d.data = reinterpret_cast<uint *>(data);
1263  }
1264 
1265  // Reset the current data position to just past the QMetaObjectPrivate.
1266  dataIndex = MetaObjectPrivateFieldCount;
1267 
1268  QMetaStringTable strings(d->className);
1269 
1270  // Output the class infos,
1271  Q_ASSERT(!buf || dataIndex == pmeta->classInfoData);
1272  for (index = 0; index < d->classInfoNames.size(); ++index) {
1273  [[maybe_unused]] int name = strings.enter(d->classInfoNames[index]);
1274  [[maybe_unused]] int value = strings.enter(d->classInfoValues[index]);
1275  if constexpr (mode == Construct) {
1276  data[dataIndex] = name;
1277  data[dataIndex + 1] = value;
1278  }
1279  dataIndex += 2;
1280  }
1281 
1282  // Output the methods in the class.
1283  Q_ASSERT(!buf || dataIndex == pmeta->methodData);
1284  // + 1 for metatype of this metaobject
1285  int parameterMetaTypesIndex = int(d->properties.size()) + 1;
1286  for (const auto &method : d->methods) {
1287  [[maybe_unused]] int name = strings.enter(method.name());
1288  int argc = method.parameterCount();
1289  [[maybe_unused]] int tag = strings.enter(method.tag);
1290  [[maybe_unused]] int attrs = method.attributes;
1291  if constexpr (mode == Construct) {
1292  data[dataIndex] = name;
1293  data[dataIndex + 1] = argc;
1294  data[dataIndex + 2] = paramsIndex;
1295  data[dataIndex + 3] = tag;
1296  data[dataIndex + 4] = attrs;
1297  data[dataIndex + 5] = parameterMetaTypesIndex;
1298  if (method.methodType() == QMetaMethod::Signal)
1299  pmeta->signalCount++;
1300  }
1301  dataIndex += QMetaObjectPrivate::IntsPerMethod;
1302  paramsIndex += 1 + argc * 2;
1303  parameterMetaTypesIndex += 1 + argc;
1304  }
1305  if (hasRevisionedMethods) {
1306  for (const auto &method : d->methods) {
1307  if constexpr (mode == Construct)
1308  data[dataIndex] = method.revision;
1309  ++dataIndex;
1310  }
1311  }
1312 
1313  // Output the method parameters in the class.
1314  Q_ASSERT(!buf || dataIndex == pmeta->methodData + int(d->methods.size()) * QMetaObjectPrivate::IntsPerMethod
1315  + (hasRevisionedMethods ? int(d->methods.size()) : 0));
1316  for (int x = 0; x < 2; ++x) {
1317  const std::vector<QMetaMethodBuilderPrivate> &methods = (x == 0) ? d->methods : d->constructors;
1318  for (const auto &method : methods) {
1319  const QList<QByteArray> paramTypeNames = method.parameterTypes();
1320  int paramCount = paramTypeNames.size();
1321  for (int i = -1; i < paramCount; ++i) {
1322  const QByteArray &typeName = (i < 0) ? method.returnType : paramTypeNames.at(i);
1323  [[maybe_unused]] int typeInfo;
1325  typeInfo = QMetaType::fromName(typeName).id();
1326  else
1327  typeInfo = IsUnresolvedType | strings.enter(typeName);
1328  if constexpr (mode == Construct)
1329  data[dataIndex] = typeInfo;
1330  ++dataIndex;
1331  }
1332 
1333  QList<QByteArray> paramNames = method.parameterNames;
1334  while (paramNames.size() < paramCount)
1335  paramNames.append(QByteArray());
1336  for (int i = 0; i < paramCount; ++i) {
1337  [[maybe_unused]] int stringIndex = strings.enter(paramNames.at(i));
1338  if constexpr (mode == Construct)
1339  data[dataIndex] = stringIndex;
1340  ++dataIndex;
1341  }
1342  }
1343  }
1344 
1345  // Output the properties in the class.
1346  Q_ASSERT(!buf || dataIndex == pmeta->propertyData);
1347  for (QMetaPropertyBuilderPrivate &prop : d->properties) {
1348  [[maybe_unused]] int name = strings.enter(prop.name);
1349 
1350  // try to resolve the metatype again if it was unknown
1351  if (!prop.metaType.isValid())
1352  prop.metaType = QMetaType::fromName(prop.type);
1353  [[maybe_unused]] const int typeInfo = prop.metaType.isValid()
1354  ? prop.metaType.id()
1355  : IsUnresolvedType | strings.enter(prop.type);
1356 
1357  [[maybe_unused]] int flags = prop.flags;
1358 
1359  if (!QtPrivate::isBuiltinType(prop.type))
1360  flags |= EnumOrFlag;
1361 
1362  if constexpr (mode == Construct) {
1363  data[dataIndex] = name;
1364  data[dataIndex + 1] = typeInfo;
1365  data[dataIndex + 2] = flags;
1366  data[dataIndex + 3] = prop.notifySignal;
1367  data[dataIndex + 4] = prop.revision;
1368  }
1370  }
1371 
1372  // Output the enumerators in the class.
1373  Q_ASSERT(!buf || dataIndex == pmeta->enumeratorData);
1374  for (const auto &enumerator : d->enumerators) {
1375  [[maybe_unused]] int name = strings.enter(enumerator.name);
1376  [[maybe_unused]] int enumName = strings.enter(enumerator.enumName);
1377  [[maybe_unused]] int isFlag = enumerator.isFlag ? EnumIsFlag : 0;
1378  [[maybe_unused]] int isScoped = enumerator.isScoped ? EnumIsScoped : 0;
1379  int count = enumerator.keys.size();
1380  int enumOffset = enumIndex;
1381  if constexpr (mode == Construct) {
1382  data[dataIndex] = name;
1383  data[dataIndex + 1] = enumName;
1384  data[dataIndex + 2] = isFlag | isScoped;
1385  data[dataIndex + 3] = count;
1386  data[dataIndex + 4] = enumOffset;
1387  }
1388  for (int key = 0; key < count; ++key) {
1389  [[maybe_unused]] int keyIndex = strings.enter(enumerator.keys[key]);
1390  if constexpr (mode == Construct) {
1391  data[enumOffset++] = keyIndex;
1392  data[enumOffset++] = enumerator.values[key];
1393  }
1394  }
1395  dataIndex += QMetaObjectPrivate::IntsPerEnum;
1396  enumIndex += 2 * count;
1397  }
1398 
1399  // Output the constructors in the class.
1400  Q_ASSERT(!buf || dataIndex == pmeta->constructorData);
1401  for (const auto &ctor : d->constructors) {
1402  [[maybe_unused]] int name = strings.enter(ctor.name());
1403  int argc = ctor.parameterCount();
1404  [[maybe_unused]] int tag = strings.enter(ctor.tag);
1405  [[maybe_unused]] int attrs = ctor.attributes;
1406  if constexpr (mode == Construct) {
1407  data[dataIndex] = name;
1408  data[dataIndex + 1] = argc;
1409  data[dataIndex + 2] = paramsIndex;
1410  data[dataIndex + 3] = tag;
1411  data[dataIndex + 4] = attrs;
1412  data[dataIndex + 5] = parameterMetaTypesIndex;
1413  }
1414  dataIndex += QMetaObjectPrivate::IntsPerMethod;
1415  paramsIndex += 1 + argc * 2;
1416  parameterMetaTypesIndex += argc;
1417  }
1418 
1419  size += strings.blobSize();
1420 
1421  if constexpr (mode == Construct)
1422  strings.writeBlob(str);
1423 
1424  // Output the zero terminator in the data array.
1425  if constexpr (mode == Construct)
1426  data[enumIndex] = 0;
1427 
1428  // Create the relatedMetaObjects block if we need one.
1429  if (d->relatedMetaObjects.size() > 0) {
1430  using SuperData = QMetaObject::SuperData;
1431  ALIGN(size, SuperData);
1432  auto objects = reinterpret_cast<SuperData *>(buf + size);
1433  if constexpr (mode == Construct) {
1434  meta->d.relatedMetaObjects = objects;
1435  for (index = 0; index < d->relatedMetaObjects.size(); ++index)
1436  objects[index] = d->relatedMetaObjects[index];
1437  objects[index] = nullptr;
1438  }
1439  size += sizeof(SuperData) * (d->relatedMetaObjects.size() + 1);
1440  }
1441 
1443  auto types = reinterpret_cast<QtPrivate::QMetaTypeInterface **>(buf + size);
1444  if constexpr (mode == Construct) {
1445  meta->d.metaTypes = types;
1446  for (const auto &prop : d->properties) {
1447  QMetaType mt = prop.metaType;
1448  *types = reinterpret_cast<QtPrivate::QMetaTypeInterface *&>(mt);
1449  types++;
1450  }
1451  // add metatype interface for this metaobject - must be null
1452  // as we can't know our metatype
1453  *types = nullptr;
1454  types++;
1455  for (const auto &method: d->methods) {
1456  QMetaType mt(QMetaType::fromName(method.returnType).id());
1457  *types = reinterpret_cast<QtPrivate::QMetaTypeInterface *&>(mt);
1458  types++;
1459  for (const auto &parameterType: method.parameterTypes()) {
1460  QMetaType mt = QMetaType::fromName(parameterType);
1461  *types = reinterpret_cast<QtPrivate::QMetaTypeInterface *&>(mt);
1462  types++;
1463  }
1464  }
1465  for (const auto &constructor : d->constructors) {
1466  for (const auto &parameterType : constructor.parameterTypes()) {
1467  QMetaType mt = QMetaType::fromName(parameterType);
1468  *types = reinterpret_cast<QtPrivate::QMetaTypeInterface *&>(mt);
1469  types++;
1470  }
1471  }
1472  }
1473  // parameterMetaTypesIndex is equal to the total number of metatypes
1474  size += sizeof(QMetaType) * parameterMetaTypesIndex;
1475 
1476  // Align the final size and return it.
1477  ALIGN(size, void *);
1478  Q_ASSERT(!buf || size == expectedSize);
1479  return size;
1480 }
1481 
1493 {
1494  int size = buildMetaObject<Prepare>(d, nullptr, 0);
1495  char *buf = reinterpret_cast<char *>(malloc(size));
1496  memset(buf, 0, size);
1497  buildMetaObject<Construct>(d, buf, size);
1498  return reinterpret_cast<QMetaObject *>(buf);
1499 }
1500 
1516 {
1517  return d->staticMetacallFunction;
1518 }
1519 
1528 {
1529  d->staticMetacallFunction = value;
1530 }
1531 
1539 QMetaMethodBuilderPrivate *QMetaMethodBuilder::d_func() const
1540 {
1541  // Positive indices indicate methods, negative indices indicate constructors.
1542  if (_mobj && _index >= 0 && _index < int(_mobj->d->methods.size()))
1543  return &(_mobj->d->methods[_index]);
1544  else if (_mobj && -_index >= 1 && -_index <= int(_mobj->d->constructors.size()))
1545  return &(_mobj->d->constructors[(-_index) - 1]);
1546  else
1547  return nullptr;
1548 }
1549 
1559 {
1560  if (_index >= 0)
1561  return _index; // Method, signal, or slot
1562  else
1563  return (-_index) - 1; // Constructor
1564 }
1565 
1570 {
1571  QMetaMethodBuilderPrivate *d = d_func();
1572  if (d)
1573  return d->methodType();
1574  else
1575  return QMetaMethod::Method;
1576 }
1577 
1584 {
1585  QMetaMethodBuilderPrivate *d = d_func();
1586  if (d)
1587  return d->signature;
1588  else
1589  return QByteArray();
1590 }
1591 
1599 {
1600  QMetaMethodBuilderPrivate *d = d_func();
1601  if (d)
1602  return d->returnType;
1603  else
1604  return QByteArray();
1605 }
1606 
1615 {
1616  QMetaMethodBuilderPrivate *d = d_func();
1617  if (d)
1618  d->returnType = QMetaObject::normalizedType(value);
1619 }
1620 
1627 {
1628  QMetaMethodBuilderPrivate *d = d_func();
1629  if (d)
1630  return d->parameterTypes();
1631  else
1632  return QList<QByteArray>();
1633 }
1634 
1641 {
1642  QMetaMethodBuilderPrivate *d = d_func();
1643  if (d)
1644  return d->parameterNames;
1645  else
1646  return QList<QByteArray>();
1647 }
1648 
1655 {
1656  QMetaMethodBuilderPrivate *d = d_func();
1657  if (d)
1658  d->parameterNames = value;
1659 }
1660 
1667 {
1668  QMetaMethodBuilderPrivate *d = d_func();
1669  if (d)
1670  return d->tag;
1671  else
1672  return QByteArray();
1673 }
1674 
1681 {
1682  QMetaMethodBuilderPrivate *d = d_func();
1683  if (d)
1684  d->tag = value;
1685 }
1686 
1695 {
1696  QMetaMethodBuilderPrivate *d = d_func();
1697  if (d)
1698  return d->access();
1699  else
1700  return QMetaMethod::Public;
1701 }
1702 
1711 {
1712  QMetaMethodBuilderPrivate *d = d_func();
1713  if (d && d->methodType() != QMetaMethod::Signal)
1714  d->setAccess(value);
1715 }
1716 
1723 {
1724  QMetaMethodBuilderPrivate *d = d_func();
1725  if (d)
1726  return (d->attributes >> 4);
1727  else
1728  return 0;
1729 }
1730 
1737 {
1738  QMetaMethodBuilderPrivate *d = d_func();
1739  if (d)
1740  d->attributes = ((d->attributes & 0x0f) | (value << 4));
1741 }
1742 
1747 {
1748  QMetaMethodBuilderPrivate *d = d_func();
1749  if (!d)
1750  return false;
1751  return (d->attributes & MethodIsConst);
1752 }
1753 
1754 void QMetaMethodBuilder::setConst(bool methodIsConst)
1755 {
1756  QMetaMethodBuilderPrivate *d = d_func();
1757  if (!d)
1758  return;
1759  if (methodIsConst)
1760  d->attributes |= MethodIsConst;
1761  else
1762  d->attributes &= ~MethodIsConst;
1763 }
1764 
1771 {
1772  QMetaMethodBuilderPrivate *d = d_func();
1773  if (d)
1774  return d->revision;
1775  return 0;
1776 }
1777 
1784 {
1785  QMetaMethodBuilderPrivate *d = d_func();
1786  if (d) {
1787  d->revision = revision;
1788  if (revision)
1789  d->attributes |= MethodRevisioned;
1790  else
1791  d->attributes &= ~MethodRevisioned;
1792  }
1793 }
1794 
1802 QMetaPropertyBuilderPrivate *QMetaPropertyBuilder::d_func() const
1803 {
1804  if (_mobj && _index >= 0 && _index < int(_mobj->d->properties.size()))
1805  return &(_mobj->d->properties[_index]);
1806  else
1807  return nullptr;
1808 }
1809 
1827 {
1828  QMetaPropertyBuilderPrivate *d = d_func();
1829  if (d)
1830  return d->name;
1831  else
1832  return QByteArray();
1833 }
1834 
1841 {
1842  QMetaPropertyBuilderPrivate *d = d_func();
1843  if (d)
1844  return d->type;
1845  else
1846  return QByteArray();
1847 }
1848 
1855 {
1856  QMetaPropertyBuilderPrivate *d = d_func();
1857  if (d)
1858  return d->notifySignal != -1;
1859  else
1860  return false;
1861 }
1862 
1869 {
1870  QMetaPropertyBuilderPrivate *d = d_func();
1871  if (d && d->notifySignal >= 0)
1872  return QMetaMethodBuilder(_mobj, d->notifySignal);
1873  else
1874  return QMetaMethodBuilder();
1875 }
1876 
1883 {
1884  QMetaPropertyBuilderPrivate *d = d_func();
1885  if (d) {
1886  if (value._mobj) {
1887  d->notifySignal = value._index;
1888  } else {
1889  d->notifySignal = -1;
1890  }
1891  }
1892 }
1893 
1900 {
1901  QMetaPropertyBuilderPrivate *d = d_func();
1902  if (d)
1903  d->notifySignal = -1;
1904 }
1905 
1913 {
1914  QMetaPropertyBuilderPrivate *d = d_func();
1915  if (d)
1916  return d->flag(Readable);
1917  else
1918  return false;
1919 }
1920 
1928 {
1929  QMetaPropertyBuilderPrivate *d = d_func();
1930  if (d)
1931  return d->flag(Writable);
1932  else
1933  return false;
1934 }
1935 
1943 {
1944  QMetaPropertyBuilderPrivate *d = d_func();
1945  if (d)
1946  return d->flag(Resettable);
1947  else
1948  return false;
1949 }
1950 
1958 {
1959  QMetaPropertyBuilderPrivate *d = d_func();
1960  if (d)
1961  return d->flag(Designable);
1962  else
1963  return false;
1964 }
1965 
1973 {
1974  QMetaPropertyBuilderPrivate *d = d_func();
1975  if (d)
1976  return d->flag(Scriptable);
1977  else
1978  return false;
1979 }
1980 
1988 {
1989  QMetaPropertyBuilderPrivate *d = d_func();
1990  if (d)
1991  return d->flag(Stored);
1992  else
1993  return false;
1994 }
1995 
2005 {
2006  QMetaPropertyBuilderPrivate *d = d_func();
2007  if (d)
2008  return d->flag(User);
2009  else
2010  return false;
2011 }
2012 
2023 {
2024  QMetaPropertyBuilderPrivate *d = d_func();
2025  if (d)
2026  return d->flag(StdCppSet);
2027  else
2028  return false;
2029 }
2030 
2038 {
2039  QMetaPropertyBuilderPrivate *d = d_func();
2040  if (d)
2041  return d->flag(EnumOrFlag);
2042  else
2043  return false;
2044 }
2045 
2051 {
2052  QMetaPropertyBuilderPrivate *d = d_func();
2053  if (d)
2054  return d->flag(Constant);
2055  else
2056  return false;
2057 }
2058 
2064 {
2065  QMetaPropertyBuilderPrivate *d = d_func();
2066  if (d)
2067  return d->flag(Final);
2068  else
2069  return false;
2070 }
2071 
2077 {
2078  QMetaPropertyBuilderPrivate *d = d_func();
2079  if (d)
2080  return d->flag(Alias);
2081  else
2082  return false;
2083 }
2084 
2090 {
2091  if (auto d = d_func())
2092  return d->flag(Bindable);
2093  else
2094  return false;
2095 }
2096 
2103 {
2104  QMetaPropertyBuilderPrivate *d = d_func();
2105  if (d)
2106  d->setFlag(Readable, value);
2107 }
2108 
2115 {
2116  QMetaPropertyBuilderPrivate *d = d_func();
2117  if (d)
2118  d->setFlag(Writable, value);
2119 }
2120 
2127 {
2128  QMetaPropertyBuilderPrivate *d = d_func();
2129  if (d)
2130  d->setFlag(Resettable, value);
2131 }
2132 
2139 {
2140  QMetaPropertyBuilderPrivate *d = d_func();
2141  if (d)
2142  d->setFlag(Designable, value);
2143 }
2144 
2151 {
2152  QMetaPropertyBuilderPrivate *d = d_func();
2153  if (d)
2154  d->setFlag(Scriptable, value);
2155 }
2156 
2163 {
2164  QMetaPropertyBuilderPrivate *d = d_func();
2165  if (d)
2166  d->setFlag(Stored, value);
2167 }
2168 
2175 {
2176  QMetaPropertyBuilderPrivate *d = d_func();
2177  if (d)
2178  d->setFlag(User, value);
2179 }
2180 
2189 {
2190  QMetaPropertyBuilderPrivate *d = d_func();
2191  if (d)
2192  d->setFlag(StdCppSet, value);
2193 }
2194 
2202 {
2203  QMetaPropertyBuilderPrivate *d = d_func();
2204  if (d)
2205  d->setFlag(EnumOrFlag, value);
2206 }
2207 
2214 {
2215  QMetaPropertyBuilderPrivate *d = d_func();
2216  if (d)
2217  d->setFlag(Constant, value);
2218 }
2219 
2226 {
2227  QMetaPropertyBuilderPrivate *d = d_func();
2228  if (d)
2229  d->setFlag(Final, value);
2230 }
2231 
2236 {
2237  QMetaPropertyBuilderPrivate *d = d_func();
2238  if (d)
2239  d->setFlag(Alias, value);
2240 }
2241 
2246 {
2247  if (auto d = d_func())
2248  d->setFlag(Bindable, value);
2249 }
2250 
2257 {
2258  QMetaPropertyBuilderPrivate *d = d_func();
2259  if (d)
2260  return d->revision;
2261  return 0;
2262 }
2263 
2270 {
2271  QMetaPropertyBuilderPrivate *d = d_func();
2272  if (d)
2273  d->revision = revision;
2274 }
2275 
2283 QMetaEnumBuilderPrivate *QMetaEnumBuilder::d_func() const
2284 {
2285  if (_mobj && _index >= 0 && _index < int(_mobj->d->enumerators.size()))
2286  return &(_mobj->d->enumerators[_index]);
2287  else
2288  return nullptr;
2289 }
2290 
2306 {
2307  QMetaEnumBuilderPrivate *d = d_func();
2308  if (d)
2309  return d->name;
2310  else
2311  return QByteArray();
2312 }
2313 
2320 {
2321  QMetaEnumBuilderPrivate *d = d_func();
2322  if (d)
2323  return d->enumName;
2324  else
2325  return QByteArray();
2326 }
2327 
2335 {
2336  QMetaEnumBuilderPrivate *d = d_func();
2337  if (d)
2338  d->enumName = alias;
2339 }
2340 
2348 {
2349  QMetaEnumBuilderPrivate *d = d_func();
2350  if (d)
2351  return d->isFlag;
2352  else
2353  return false;
2354 }
2355 
2362 {
2363  QMetaEnumBuilderPrivate *d = d_func();
2364  if (d)
2365  d->isFlag = value;
2366 }
2367 
2374 {
2375  QMetaEnumBuilderPrivate *d = d_func();
2376  if (d)
2377  return d->isScoped;
2378  return false;
2379 }
2380 
2387 {
2388  QMetaEnumBuilderPrivate *d = d_func();
2389  if (d)
2390  d->isScoped = value;
2391 }
2392 
2399 {
2400  QMetaEnumBuilderPrivate *d = d_func();
2401  if (d)
2402  return d->keys.size();
2403  else
2404  return 0;
2405 }
2406 
2414 {
2415  QMetaEnumBuilderPrivate *d = d_func();
2416  if (d && index >= 0 && index < d->keys.size())
2417  return d->keys[index];
2418  else
2419  return QByteArray();
2420 }
2421 
2429 {
2430  QMetaEnumBuilderPrivate *d = d_func();
2431  if (d && index >= 0 && index < d->keys.size())
2432  return d->values[index];
2433  else
2434  return -1;
2435 }
2436 
2444 {
2445  QMetaEnumBuilderPrivate *d = d_func();
2446  if (d) {
2447  int index = d->keys.size();
2448  d->keys += name;
2449  d->values += value;
2450  return index;
2451  } else {
2452  return -1;
2453  }
2454 }
2455 
2462 {
2463  QMetaEnumBuilderPrivate *d = d_func();
2464  if (d && index >= 0 && index < d->keys.size()) {
2465  d->keys.removeAt(index);
2466  d->values.removeAt(index);
2467  }
2468 }
2469 
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
#define value
[5]
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:85
char * data()
qsizetype indexOf(char c, qsizetype from=0) const
QByteArray left(qsizetype len) const
bool isNull() const noexcept
qsizetype size() const noexcept
Definition: qhash.h:880
const_iterator constEnd() const noexcept
Definition: qhash.h:1162
iterator find(const Key &key)
Definition: qhash.h:1204
const_iterator constBegin() const noexcept
Definition: qhash.h:1158
friend class iterator
Definition: qhash.h:1085
iterator end() noexcept
Definition: qhash.h:1159
friend class const_iterator
Definition: qhash.h:1125
const_iterator ConstIterator
Definition: qhash.h:1202
iterator insert(const Key &key, const T &value)
Definition: qhash.h:1228
qsizetype size() const noexcept
Definition: qlist.h:414
void removeAt(qsizetype i)
Definition: qlist.h:588
const_reference at(qsizetype i) const noexcept
Definition: qlist.h:457
void append(parameter_type t)
Definition: qlist.h:469
The QMetaClassInfo class provides additional information about a class.
Definition: qmetaobject.h:362
const char * name() const
const char * value() const
QByteArray key(int index) const
QByteArray enumName() const
void removeKey(int index)
void setIsFlag(bool value)
int value(int index) const
void setIsScoped(bool value)
QByteArray name() const
int addKey(const QByteArray &name, int value)
void setEnumName(const QByteArray &alias)
QMetaEnumBuilderPrivate(const QByteArray &_name)
The QMetaEnum class provides meta-data about an enumerator.
Definition: qmetaobject.h:220
int value(int index) const
bool isFlag() const
const char * name() const
const char * key(int index) const
int keyCount() const
bool isScoped() const
const char * enumName() const
void setRevision(int revision)
void setTag(const QByteArray &value)
QMetaMethod::Access access() const
void setConst(bool methodIsConst=true)
void setAttributes(int value)
QByteArray returnType() const
QByteArray signature() const
QList< QByteArray > parameterTypes() const
QMetaMethod::MethodType methodType() const
void setAccess(QMetaMethod::Access value)
QList< QByteArray > parameterNames() const
void setReturnType(const QByteArray &value)
QByteArray tag() const
void setParameterNames(const QList< QByteArray > &value)
QList< QByteArray > parameterNames
void setAccess(QMetaMethod::Access value)
QList< QByteArray > parameterTypes() const
QMetaMethod::Access access() const
QMetaMethod::MethodType methodType() const
QMetaMethodBuilderPrivate(QMetaMethod::MethodType _methodType, const QByteArray &_signature, const QByteArray &_returnType=QByteArray("void"), QMetaMethod::Access _access=QMetaMethod::Public, int _revision=0)
The QMetaMethod class provides meta-data about a member function.
Definition: qmetaobject.h:54
QByteArray signature() const
Access access() const
const char * typeName() const
const char * tag() const
int revision() const
int attributes() const
QByteArray methodSignature() const
MethodType methodType() const
QList< QByteArray > parameterNames() const
friend class QMetaMethodBuilder
void removeConstructor(int index)
QMetaMethodBuilder addConstructor(const QByteArray &signature)
void(* StaticMetacallFunction)(QObject *, QMetaObject::Call, int, void **)
void setSuperClass(const QMetaObject *meta)
void setStaticMetacallFunction(QMetaObjectBuilder::StaticMetacallFunction value)
int relatedMetaObjectCount() const
void addMetaObject(const QMetaObject *prototype, QMetaObjectBuilder::AddMembers members=AllMembers)
QByteArray classInfoValue(int index) const
void removeClassInfo(int index)
QMetaEnumBuilder enumerator(int index) const
int addRelatedMetaObject(const QMetaObject *meta)
QMetaEnumBuilder addEnumerator(const QByteArray &name)
QMetaObject * toMetaObject() const
QByteArray classInfoName(int index) const
QByteArray className() const
void removeEnumerator(int index)
QMetaMethodBuilder addSignal(const QByteArray &signature)
friend class QMetaPropertyBuilder
void removeRelatedMetaObject(int index)
int indexOfClassInfo(const QByteArray &name)
void removeProperty(int index)
const QMetaObject * superClass() const
int indexOfConstructor(const QByteArray &signature)
int indexOfProperty(const QByteArray &name)
int indexOfMethod(const QByteArray &signature)
void removeMethod(int index)
int indexOfEnumerator(const QByteArray &name)
int indexOfSignal(const QByteArray &signature)
int addClassInfo(const QByteArray &name, const QByteArray &value)
void setFlags(MetaObjectFlags)
QMetaMethodBuilder addMethod(const QByteArray &signature)
QMetaMethodBuilder constructor(int index) const
QMetaPropertyBuilder addProperty(const QByteArray &name, const QByteArray &type, int notifierId=-1)
void setClassName(const QByteArray &name)
const QMetaObject * relatedMetaObject(int index) const
QMetaMethodBuilder method(int index) const
QMetaObjectBuilder::StaticMetacallFunction staticMetacallFunction() const
QMetaPropertyBuilder property(int index) const
QMetaMethodBuilder addSlot(const QByteArray &signature)
int indexOfSlot(const QByteArray &signature)
MetaObjectFlags flags() const
QList< QByteArray > classInfoNames
std::vector< QMetaPropertyBuilderPrivate > properties
QList< const QMetaObject * > relatedMetaObjects
const QMetaObject * superClass
std::vector< QMetaMethodBuilderPrivate > methods
std::vector< QMetaEnumBuilderPrivate > enumerators
std::vector< QMetaMethodBuilderPrivate > constructors
QMetaObjectBuilder::StaticMetacallFunction staticMetacallFunction
QList< QByteArray > classInfoValues
QMetaMethodBuilder notifySignal() const
void setRevision(int revision)
void setReadable(bool value)
void setDesignable(bool value)
void setBindable(bool value)
void setConstant(bool value)
void setScriptable(bool value)
void setEnumOrFlag(bool value)
void setWritable(bool value)
void setNotifySignal(const QMetaMethodBuilder &value)
void setStdCppSet(bool value)
void setResettable(bool value)
void setFlag(int f, bool value)
QMetaPropertyBuilderPrivate(const QByteArray &_name, const QByteArray &_type, QMetaType _metaType, int notifierIdx=-1, int _revision=0)
The QMetaProperty class provides meta-data about a property.
Definition: qmetaobject.h:277
bool hasStdCppSet() const
int revision() const
bool isUser() const
const char * typeName() const
bool isStored() const
bool isScriptable() const
QMetaType metaType() const
bool isDesignable() const
QMetaMethod notifySignal() const
bool isWritable() const
bool isConstant() const
bool isResettable() const
bool isFinal() const
bool isEnumType() const
const char * name() const
bool isReadable() const
bool hasNotifySignal() const
int enter(const QByteArray &value)
void writeBlob(char *out) const
QMetaStringTable(const QByteArray &className)
static int preferredAlignment()
The QMetaType class manages named types in the meta-object system.
Definition: qmetatype.h:328
static QMetaType fromName(QByteArrayView name)
Definition: qmetatype.cpp:2789
bool isValid() const
Definition: qmetatype.cpp:509
int id(int=0) const
Definition: qmetatype.h:453
const QChar * constData() const
Definition: qstring.h:1234
qsizetype size() const
Definition: qstring.h:413
[user-class]
Definition: user.h:59
QString str
[2]
for(n=0;n< outline->n_points;n++)
Definition: ftbbox.c:494
Q_CORE_EXPORT bool isBuiltinType(const QByteArray &type)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
EGLOutputLayerEXT EGLint EGLAttrib value
size_t quintptr
Definition: qglobal.h:310
ptrdiff_t qsizetype
Definition: qglobal.h:308
unsigned int uint
Definition: qglobal.h:334
@ MethodTypeMask
Definition: qmetaobject_p.h:96
@ MethodIsConst
@ AccessMask
Definition: qmetaobject_p.h:90
@ MethodRevisioned
@ EnumIsScoped
@ EnumIsFlag
@ Readable
Definition: qmetaobject_p.h:69
@ StdCppSet
Definition: qmetaobject_p.h:75
@ Bindable
Definition: qmetaobject_p.h:83
@ Alias
Definition: qmetaobject_p.h:73
@ Stored
Definition: qmetaobject_p.h:80
@ Designable
Definition: qmetaobject_p.h:78
@ Resettable
Definition: qmetaobject_p.h:71
@ Scriptable
Definition: qmetaobject_p.h:79
@ Constant
Definition: qmetaobject_p.h:76
@ Final
Definition: qmetaobject_p.h:77
@ EnumOrFlag
Definition: qmetaobject_p.h:72
@ Writable
Definition: qmetaobject_p.h:70
@ MetaObjectPrivateFieldCount
@ IsUnresolvedType
#define ALIGN(size, type)
Q_DECLARE_TYPEINFO(QMetaMethodBuilderPrivate, Q_RELOCATABLE_TYPE)
const char * typeName
Definition: qmetatype.cpp:869
GLenum type
Definition: qopengl.h:270
GLint GLint GLint GLint GLint x
[0]
GLenum mode
GLuint64 key
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLuint GLuint end
GLsizei GLenum GLenum * types
GLsizei const GLchar ** strings
[1]
GLenum GLenum GLsizei count
GLfloat GLfloat f
GLenum GLuint GLenum GLsizei const GLchar * buf
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLuint name
#define Q_ASSERT(cond)
Definition: qrandom.cpp:84
@ Q_RELOCATABLE_TYPE
Definition: qtypeinfo.h:156
const char className[16]
[1]
Definition: qwizard.cpp:135
Q_UNUSED(salary)
[21]
QFuture< int > sum
QStringList keys
QTextStream out(stdout)
[7]
void writeString(QCborStreamWriter &writer, const QString &str)
[8]
QStringList::Iterator it
const uint * data
Definition: qobjectdefs.h:433
StaticMetacallFunction static_metacall
Definition: qobjectdefs.h:435
const QtPrivate::QMetaTypeInterface *const * metaTypes
Definition: qobjectdefs.h:437
SuperData superdata
Definition: qobjectdefs.h:431
const uint * stringdata
Definition: qobjectdefs.h:432
const SuperData * relatedMetaObjects
Definition: qobjectdefs.h:436
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:165
QMetaClassInfo classInfo(int index) const
QMetaProperty property(int index) const
const char * className() const
static QByteArray normalizedSignature(const char *method)
int enumeratorOffset() const
QMetaEnum enumerator(int index) const
QMetaMethod constructor(int index) const
int methodOffset() const
const QMetaObject * superClass() const
Definition: qobjectdefs.h:477
struct QMetaObject::Data d
QMetaMethod method(int index) const
int constructorCount() const
static QByteArray normalizedType(const char *type)
int propertyOffset() const
int classInfoOffset() const
static QList< QByteArray > parameterTypeNamesFromSignature(const char *signature)
const char * signature
XmlOutput::xml_output tag(const QString &name)
Definition: xmloutput.h:154