summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetaobjectbuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move isBuiltinType() to namespace QtPrivate and export it.Friedemann Kleint2012-11-261-4/+6
| | | | | | | | | | | There is currently a symbol clash with a duplicated isBuiltinType() in ActiveQt's dumpcpp-tool, which breaks static building. Reuse the function. Task-number: QTBUG-28131 Change-Id: I4985e8405924754aa613311ca3f06d6ba29758b8 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-231-0/+5
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Fixed uninitialized memory in QMetaObjectBuilder::fromRelocatableDataRohan McGovern2012-05-011-0/+1
| | | | | | | | | | static_metacall was never set on the metaobject written by QMetaObjectBuilder::fromRelocatableData, sometimes causing a crash. It should be initialized to 0. Change-Id: I79373d895e131f0cc2ff1af6d2177a0c1a282be7 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove QMetaObjectExtraData and put everything into QMetaObjectOlivier Goffart2012-04-251-30/+14
| | | | | | | | | | | | | | | | QMetaObjectExtraData was added when support for QMetaObject::newInstance was added. One needed a place to put the pointer to static_metacall in the QMetaObject. But as we break binary compatibility, one can change the size of QMetaObject, and put everything back inside QMetaObject's own structure. Meaning it is not required anymore to have one QMetaObjectExtraData instance per QMetaObject anymore. Change-Id: If0b8f586cbaf633eed10045adee3ba3366826c86 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-2/+2
| | | | | | | | | | | | This change fixes most qdoc errors in QtCore. There are about 900 left. The main thing this change does is moving documentation from qtcore from /doc/src to /src/corelib/doc. Other issues resolved are mis-use of qdoc commands. Change-Id: I002d01edfb13575e8bf27ce91596a577a92562d1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Introduce initializer macros for QString- and QByteArrayDataJoão Abecasis2012-04-041-1/+2
| | | | | | | | | This enables easier updating of those structs, by reducing the amount of code that needs to be fixed. The common (and known) use cases are covered by the two macros being introduced in each case. Change-Id: I44981ca9b9b034f99238a11797b30bb85471cfb7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add an assert to QMetaObjectBuilder.Jędrzej Nowacki2012-03-291-0/+1
| | | | | | | | | Constructors and destructors don't have a return value, but every other method return at least "void". Change-Id: Ie621aff83e44c187e950910d5c0684ba1a6579b8 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fallback implementation of Q_ALIGNOFJoão Abecasis2012-03-231-4/+0
| | | | | | | | | | | | For all practical purposes, the fallback introduced here returns the desired value. Having a fallback enables unconditional use of Q_ALIGNOF. For compilers that provide native support for it, Q_ALIGNOF is otherwise #defined in qcompilerdetection.h. Change-Id: Ie148ca8936cbbf8b80fe87771a14797c39a9d30c Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove support for meta-object revisions < 7Kent Hansen2012-03-221-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | | For Qt5 we no longer want to support the older revisions due to the dual codepaths that must be maintained, and because the format of the meta-object data is quite different in revision 7. The dual codepaths have been replaced by asserts that indicate the revision in which the feature was introduced, and the older-revision fallbacks have been removed. It's not possible to build code generated by moc that has revision <= 6 with Qt5 because the type of the QMetaObject::stringdata member changed from const char * to const QByteArrayData *. For the same reason it's not possible to build a dynamic meta-object generator targeting revision <= 6 with Qt5. Hence, too old meta-objects will be caught at compile time, and the code will have to be ported to generate revision 7 (e.g., by running Qt5's moc on the original class declaration). Change-Id: I33f05878a2d3ee3de53fc7009f7a367f55c25e36 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* QMetaMethod::typeName() should return "void" if the return type is voidKent Hansen2012-03-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QMetaMethod::typeName() is documented to return an empty string if the return type is void. But after the introduction of QMetaType::UnknownType (where void was made a distinct type), returning an empty string causes the idiom QMetaType::type(method.typeName()) to break; the result will be QMetaType::UnknownType rather than the expected QMetaType::Void for methods that return void. New code should use the new function QMetaMethod::returnType() instead, but it would be good if existing code still did the right thing. The consequence of returning "void" instead of an empty string is that it breaks existing logic that uses the typeName() length to determine whether a method returns void. But we judge this as the lesser of the two evils; it's better to have a typeName() function that is consistent and keeps the QMetaType::type(method.typeName()) idiom working, than to force the typeName() inconsistency for void only to keep code that does "strlen(method.typeName()) == 0" working. The places in Qt that were relying on a zero-length typeName() (testlib, dbus, declarative) have already been changed to use returnType(). Also adapt QMetaObjectBuilder, which is internal API. Change-Id: I70249174029811c5b5d2a08c24b6db33b3723d19 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Port QMetaObjectBuilder to Qt5 meta-property/method descriptor formatKent Hansen2012-02-291-77/+88
| | | | | | | | | This adapts QMOB to be in sync with the moc/meta-object changes for property and method descriptors (storing the name and argument count of methods, and more elaborate type information). Change-Id: Ia32a115643e99e39d76e46a9171219cbba522233 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Move MetaStringTable class to private headerKent Hansen2012-02-291-20/+12
| | | | | | | | | | | Rename the class to QMetaStringTable and move it to qmetaobjectbuilder_p.h. It must be exported since it will be used by the QtDBus and QtDeclarative meta-object generators. Change-Id: I08d1172fb292ab8f1e891da7f5d5f2798225c77f Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QMetaMethodBuilder::parameterTypes() functionKent Hansen2012-02-291-1/+20
| | | | | | | | | | | This function matches QMetaMethod::parameterTypes(). The implementation of QMetaMethod::parameterTypes() was moved to a helper function in QMetaObjectPrivate, so that it can be shared with QMetaMethodBuilder. Change-Id: I4361713996dc4ea31a79c2fc74c813ee5e9c3069 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Port QMetaObjectBuilder to new meta-object string data formatKent Hansen2012-02-291-33/+73
| | | | | | | | | Bring QMetaObjectBuilder up-to-date with latest moc changes (generating the string table as an array of QByteArrayData). Change-Id: I5b2f63daa687e9bc8eab10a53fab2d72e4529ea2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Rename QMetaMethod::signature() to methodSignature()Kent Hansen2012-02-291-6/+6
| | | | | | | | | | | | | | | | | | | | In Qt5 the meta-data format will be changed to not store the method signature string explicitly; the signature will be reconstructed on demand from the method name and parameter type information. The QMetaMethod::signature() method returns a const char pointer. Changing the return type to QByteArray can lead to silent bugs due to the implicit conversion to char *. Even though it's a source- incompatible change, it's therefore better to introduce a new function, methodSignature(), and remove the old signature(). Task-number: QTBUG-24154 Change-Id: Ib3579dedd27a3c7c8914d5f1b231947be2cf4027 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* qmetaobjectbuilder: Store only unique strings in the string tableKent Hansen2012-02-161-37/+53
| | | | | | | | | | | | | Do like moc: If the string has already been entered into the table, just return its position, don't make a new copy. This can save space, for example, if there are several properties of the same type; the typename only occurs once in the string table but will be referenced by several property descriptors. Change-Id: Ic0087697716cab1c6449ea51c0c758a6fd1a1c82 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Don't hardcode the number 14 in meta-object generatorsKent Hansen2012-02-161-2/+2
| | | | | | | | | | | | | 14 is the number of fields (ints) in the QMetaObjectPrivate struct as of revision 6. Use the calculated number of fields instead, so that the code will still be correct when more fields are added in future revisions. Change-Id: I4f2c2bfc125f3fabc8e8caedf5c6ba6c17a34d06 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* qmetaobjectbuilder: Add asserts to confirm validityKent Hansen2012-02-161-5/+12
| | | | | | | | | | | | | | | | | buildMetaObject() can operate in two "modes", based on whether a buffer to write the meta-object into is passed or not. Add asserts to make sure that the intermediate meta-data indexes are correct in both "modes", and that the final size in "write mode" matches the size that was computed in the preceding non-writing pass. The asserts make it easier to catch obvious problems when changing buildMetaObject() to generate a new meta-object revision. Change-Id: Ief7c74e6f6fca836587e831b06072d6aa98c7193 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* qmetaobjectbuilder: Add support for revisioned methods and propertiesKent Hansen2012-02-151-4/+126
| | | | | | | | | moc supports it, so qmetaobjectbuilder should too. Change-Id: I01475794e928b5a1b659f0dab044933948186971 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Initialize dynamic meta object extradata.Andrew den Exter2012-02-081-0/+1
| | | | | | | | | | QMetaObject::invokeMethod attempts to deference the extradata for meta objects versions 6 and greater which is causing a crash in some of the qtquick1 tests. Change-Id: If5b2ca83b15de2cd558976c6b681dd5457c404d1 Reviewed-by: Chris Adams <christopher.adams@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Bring qmetaobjectbuilder in sync with mocKent Hansen2012-02-031-1/+2
| | | | | | | | | | | | | | | | | | | qmetaobjectbuilder should generate meta-objects of the same version as moc; in the future, when the moc version is bumped, QMOB has to be adapted at the same time. QMOB was generating version 4 meta-objects. This patch makes it generate version 6 (the current version). This also fixes a bug with using qt_static_metacall with QMOB (setStaticMetacallFunction()); it was already using the version 6 qt_static_metacall signature, which isn't compatible with version 4. Also add tests that ensure that the QMOB-generated meta-object works with real objects; in particular we want to test the codepaths in Qt that check for version >= 4. Change-Id: I64a151ea5c947a6f8b7a00e85a39866446c735e9 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Avoid duplicating flags/types in qmetaobjectbuilderKent Hansen2012-02-021-57/+3
| | | | | | | | | | | Presumably the contents from qmetaobject_p.h were copied because qmetaobjectbuilder originally lived outside of qtbase, and private headers could not be included from other modules. But now we can just include the right headers. Change-Id: I975df1ea94455f1bf0db1d8024de8f5379fc9fc7 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Get rid of checks for Qt3 typesKent Hansen2012-01-291-9/+0
| | | | | | | | | | | | | | These types don't exist anymore, so it's pointless to check for them. Also remove the dead types from uic's type-to-header map. Change-Id: I7f0af5c337859f3da1c103157a802bbe5372df9f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* moc: Use QMetaType::QVariant as the type for QVariantKent Hansen2012-01-251-2/+0
| | | | | | | | | | | | | | | | | | | QMetaType::QVariant has existed as a proper type for almost two years, but the qvariant_nameToType function was written in 2006. Using QMetaType::QVariant means QVariant can be treated just like any other type. We can get rid of those hacky checks for LastType, and the remaining checks become more readable. The fact that QMetaProperty::{type,userType}() returned LastType (0xffffffff) for QVariants was never documented (LastType itself is internal). But there are other Qt modules that assume so. I'll fix the ones I know about (qtdeclarative, qtscript, activeqt). Change-Id: I799b9079bb8bbb1fe76c132525440b30415cbac5 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Included stdlib.h to allow malloc() usageRafael Roquetto2012-01-251-0/+2
| | | | | | | | Depending on indirect inclusion was a mistake and caused compilation to break on the QNX (BlackBerry NDK 2) target. Change-Id: I447aec68bfe02447639a096c0c2f928bd4381cd9 Reviewed-by: David Faure <david.faure@kdab.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove the Q_NO_DATA_RELOCATION hackOlivier Goffart2012-01-131-29/+0
| | | | | | | | | | | | | | This hack was there because symbian used to have a problem with relocations in the data section, between libraries. Hence, this was needed so the metaobject could have a pointer to the base metaobject, despite being in another library. Anyway, I was told that symbian was fixed eventually. but the hack had to stay there because of compatibility. But now that we don't even support symbian, we can get rid of this hack totally. Change-Id: I7249971ece35d952efa92bf8b04bf3aa3667624c Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Remove all non-inline of qMalloc/qFree/qRealloc.Robin Burchell2012-01-061-2/+2
| | | | | | | | | | | | We're trying to deprecate these, so don't use them anymore. The inline uses of these have been left intact, for the moment. Inline code will need to create their own non-inline allocation methods (for future-proofing to allow alterations in how e.g. individual containers allocate) Change-Id: I1071a487c25e95b7bb81a3327b20c5481fb5ed22 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* add qmetaobjectbuilder to qtbase.Lorn Potter2011-10-111-0/+2605
Use the QMetaObjectBuilder code from declarative and add it to libQtCore. Consolidating various QMetaObjectBuilder implimentations to avoid code duplications in those modules. This is currently still a private API only. Change-Id: Ie363b4fd769c41efbb3caa7fb1d6f77af13c3c9c Reviewed-on: http://codereview.qt-project.org/6287 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Alex <alex.blasche@nokia.com>