[PySide] shiboken - wrapping function inside a namespace

Ryan Gonzalez rymg19 at gmail.com
Fri Jul 25 18:51:48 CEST 2014


I personally think this should be documented...


On Fri, Jul 25, 2014 at 11:19 AM, iaio tom <iaiotom at hotmail.com> wrote:

> Hi Ryan, thank you.
> At the end I found a solution,
> to not generate the namespace as a class I've just added the generate="no"
> tot he namespace and I've create a simple header that wrap all the global
> function that I want bind like
>
>
> // globalFunctionsWrapper.h
> #include <fooInit.h>
>
> void initFoo()
> {
>       ::Foo::initFoo();
> }
>
>
> //global.h
> #include <globalFunctionsWrapper.h>
> #include <FooClasses.h>
>
> // .xml
>
> <?xml version="1.0" encoding="utf-8"?>
> <typesystem package="MyPkg">
>     <function signature="initFoo()"/>
>   <namespace-type name="Foo" generate = "no">
>       <object-type name="FooClass"/>
>       <object-type name="FooClass1"/>
>   </namespace-type>
> </typesystem>
>
>
> Cheers
> Alan
> ------------------------------
> Subject: Re: [PySide] shiboken - wrapping function inside a namespace
> From: rymg19 at gmail.com
> Date: Tue, 15 Jul 2014 17:25:48 -0500
> To: iaiotom at hotmail.com; pyside at qt-project.org
>
>
> I don't have a solution, but I can say that you're not the only one who
> gets bugged by that problem. From what I know, Qt itself has no namespace,
> so the PySide binding implementation doesn't have a solution.
>
> iaio tom <iaiotom at hotmail.com> wrote:
>
> Hi,
> I've started to use shiboken to bind my cpp lib to python and I have a
> couple of questions related to the namespaces.
> So from what I've seen if a use a namespace in .xml file definition,
> shiboken will create a class with the same name and it will use this class
> as namespace.
> But, there is a way to bind a function ro a class that in my cpp code is
> in a namespace to a global function or class without namespace in python?
>
> for example in my cpp code
>
> namespace Foo
> {
>     void initFoo();
> }
>
> in shiboken the only way I found to export this function is this:
> .xml file
>
> <?xml version="1.0" encoding="utf-8"?>
> <typesystem package="MyPkg">
>   <namespace-type name="Foo">
>     <function signature="initFoo()"/>
>   </namespace-type>
> </typesystem>
>
> if I try something like this it doens't work:
> <typesystem package="MyPkg">
> <function signature="initFoo()"/>
> </typesystem>
>
> or
>
> <typesystem package="MyPkg">
> <function signature="Foo::initFoo()" rename="initFoo"/>
> </typesystem>
>
>
> anyone know if there is a solution to this problem?
>
> Thank you
> Alan
>
>
>  ------------------------------
>
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
>
>
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>



-- 
Ryan
If anybody ever asks me why I prefer C++ to C, my answer will be simple:
"It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was
nul-terminated."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140725/1044133d/attachment.html>


More information about the PySide mailing list