aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/samplebinding/typesystem_sample.xml
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/tests/samplebinding/typesystem_sample.xml')
-rw-r--r--sources/shiboken6/tests/samplebinding/typesystem_sample.xml114
1 files changed, 77 insertions, 37 deletions
diff --git a/sources/shiboken6/tests/samplebinding/typesystem_sample.xml b/sources/shiboken6/tests/samplebinding/typesystem_sample.xml
index 7583a900a..e315e599e 100644
--- a/sources/shiboken6/tests/samplebinding/typesystem_sample.xml
+++ b/sources/shiboken6/tests/samplebinding/typesystem_sample.xml
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<typesystem package="sample">
- <suppress-warning text="Duplicate type entry: 'sample'" />
- <suppress-warning text="Duplicate type entry: 'SampleNamespace'" />
-
<primitive-type name="ObjectType::Identifier"/>
<primitive-type name="std::nullptr_t"/>
- <primitive-type name="Foo::HANDLE" target-lang-api-name="PyLong"/>
+ <primitive-type name="Foo::SAMPLE_HANDLE" target-lang-api-name="PyLong"/>
<primitive-type name="std::size_t" target-lang-api-name="PyLong">
<conversion-rule>
@@ -74,7 +71,7 @@
</conversion-rule>
</primitive-type>
- <primitive-type name="HANDLE" target-lang-api-name="PyComplex">
+ <primitive-type name="SAMPLE_HANDLE" target-lang-api-name="PyComplex">
<include file-name="handle.h" location="local"/>
<conversion-rule>
<native-to-target>
@@ -84,6 +81,7 @@
</native-to-target>
<target-to-native>
<add-conversion type="PyNone">
+ SBK_UNUSED(%in)
%out = 0;
</add-conversion>
<add-conversion check="checkPyCapsuleOrPyCObject(%in)" type="PyObject">
@@ -168,6 +166,7 @@
%out = %OUTTYPE(str);
</add-conversion>
<add-conversion type="Py_None">
+ SBK_UNUSED(%in)
%out = %OUTTYPE();
</add-conversion>
</target-to-native>
@@ -256,6 +255,7 @@
<add-function signature="getPythonType(const char*)" return-type="PyObject">
<inject-code class="target" position="beginning">
+ SBK_UNUSED(self)
%PYARG_0 = (PyObject*) Shiboken::Conversions::getPythonTypeObject(%1);
if (!%PYARG_0)
%PYARG_0 = Py_None;
@@ -397,6 +397,7 @@
<function signature="returnNullValueTypePointer()" />
<function signature="returnNullObjectTypePointer()" />
<function signature="acceptInt(int)" />
+ <function signature="acceptIntReturnPtr(int)"/>
<function signature="acceptUInt(unsigned int)" />
<function signature="acceptLong(long)" />
<function signature="acceptULong(unsigned long)" />
@@ -418,6 +419,8 @@
<function signature="addStdStrings(const std::string&amp;, const std::string&amp;)"/>
<function signature="addStdWStrings(const std::wstring&amp;, const std::wstring&amp;)"/>
<function signature="testNullPtrT(std::nullptr_t)"/>
+ <function signature="takePolygon(Polygon&amp;&amp;)"/>
+ <function signature="takeObjectType(ObjectType&amp;&amp;)"/>
<value-type name="ArrayModifyTest">
<modify-function signature="sumIntArray(int, int*)">
@@ -426,7 +429,7 @@
</value-type>
<value-type name="ClassWithFunctionPointer">
- <suppress-warning text="skipping function 'ClassWithFunctionPointer::callFunctionPointer', unmatched parameter type 'void (*)(void*)'" />
+ <suppress-warning text="^skipping public function 'void ClassWithFunctionPointer::callFunctionPointer.*$" />
</value-type>
<value-type name="IntArray" generate="no"/>
@@ -454,6 +457,10 @@
<enum-type identified-by-value="AnonymousGlobalEnum_Value0"/>
<namespace-type name="SampleNamespace">
+ <namespace-type name="InlineNamespace">
+ <value-type name="ClassWithinInlineNamespace"/>
+ <enum-type name="EnumWithinInlineNamespace"/>
+ </namespace-type>
<enum-type name="Option"/>
<enum-type name="InValue"/>
<enum-type name="OutValue"/>
@@ -564,6 +571,14 @@
<modify-function signature="hideFunction(HideType*)" remove="all"/>
<modify-field name="toBeRenamedField" rename="renamedField"/>
<modify-field name="readOnlyField" write="false"/>
+ <modify-function signature="virtualWithOutParameter(int&amp;)const">
+ <inject-code class="shell" position="override">
+ x = virtualWithOutParameterPyOverride(gil, pyOverride.object());
+ return;
+ </inject-code>
+ </modify-function>
+ <add-function signature="virtualWithOutParameterPyOverride()"
+ return-type="int" python-override="true"/>
</object-type>
<object-type name="Derived" polymorphic-id-expression="%1->type() == Derived::TpDerived">
@@ -626,8 +641,8 @@
// CHECKTYPE and ISCONVERTIBLE are used here for test purposes, don't change them.
if (!%CHECKTYPE[ObjectTypeLayout*](layout) &amp;&amp; !%ISCONVERTIBLE[ObjectTypeLayout*](layout))
return;
- // %CHECKTYPE[ObjectTypeLayout*](layout)
- // %ISCONVERTIBLE[ObjectTypeLayout*](layout)
+ /* %CHECKTYPE[ObjectTypeLayout*](layout) */
+ /* %ISCONVERTIBLE[ObjectTypeLayout*](layout) */
ObjectTypeLayout* var;
var = %CONVERTTOCPP[ObjectTypeLayout*](layout);
// TODO-CONVERTER: erase this
@@ -714,7 +729,7 @@
</modify-function>
</object-type>
- <value-type name="ObjectTypeHolder"/>
+ <object-type name="ObjectTypeHolder"/>
<value-type name="OnlyCopy"/>
<value-type name="FriendOfOnlyCopy"/>
@@ -1385,7 +1400,7 @@
}
</template>
<modify-function signature="getMargins(int*,int*,int*,int*)const">
- <modify-argument index="0">
+ <modify-argument index="return" pyi-type="Tuple[int, int, int, int]">
<replace-type modified-type="PyObject" />
</modify-argument>
<modify-argument index="1">
@@ -1887,13 +1902,13 @@
</value-type>
<value-type name="Size">
+ <extra-includes>
+ <include file-name="string" location="global"/>
+ <include file-name="sstream" location="global"/>
+ </extra-includes>
<add-function signature="Size(const char*)">
- <inject-code class="target" position="beginning">
- %0 = new %TYPE();
- </inject-code>
- <inject-code class="target" position="end">
- Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF, const_cast&lt;char*>("setHeight"), const_cast&lt;char*>("i"), 2));
- </inject-code>
+ <inject-code class="target" position="beginning"
+ file="samplesnippets.cpp" snippet="size_char_ct"/>
</add-function>
</value-type>
<value-type name="SizeF"/>
@@ -2058,6 +2073,7 @@
<conversion-rule>
<target-to-native>
<add-conversion type="Py_None">
+ SBK_UNUSED(%in)
%out = %OUTTYPE();
</add-conversion>
<add-conversion type="PyObject" check="Shiboken::String::check(%in) || PyBytes_Check(%in)">
@@ -2209,19 +2225,20 @@
</add-function>
</value-type>
- <value-type name="SimpleFile">
+ <object-type name="SimpleFile">
<modify-function signature="open()">
<modify-argument index="return">
<remove-argument/>
</modify-argument>
<inject-code class="target" position="end" file="simplefile_glue.cpp"/>
</modify-function>
- </value-type>
+ </object-type>
<value-type name="VoidHolder" />
<object-type name="PrivateCtor" />
<object-type name="PrivateDtor" />
+ <value-type name="DeletedDefaultCtor"/>
<object-type name="Base1"/>
<object-type name="Base2"/>
@@ -2362,15 +2379,24 @@
<value-type name="Expression" />
- <object-type name="ExceptionTest" exception-handling="auto-on"/>
-
- <value-type name="ModelIndex" />
- <value-type name="ReferentModelIndex">
- <modify-function signature="operator const ModelIndex&amp;()const">
+ <object-type name="ExceptionTest" exception-handling="auto-on">
+ <modify-function signature="create(bool)">
<modify-argument index="return">
<define-ownership owner="c++"/>
</modify-argument>
+ <inject-code class="target" position="end">
+ // Test comment
+ </inject-code>
</modify-function>
+ </object-type>
+
+ <value-type name="ModelIndex" />
+ <value-type name="ReferentModelIndex">
+ <modify-function signature="operator const ModelIndex&amp;()const">
+ <modify-argument index="return">
+ <define-ownership owner="c++"/>
+ </modify-argument>
+ </modify-function>
</value-type>
<value-type name="PersistentModelIndex" />
@@ -2383,6 +2409,31 @@
<object-type name="ObjectTypeByValue" />
+ <value-type name="StdComplex">
+ <extra-includes>
+ <include file-name="cmath" location="global"/>
+ </extra-includes>
+ <!-- PYSIDE-2446: number protocols without a Py_nb_ constant. -->
+ <add-function signature="__floor__()" return-type="double">
+ <inject-code class="target" position="end"
+ file="samplesnippets.cpp" snippet="stdcomplex_floor"/>
+ </add-function>
+ <add-function signature="__ceil__()" return-type="double">
+ <inject-code class="target" position="end"
+ file="samplesnippets.cpp" snippet="stdcomplex_ceil"/>
+ </add-function>
+ <!-- PYSIDE-2446: number protocols with Py_nb_ constants. -->
+ <add-function signature="__abs__()" return-type="double">
+ <inject-code class="target" position="end"
+ file="samplesnippets.cpp" snippet="stdcomplex_abs"/>
+ </add-function>
+ <add-function signature="__pow__(StdComplex@exp@)" return-type="StdComplex">
+ <inject-code class="target" position="end"
+ file="samplesnippets.cpp" snippet="stdcomplex_pow"/>
+ </add-function>
+
+ </value-type>
+
<object-type name="TemplatePtr">
<modify-function signature="dummy(std::list&lt;std::pair&lt;BlackBox *, BlackBox *&gt; &gt; &amp;)" rename="dummy_method" />
</object-type>
@@ -2398,20 +2449,9 @@
<suppress-warning text="horribly broken type '__off64_t'" />
<suppress-warning text="enum '__codecvt_result' does not have a type entry or is not an enum" />
- <suppress-warning text="Pure virtual method &quot;Abstract::hideFunction(HideType*)&quot; must be implement but was completely removed on typesystem." />
- <suppress-warning text="hiding of function 'takeChild' in class 'ObjectType'" />
+ <suppress-warning text="Pure virtual method 'Abstract::hideFunction(HideType*)' must be implemented but was completely removed on type system." />
<suppress-warning text="Shadowing: MDerived2::castToBase3() and MDerived3::castToBase3()" />
- <suppress-warning text="hiding of function 'takeChild' in class 'Bucket'" />
- <suppress-warning text="visibility of function 'publicMethod' modified in class 'MDerived1'" />
- <suppress-warning text="hiding of function 'doNothingInPublic3' in class 'Overload2'" />
- <suppress-warning text="hiding of function 'takeChild' in class 'ObjectModel'" />
- <suppress-warning text="hiding of function 'takeChild' in class 'ObjectView'" />
- <suppress-warning text="visibility of function 'publicMethod' modified in class 'MDerived3'" />
- <suppress-warning text="skipping function 'InjectCode::toStr', unmatched parameter type 'T const&amp;'" />
-
- <suppress-warning text="^skipping function 'std::enable_if.*ComparisonTester::operator[!=]=.*ComparisonTester.*$"/>
-
- <!-- Do not fix this warning, the generator should be able to handle this situation for Object Types. -->
- <suppress-warning text="Argument in position 1 of added function 'SampleNamespace::passReferenceToObjectType(ObjectType * arg__1)', has a type that is not a reference, while the argument in the corresponding position in C++ function 'SampleNamespace::passReferenceToObjectType(const ObjectType &amp; obj, int multiplier)' is a reference." />
+ <suppress-warning text="Visibility of function 'publicMethod' modified in class 'MDerived1'" />
+ <suppress-warning text="^skipping public function 'std::enable_if.*ComparisonTester::operator[!=]=.*ComparisonTester.*$"/>
</typesystem>