<?xml version="1.0" encoding="UTF-8"?>
<typesystem package="testbinding">
    <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
    <value-type name="IntValue"/>
    <primitive-type name="TypedefValue">
        <!--
        A conversion rule is used here because ApiExtractor can't associate
        a primitive typedef to a non-primitive type. That would be a good
        improvement to ApiExtractor.
        -->
        <conversion-rule>
            <native-to-target>
            return %CONVERTTOPYTHON[IntValue](%in);
            </native-to-target>
            <target-to-native>
                <add-conversion type="IntValue">
                IntValue value = %CONVERTTOCPP[IntValue](%in);
                %out = %OUTTYPE(value);
                </add-conversion>
            </target-to-native>
        </conversion-rule>
    </primitive-type>
    <object-type name="TestObject" />

    <primitive-type name="PySideInt"/>
    <primitive-type name="PySideCPP2::PySideLong"/>
    <!--<primitive-type name="PySideLong"/>-->

    <function signature="getHiddenObject()" />

    <inject-code position="end">
    Shiboken::Conversions::registerConverterName(Shiboken::Conversions::PrimitiveTypeConverter&lt;long&gt;(), "PySideLong");
    Shiboken::Conversions::registerConverterName(Shiboken::Conversions::PrimitiveTypeConverter&lt;long&gt;(), "PySideCPP2::PySideLong");
    qRegisterMetaType&lt;PySideInt>("PySideInt");
    qRegisterMetaType&lt;PySideCPP2::PySideLong>("PySideLong");
    </inject-code>

    <namespace-type name="PySideCPP">
        <object-type name="TestObjectWithNamespace"/>
        <object-type name="TestObject2WithNamespace">
            <add-function signature="__repr__" return-type="PyObject*">
                <inject-code class="target" position="beginning">
                    %PYARG_0 = Shiboken::String::fromCString("TestObject2WithNamespace(injected_repr)");
                </inject-code>
            </add-function>
        </object-type>
    </namespace-type>

    <namespace-type name="PySideCPP2" generate="no">
        <enum-type name="Enum1" />
        <object-type name="TestObjectWithoutNamespace">
            <enum-type name="Enum2" />
        </object-type>
    </namespace-type>

    <object-type name="TestView" >
        <modify-function signature="TestView(QAbstractListModel*,QObject*)">
            <modify-argument index="1">
                <reference-count action="set"/>
            </modify-argument>
        </modify-function>
    </object-type>

    <namespace-type name="FlagsNamespace" visible="no">
        <enum-type name="Option" flags="Options"/>
        <object-type name="ClassForEnum" />
    </namespace-type>

    <suppress-warning text="type 'QPyTextObject' is specified in typesystem, but not defined. This could potentially lead to compilation errors." />
    <!-- Qt5: I never really understood this warning. Probably it is because there
        is no way to instantiate the class. Anyway, why must this class emit this warning?
        I am not a C++ warrior, so I'd prefer if it would say "it is ok if you see this warning!".
        Well, maybe somebody will enlighten me, and I'll change this comment.
        I'd actually prefer an implementation that avoids generating this message, but I still failed
        doing so :-(
    -->
</typesystem>
