[Qt-jambi-interest] QNativePointer to void*

Karim Andras Pinter pinterkarimandras at yahoo.co.uk
Thu Aug 14 09:52:14 CEST 2008


Hello!

I would like to create a utility class using jambi generation.
One of the class functions should be like this:

Java side :
void converter( byte[], QNativePointer )

C++ side :
void converter( char*, int, void* )

So basicly byte[] -> to void* and lenght of byte[] and QNativePointer -> void*.
Questions are : Is it possible to use QNativePointer as a void* if the length is known?
How will the typesetting will look like? How the QNativePointer can be converted to void*?

I tried something like this, but for QNativePointer ?
    <modify-function signature="converter(char*, long, void*)">
            <modify-argument index="1">
                <replace-type modified-type="byte[]"/>
                <conversion-rule class="shell">
                    <insert-template name="core.iodevice_convert_char*_to_byte[]">
                        <replace from="%len" to="%2"/>
                    </insert-template>
                </conversion-rule>
                <conversion-rule class="native">
                    <insert-template name="core.iodevice_convert_byte[]_to_char*"/>
                </conversion-rule>
            </modify-argument>

            <modify-argument index="2">
                <remove-argument/>
                <conversion-rule class="shell">
                    // nothing
                </conversion-rule>
                <conversion-rule class="native">
                    <insert-template name="core.get_array_length">
                        <replace from="%ARRAY" to="%1"/>
                    </insert-template>
                </conversion-rule>
            </modify-argument>

            <modify-argument index="0">
                <replace-type modified-type="int"/>
                <conversion-rule class="native">
                    <insert-template name="core.iodevice_cleanup"/>
                </conversion-rule>
                <conversion-rule class="shell">
                    qint64 %out = %in;
                    <insert-template name="core.iodevice_cleanup_to_java">
                        <replace from="%len" to="(int) %in"/>
                    </insert-template>
                </conversion-rule>
            </modify-argument>
</modify-function>

Thanks for your help!
Karim


Send instant messages to your online friends http://uk.messenger.yahoo.com 




More information about the Qt-jambi-interest mailing list