42 #include "private/qmetaobjectbuilder_p.h" 84 if (strcmp(name,
"QVariant") == 0)
86 if (strcmp(name,
"QCString") == 0)
88 if (strcmp(name,
"Q_LLONG") == 0)
90 if (strcmp(name,
"Q_ULLONG") == 0)
92 if (strcmp(name,
"QIconSet") == 0)
177 attributes(((
int)_access) | (((
int)_methodType) << 2))
199 attributes = ((attributes & ~
AccessMask) | (
int)value);
212 if (notifierIdx >= 0) {
214 notifySignal = notifierIdx;
225 return ((flags & f) != 0);
241 :
name(_name), isFlag(false)
258 staticMetacallFunction = 0;
270 #ifdef Q_NO_DATA_RELOCATION 301 addMetaObject(prototype, members);
343 return d->superClass;
356 d->superClass = meta;
390 return d->methods.size();
400 return d->constructors.size();
411 return d->properties.size();
423 return d->enumerators.size();
435 return d->classInfoNames.size();
451 return d->relatedMetaObjects.size();
464 int index =
d->methods.size();
482 int index =
d->methods.size();
503 method = addMethod(prototype.
signature());
505 method = addSignal(prototype.
signature());
509 method = addConstructor(prototype.
signature());
528 int index =
d->methods.size();
543 int index =
d->methods.size();
560 int index =
d->constructors.size();
582 ctor.setTag(prototype.
tag());
583 ctor.setAccess(prototype.
access());
600 int index =
d->properties.size();
621 property.setStored(prototype.
isStored());
623 property.setUser(prototype.
isUser());
625 property.setEnumOrFlag(prototype.
isEnumType());
627 property.setFinal(prototype.
isFinal());
633 index = addMethod(method).index();
634 d->properties[
property._index].notifySignal =
index;
635 d->properties[
property._index].setFlag(
Notify,
true);
650 int index =
d->enumerators.size();
683 int index =
d->classInfoNames.size();
684 d->classInfoNames +=
name;
685 d->classInfoValues += value;
700 #ifdef Q_NO_DATA_RELOCATION 707 int index =
d->relatedMetaObjects.size();
708 d->relatedMetaObjects.append(meta);
720 (
const QMetaObject *prototype, QMetaObjectBuilder::AddMembers members)
725 if ((members & ClassName) != 0)
728 if ((members & SuperClass) != 0)
731 if ((members & (Methods | Signals | Slots)) != 0) {
745 (members & Signals) != 0) {
748 (members & Slots) != 0) {
754 if ((members & Constructors) != 0) {
759 if ((members & Properties) != 0) {
761 addProperty(prototype->
property(index));
764 if ((members & Enumerators) != 0) {
769 if ((members & ClassInfos) != 0) {
776 if ((members & RelatedMetaObjects) != 0) {
777 #ifdef Q_NO_DATA_RELOCATION 793 while (*objects != 0) {
794 addRelatedMetaObject(*objects);
800 if ((members & StaticMetacall) != 0) {
817 if (index >= 0 && index < d->methods.size())
830 if (index >= 0 && index < d->constructors.size())
843 if (index >= 0 && index < d->
properties.size())
857 if (index >= 0 && index < d->enumerators.size())
875 if (index >= 0 && index < d->relatedMetaObjects.size())
876 #ifdef Q_NO_DATA_RELOCATION
877 return &((*(
d->relatedMetaObjects[index]))());
879 return d->relatedMetaObjects[
index];
894 if (index >= 0 && index < d->classInfoNames.size())
895 return d->classInfoNames[index];
909 if (index >= 0 && index < d->classInfoValues.size())
910 return d->classInfoValues[index];
925 if (index >= 0 && index < d->methods.size()) {
926 d->methods.removeAt(index);
927 for (
int prop = 0; prop <
d->properties.size(); ++prop) {
929 if (
d->properties[prop].notifySignal == index) {
930 d->properties[prop].notifySignal = -1;
931 d->properties[prop].setFlag(
Notify,
false);
932 }
else if (
d->properties[prop].notifySignal > index)
933 (
d->properties[prop].notifySignal)--;
947 if (index >= 0 && index < d->constructors.size())
948 d->constructors.removeAt(index);
959 if (index >= 0 && index < d->
properties.size())
960 d->properties.removeAt(index);
972 if (index >= 0 && index < d->enumerators.size())
973 d->enumerators.removeAt(index);
985 if (index >= 0 && index < d->classInfoNames.size()) {
986 d->classInfoNames.removeAt(index);
987 d->classInfoValues.removeAt(index);
1005 if (index >= 0 && index < d->relatedMetaObjects.size())
1006 d->relatedMetaObjects.removeAt(index);
1019 if (sig ==
d->methods[
index].signature)
1035 if (sig ==
d->methods[
index].signature &&
1052 if (sig ==
d->methods[
index].signature &&
1069 if (sig ==
d->constructors[
index].signature)
1084 if (name ==
d->properties[
index].name)
1099 if (name ==
d->enumerators[
index].name)
1115 if (name ==
d->classInfoNames[
index])
1122 #define ALIGN(size,type) \ 1123 (size) = ((size) + sizeof(type) - 1) & ~(sizeof(type) - 1) 1128 (
char *buf,
char *str,
int *offset,
const QByteArray& value,
int empty)
1130 if (value.
size() == 0 && empty >= 0)
1134 str[*offset + value.
size()] =
'\0';
1137 *offset += value.
size() + 1;
1146 if (!parameterNames.
isEmpty()) {
1149 foreach (
const QByteArray &name, parameterNames) {
1164 if (index >= signature.
size())
1166 if (signature[index] ==
')')
1170 while (index < signature.
size() && signature[
index] !=
',') {
1171 char ch = signature[index++];
1176 else if (ch ==
',' && brackets <= 0)
1193 bool hasNotifySignals =
false;
1211 int pmetaSize = size;
1214 if (d->
properties[index].notifySignal != -1) {
1215 hasNotifySignals =
true;
1235 if (hasNotifySignals)
1249 if (hasNotifySignals)
1256 enumIndex = dataIndex;
1259 dataIndex += 2 * enumerator->
keys.
size();
1266 int *
data =
reinterpret_cast<int *
>(pmeta);
1267 size += dataIndex *
sizeof(int);
1268 char *str =
reinterpret_cast<char *
>(buf + size);
1295 data[dataIndex] =
name;
1296 data[dataIndex + 1] = value;
1308 params =
buildString(buf, str, &offset, names, empty);
1313 data[dataIndex] = sig;
1314 data[dataIndex + 1] = params;
1315 data[dataIndex + 2] = ret;
1316 data[dataIndex + 3] = tag;
1317 data[dataIndex + 4] = attrs;
1336 data[dataIndex] =
name;
1337 data[dataIndex + 1] =
type;
1338 data[dataIndex + 2] =
flags;
1342 if (hasNotifySignals) {
1349 data[dataIndex] = 0;
1359 int isFlag = (int)(enumerator->
isFlag);
1360 int count = enumerator->
keys.
size();
1361 int enumOffset = enumIndex;
1363 data[dataIndex] =
name;
1364 data[dataIndex + 1] = isFlag;
1365 data[dataIndex + 2] = count;
1366 data[dataIndex + 3] = enumOffset;
1371 data[enumOffset++] = keyIndex;
1372 data[enumOffset++] = enumerator->
values[
key];
1376 enumIndex += 2 * count;
1386 params =
buildString(buf, str, &offset, names, empty);
1391 data[dataIndex] = sig;
1392 data[dataIndex + 1] = params;
1393 data[dataIndex + 2] = ret;
1394 data[dataIndex + 3] = tag;
1395 data[dataIndex + 4] = attrs;
1406 data[enumIndex] = 0;
1416 #ifdef Q_NO_DATA_RELOCATION 1421 reinterpret_cast<const QMetaObject **
>(buf + size);
1433 meta->
d.
extradata =
reinterpret_cast<void *
>(extra);
1440 ALIGN(size,
void *);
1457 char *buf =
reinterpret_cast<char *
>(
qMalloc(size));
1458 memset(buf, 0, size);
1481 if (ok) *ok =
false;
1487 char *buf = data.
data();
1488 memset(buf, 0, size);
1516 output->
d.
data =
reinterpret_cast<const uint *
>(buf + dataOffset);
1538 return d->staticMetacallFunction;
1550 d->staticMetacallFunction = value;
1553 #ifndef QT_NO_DATASTREAM 1565 stream <<
d->className;
1572 stream <<
d->classInfoNames.size();
1573 stream <<
d->methods.size();
1574 stream <<
d->properties.size();
1575 stream <<
d->enumerators.size();
1576 stream <<
d->constructors.size();
1577 stream <<
d->relatedMetaObjects.size();
1580 for (index = 0; index <
d->classInfoNames.size(); ++
index) {
1581 stream <<
d->classInfoNames[
index];
1582 stream <<
d->classInfoValues[
index];
1586 for (index = 0; index <
d->methods.size(); ++
index) {
1591 stream << method->
tag;
1596 for (index = 0; index <
d->properties.size(); ++
index) {
1598 stream <<
property->name;
1599 stream <<
property->type;
1600 stream <<
property->flags;
1601 stream <<
property->notifySignal;
1605 for (index = 0; index <
d->enumerators.size(); ++
index) {
1607 stream << enumerator->
name;
1608 stream << enumerator->
isFlag;
1609 stream << enumerator->
keys;
1610 stream << enumerator->
values;
1614 for (index = 0; index <
d->constructors.size(); ++
index) {
1619 stream << method->
tag;
1624 #ifdef Q_NO_DATA_RELOCATION 1627 for (index = 0; index <
d->relatedMetaObjects.size(); ++
index) {
1629 stream << QByteArray(meta->
className());
1636 stream << QByteArray();
1647 return references.
value(name, 0);
1676 d->className.clear();
1678 d->classInfoNames.clear();
1679 d->classInfoValues.clear();
1681 d->properties.clear();
1682 d->enumerators.clear();
1683 d->constructors.clear();
1684 d->relatedMetaObjects.clear();
1685 d->staticMetacallFunction = 0;
1688 stream >>
d->className;
1690 if (name.isEmpty()) {
1707 stream >> relatedMetaObjectCount;
1708 if (classInfoCount < 0 || methodCount < 0 ||
1709 propertyCount < 0 || enumeratorCount < 0 ||
1710 constructorCount < 0 || relatedMetaObjectCount < 0) {
1722 addClassInfo(name, value);
1734 stream >> method->
tag;
1750 addProperty(name, type);
1752 stream >>
property->flags;
1753 stream >>
property->notifySignal;
1755 property->notifySignal >=
d->methods.size()) {
1773 addEnumerator(name);
1775 stream >> enumerator->
isFlag;
1776 stream >> enumerator->
keys;
1777 stream >> enumerator->
values;
1790 addConstructor(name);
1794 stream >> method->
tag;
1804 #ifdef Q_NO_DATA_RELOCATION 1807 for (index = 0; index < relatedMetaObjectCount; ++
index) {
1816 addRelatedMetaObject(cl);
1824 #endif // !QT_NO_DATASTREAM 1838 if (_mobj && _index >= 0 && _index < _mobj->
d->methods.size())
1839 return &(_mobj->d->methods[_index]);
1840 else if (_mobj && -_index >= 1 && -_index <= _mobj->
d->constructors.size())
1841 return &(_mobj->d->constructors[(-_index) - 1]);
1859 return (-_index) - 1;
2037 if (_mobj && _index >= 0 && _index < _mobj->
d->properties.size())
2038 return &(_mobj->d->properties[_index]);
2486 if (_mobj && _index >= 0 && _index < _mobj->
d->enumerators.size())
2487 return &(_mobj->d->enumerators[_index]);
2568 if (d && index >= 0 && index < d->
keys.
size())
2569 return d->
keys[index];
2583 if (d && index >= 0 && index < d->
keys.
size())
2616 if (d && index >= 0 && index < d->
keys.
size()) {
Status status() const
Returns the status of the data stream.
QIntegerForSizeof< void * >::Unsigned quintptr
#define QT_END_NAMESPACE
This macro expands to.
char * data()
Returns a pointer to the data stored in the byte array.
The QByteArray class provides an array of bytes.
static const QMetaObject staticMetaObject
This variable stores the meta-object for the class.
void setStatus(Status status)
Sets the status of the data stream to the status given.
Q_CORE_EXPORT void * qMalloc(size_t size)
const QMetaObject &(* QMetaObjectAccessor)()
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
#define QT_BEGIN_NAMESPACE
This macro expands to.
const T value(const Key &key) const
Returns the value associated with the key key.
static const char * data(const QByteArray &arr)
int indexOf(char c, int from=0) const
Returns the index position of the first occurrence of the character ch in the byte array...
const char * constData() const
Returns a pointer to the data stored in the byte array.
static QByteArray prototype(const QList< QByteArray > ¶meterTypes, const QList< QByteArray > ¶meterNames, bool *ok)
void resize(int size)
Sets the size of the byte array to size bytes.
int size() const
Returns the number of items in the list.
int size() const
Returns the number of bytes in this byte array.
static const QCssKnownValue properties[NumProperties - 1]
The QDataStream class provides serialization of binary data to a QIODevice.
The QMap class is a template class that provides a skip-list-based dictionary.
void removeAt(int i)
Removes the item at index position i.