[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] fixed size array
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2011-03-21 10:42:08
Message-ID: 0b63e56bc02e20e59d7d7fc58fcc2971 () localhost
[Download RAW message or body]
On Mon, 21 Mar 2011 11:28:38 +0100, John Beuving <johnbeuving@gmail.com>
wrote:
> Hi,
>
> I have the following c++ code which I want to sip.
>
> struct message
> {
> int id;
> char username[250];
> char field[20];
> };
>
> The sip parser gives a syntax error on the line with the square
brackets.
> What is the best solution to work around this problem?
Array support is on the TODO list.
The easiest workaround is to define a UserName %MappedType that does the
conversion and the necessary bounds checks and define username with the
UserName type. This is all in the .sip file, you don't need to change the
C++ code.
Or you can be a bit more clever and do something like...
template<SIZE>
%MappedType CharArray<SIZE>
{
...
};
typedef CharArray<250> UserName;
typedef CharArray<20> Field;
struct message
{
int id;
UserName username;
Field field;
};
...I think.
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