From 4889efc199243af54cf71accffb3f9554cba933d Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Fri, 23 Dec 2011 15:10:17 -0300 Subject: Added the "" tag, and better requirements for function signatures. Trying to find a non-qualified (without scope information) class, found in a function signature or return type, was a bad idea for it makes the parsing awfully slow when dealing with huge libraries. If the user writes a type in short form in a function signature (e.g. "SomeClass", instead of "Namespace::SomeClass"), APIExtractor will exit with a message indicating the error and the possible candidates for the type. The "" tag is for types of the target language ("PyObject" in Python, for instance) and will be handled by the generator. Reviewed by Hugo Parente Reviewed by Paulo Alcantara --- abstractmetabuilder.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'abstractmetabuilder.cpp') diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp index abdf5c70a..1d01e9ce2 100644 --- a/abstractmetabuilder.cpp +++ b/abstractmetabuilder.cpp @@ -2018,8 +2018,25 @@ AbstractMetaType* AbstractMetaBuilder::translateType(double vr, const AddedFunct } if (!type) { - type = new TypeEntry(typeInfo.name, TypeEntry::CustomType, vr); - typeDb->addType(type); + QStringList candidates; + SingleTypeEntryHash entries = typeDb->entries(); + foreach (QString candidate, entries.keys()) { + // Let's try to find the type in different scopes. + if (candidate.endsWith("::"+typeName)) + candidates << candidate; + } + + QString msg = QString("Type '%1' wasn't found in the type database.\n").arg(typeName); + + if (candidates.isEmpty()) + qFatal(qPrintable(QString(msg + "Declare it in the type system using the proper <*-type> tag.")), NULL); + + msg += "Remember to inform the full qualified name for the type you want to use.\nCandidates are:\n"; + candidates.sort(); + foreach (const QString& candidate, candidates) { + msg += " " + candidate + "\n"; + } + qFatal(qPrintable(msg), NULL); } AbstractMetaType* metaType = createMetaType(); -- cgit v1.2.3