summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2010-03-19 14:48:54 -0300
committerHugo Lima <hugo.lima@openbossa.org>2010-03-19 14:48:54 -0300
commit42fd70af65f843853df851657f175351c072ff76 (patch)
treee077719c4af2e2989411f4cfe7afaf4d6a532f53
parentdeca7c24a273857d6bc3f735fdea863265a2bc1f (diff)
downloadshiboken-42fd70af65f843853df851657f175351c072ff76.tar.gz
shiboken-42fd70af65f843853df851657f175351c072ff76.tar.xz
shiboken-42fd70af65f843853df851657f175351c072ff76.zip
Allow hash-function tag to be definied in object-types (Fix bug #186).
-rw-r--r--shibokengenerator.cpp5
-rw-r--r--tests/libsample/objecttype.cpp5
-rw-r--r--tests/libsample/objecttype.h2
-rw-r--r--tests/samplebinding/typesystem_sample.xml2
4 files changed, 12 insertions, 2 deletions
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp
index 4fd54f74..d14535cd 100644
--- a/shibokengenerator.cpp
+++ b/shibokengenerator.cpp
@@ -303,7 +303,10 @@ static QString baseConversionString(QString typeName)
void ShibokenGenerator::writeBaseConversion(QTextStream& s, const TypeEntry* type)
{
- s << baseConversionString(type->name());
+ QString typeName = type->name();
+ if (type->isObject())
+ typeName.append('*');
+ s << baseConversionString(typeName);
}
void ShibokenGenerator::writeBaseConversion(QTextStream& s, const AbstractMetaType* type,
diff --git a/tests/libsample/objecttype.cpp b/tests/libsample/objecttype.cpp
index 0fd31265..d5bdace1 100644
--- a/tests/libsample/objecttype.cpp
+++ b/tests/libsample/objecttype.cpp
@@ -221,3 +221,8 @@ ObjectTypeLayout* ObjectType::takeLayout()
return l;
}
+unsigned int objectTypeHash(const ObjectType* objectType)
+{
+ return reinterpret_cast<std::size_t>(objectType);
+}
+
diff --git a/tests/libsample/objecttype.h b/tests/libsample/objecttype.h
index 3fe606de..3679b3b7 100644
--- a/tests/libsample/objecttype.h
+++ b/tests/libsample/objecttype.h
@@ -108,5 +108,7 @@ private:
ObjectTypeLayout* m_layout;
};
+LIBSAMPLE_API unsigned int objectTypeHash(const ObjectType* objectType);
+
#endif // OBJECTTYPE_H
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 77d10ef8..05306f68 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -64,7 +64,7 @@
<object-type name="Derived" polymorphic-id-expression="%1->type() == Derived::TpDerived" />
<value-type name="Derived::SomeInnerClass" />
- <object-type name="ObjectType">
+ <object-type name="ObjectType" hash-function="objectTypeHash">
<modify-function signature="event(Event*)">
<modify-argument index="1" invalidate-after-use="yes"/>
</modify-function>