[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] [SIP] sip and template
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2011-02-24 14:12:34
Message-ID: bbd3da164dcb410a2ffe2c3fce6e6778 () localhost
[Download RAW message or body]
On Fri, 11 Feb 2011 14:04:46 +0100, Kermit <stef.kermit@gmail.com> wrote:
> hi,
>
> since my last post, i've lot difficult to implement a "simple" binding
with
> sip
>
> i try to bind the good ilmBase librairy.
> i extract a exemple with error with sip
>
> // ________________________C+++ File ________________________
> #ifndef INCLUDED_IMATHVEC_H
> #define INCLUDED_IMATHVEC_H
>
> namespace Imath {
> template <class T> class Vec2;
>
> template <class T> class Vec2
> {
> public:
>
> T x, y;
>
> T & operator [] (int i);
> const T & operator [] (int i) const;
>
> Vec2 (); // no initialization
> explicit Vec2 (T a); // (a a)
> Vec2 (T a, T b); // (a b)
> // Base type -- in templates
> typedef T BaseType;
> };
>
> // Typedefs for convenience
> typedef Vec2 <int> V2i;
> typedef Vec2 <float> V2f;
> typedef Vec2 <double> V2d;
>
> } // namespace Imath
>
> #endif
>
> // ________________________Sip File ________________________
> %Module KitCG 0
>
> %UnitPostIncludeCode
> namespace Imath {};
> using namespace Imath;
> %End
>
> template<TYPE>
> class Vec2
> {
> %TypeHeaderCode
> #include "ImathVec.h"
> %End
> public:
> TYPE x;
> TYPE y;
> // For info, TYPE x,y; or mmore simple float x,y; generate a sip error
>
> TYPE & operator [] (int i);
> const TYPE & operator [] (int i) const;
>
>
> //-------------
> // Constructors
> //-------------
>
> Vec2 (); // no initialization
> explicit Vec2 (TYPE a); // (a a)
> Vec2 (TYPE a, TYPE b); // (a b)
> // Base type -- in templates
> typedef TYPE BaseType;
> };
>
>
> with this code, i've "sip: TYPE is undefined" error message
>
> i read qlist.sip, but i understand is a converion between a QList in C++
> and
> python list
>
> in my case, i want a v2f, v2d python object
>
> thx for your help
>
> Kermit
This should now be fixed in hg. The problem is the typedef - maybe you
don't actually need it?
Phil
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic