aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/tests/libother/otherobjecttype.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-08-14 11:27:03 -0300
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-12-03 19:49:12 +0100
commit1f62b260daa7f2f456c7297b49e5fc1011f073e5 (patch)
tree164783e6a753c70545ca61db9d24ef4ea15dd5f7 /sources/shiboken2/tests/libother/otherobjecttype.cpp
parent0a438ec2fa02bbb0555615e518e7ea249510a5ae (diff)
shiboken: Fix classes in hidden namespaces
There was an existing functionality to hide namespaces when specifying generate="no" on namespace-type which did not work for classes. In addition, it was implemented using the generation attributes of TypeEntry. This is problematic since dependent typesystems are loaded with generate="no", which actually means that no code should be generated for them. To fix this, introduce a new "visible" attribute for namespaces which also accommodates for hiding C++ 11 inline namespaces. Some projects uses the namespaces as packagename while creating python bindings, and to avoid duplicate names they ignore the original c++ namespace. For example a class like that: namespace Qt3D { class Vector; } The namespace "Qt3D" will be used as package name so the namespace "Qt3D" should be ignored during the generation, otherwise the 'Vector' type will be represented by 'Qt3D.Qt3D.Vector' and that is not what we want. Initial-patch-by: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> Fixes: PYSIDE-1074 Change-Id: I3fd391ac3d839d3f8f510c6a4d4000f7d92eacff Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/tests/libother/otherobjecttype.cpp')
-rw-r--r--sources/shiboken2/tests/libother/otherobjecttype.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/sources/shiboken2/tests/libother/otherobjecttype.cpp b/sources/shiboken2/tests/libother/otherobjecttype.cpp
index ca356ce94..1f782ecd8 100644
--- a/sources/shiboken2/tests/libother/otherobjecttype.cpp
+++ b/sources/shiboken2/tests/libother/otherobjecttype.cpp
@@ -34,3 +34,13 @@ operator<<(Collector& collector, const OtherObjectType& obj)
collector << obj.identifier()*2;
return collector;
}
+
+int OtherObjectType::enumAsInt(SampleNamespace::SomeClass::PublicScopedEnum value)
+{
+ return static_cast<int>(value);
+}
+
+int OtherObjectType::enumAsIntForInvisibleNamespace(Invisible::EnumOnNamespace value)
+{
+ return static_cast<int>(value);
+}