diff options
-rw-r--r-- | ApiExtractor/abstractmetabuilder.cpp | 12 | ||||
-rw-r--r-- | tests/libsample/photon.cpp | 3 | ||||
-rw-r--r-- | tests/libsample/photon.h | 13 | ||||
-rw-r--r-- | tests/samplebinding/typesystem_sample.xml | 5 |
4 files changed, 33 insertions, 0 deletions
diff --git a/ApiExtractor/abstractmetabuilder.cpp b/ApiExtractor/abstractmetabuilder.cpp index a5c31bf38..564f6c3ec 100644 --- a/ApiExtractor/abstractmetabuilder.cpp +++ b/ApiExtractor/abstractmetabuilder.cpp @@ -1850,6 +1850,14 @@ void AbstractMetaBuilder::fixArgumentNames(AbstractMetaFunction* func) } } +static QString functionSignature(FunctionModelItem functionItem) +{ + QStringList args; + foreach (ArgumentModelItem arg, functionItem->arguments()) + args << arg->type().toString(); + return QString("%1(%2)").arg(functionItem->name(), args.join(",")); +} + AbstractMetaFunction* AbstractMetaBuilder::traverseFunction(FunctionModelItem functionItem) { QString functionName = functionItem->name(); @@ -1861,6 +1869,10 @@ AbstractMetaFunction* AbstractMetaBuilder::traverseFunction(FunctionModelItem fu m_rejectedFunctions.insert(className + "::" + functionName, GenerationDisabled); return 0; } + else if (TypeDatabase::instance()->isFunctionRejected(className, functionSignature(functionItem))) { + m_rejectedFunctions.insert(className + "::" + functionName, GenerationDisabled); + return 0; + } Q_ASSERT(functionItem->functionType() == CodeModel::Normal || functionItem->functionType() == CodeModel::Signal diff --git a/tests/libsample/photon.cpp b/tests/libsample/photon.cpp index b1b3328ca..ae2031c0b 100644 --- a/tests/libsample/photon.cpp +++ b/tests/libsample/photon.cpp @@ -24,6 +24,9 @@ namespace Photon { +const ClassType Base::staticType; +template <> const ClassType TemplateBase<IdentityType>::staticType; +template <> const ClassType TemplateBase<DuplicatorType>::staticType; int callCalculateForValueDuplicatorPointer(ValueDuplicator* value) { return value->calculate(); diff --git a/tests/libsample/photon.h b/tests/libsample/photon.h index f6c97b7c7..18917e26c 100644 --- a/tests/libsample/photon.h +++ b/tests/libsample/photon.h @@ -33,6 +33,7 @@ namespace Photon { enum ClassType { + BaseType = 0, IdentityType = 1, DuplicatorType = 2 }; @@ -41,9 +42,17 @@ class LIBSAMPLE_API Base { public: explicit Base(int value) : m_value(value) {} + virtual ~Base() {} inline void setValue(int value) { m_value = value; } inline int value() const { return m_value; } + + template <class T> bool isType() { return type() == T::staticType; } + bool isType(ClassType t) { return type() == t; } + protected: + virtual ClassType type() const { return BaseType; }; + static const ClassType staticType = BaseType; + int m_value; }; @@ -68,6 +77,10 @@ public: } static inline TemplateBase<CLASS_TYPE>* passPointerThrough(TemplateBase<CLASS_TYPE>* obj) { return obj; } + +protected: + virtual ClassType type() const { return CLASS_TYPE; } + static const ClassType staticType = CLASS_TYPE; }; #if defined _WIN32 || defined __CYGWIN__ diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml index dee028596..5da6ad148 100644 --- a/tests/samplebinding/typesystem_sample.xml +++ b/tests/samplebinding/typesystem_sample.xml @@ -2393,6 +2393,11 @@ <rejection class="ListUser" function-name="sumList(std::list<int>)"/> <rejection class="ListUser" function-name="sumList(std::list<double>)"/> + <!-- test rejections using full signatures; this method is a template and + cannot be wrapped, but is otherwise recognized by shiboken and will + result in a compile error if the rejection is not matched --> + <rejection class="Photon::Base" function-name="isType()"/> + <value-type name="ValueAndVirtual" /> <object-type name="ObjectTypeByValue" /> |