[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    =?utf-8?B?UmU6IOWbnuWkje+8mkNvbnZlcnRUb1N1YkNsYXNzQ29kZSBmb3IgSURpc3Bh?= =?utf-8?Q?tch?=
From:       Weitian Leung <just_fancy () live ! com>
Date:       2023-05-01 1:16:55
Message-ID: TYAP286MB054055542DA824B2D9C2742A976E9 () TYAP286MB0540 ! JPNP286 ! PROD ! OUTLOOK ! COM
[Download RAW message or body]

[Attachment #2 (text/plain)]

Thanks, now it work with a simple `typedef struct _Foo Foo;` in sip file.

________________________________
From: Phil Thompson <phil@riverbankcomputing.com>
Sent: Monday, May 1, 2023 12:51 AM
To: ‪‪‪‪just_fancy@live.com‬‬‬‬ <just_fancy@live.com>
Cc: pyqt@riverbankcomputing.com <pyqt@riverbankcomputing.com>
Subject: Re: 回复:ConvertToSubClassCode for IDispatch

On 30/04/2023 16:53, ‪‪‪‪just_fancy@live.com‬‬‬‬ wrote:
> Yes it means compiles and runs fine.
> What did you mean `wrapped _Foo`?
> The _Foo just write as normal class, no special code in sip file.

'wrapped _Foo' means created a .sip file for it.

If I've understood correctly then you could just refer to _Foo rather
than Foo in your .sip files.

Alternatively you could add the missing...

typedef struct _Foo Foo;

...to the .sip file for _Foo.

Either way, don't define Foo as a class in a .sip file.

Phil

> -------- 原始邮件 --------
> 发件人: Phil Thompson <phil@riverbankcomputing.com>
> 日期: 2023年4月30日周日 23:42
> 收件人: "‪‪‪‪just_fancy@live.com‬‬‬‬"
> <just_fancy@live.com>
> 抄送: pyqt@riverbankcomputing.com
> 主 题: Re: 回复:ConvertToSubClassCode for IDispatch
> On 30/04/2023 16:10, ‪‪‪‪just_fancy@live.com‬‬‬‬
> wrote:
>> No, it's `typedef interface Foo Foo` and without further definition.
>> It works for `open` I mean the returned foo, it could use as _Foo
>> normally (_Foo contains methods).
>> But I can't pass the foo returns from `open` to `dosomething` . It's
>> actully a _Foo because I use ConvertToSubClassCode for `Foo`
>
> "It works" means it compiles or it runs correctly?
>
> Have you wrapped _Foo?
>
> Phil
>
>> -------- 原始邮件 --------
>> 发件人: Phil Thompson <phil@riverbankcomputing.com>
>> 日期: 2023年4月30日周日 22:27
>> 收件人: Weitian Leung <Just_Fancy@live.com>
>> 抄送: pyqt@riverbankcomputing.com
>> 主 题: Re: ConvertToSubClassCode for IDispatch
>>
>>> On 30/04/2023 14:39, Weitian Leung wrote:
>>>> Hello,
>>>> I have a IDispatch related sdk header, say it contains two
>>>> IDispatch interfaces:
>>>> ```
>>>> interface _Foo : public IDispatch {…};
>>>> typedef interface Foo Foo; // No definition at all
>>>> ```
>>>
>>> Do you mean...
>>>
>>> typedef interface _Foo Foo;
>>>
>>>> `Foo` can be QueryInterface from `_Foo` in C++ (or just do a
>>> cast),
>>>> and for this case I asume they are just the same class.
>>>>
>>>> As the sdk internal only uses the Foo interface, such as:
>>>> ```
>>>> interface Bar : public IDispatch
>>>> {
>>>> bool open(…, Foo** out);
>>>> void dosomething(Foo* f);
>>>> };
>>>> ```
>>>>
>>>> So I use ConvertToSubClassCode to resolve the buggy sdk:
>>>> ```
>>>> class Foo /Abstract,NoDefaultCtors/
>>>> {
>>>> %ConvertToSubClassCode
>>>> sipType = sipType__Foo;
>>>> %End
>>>> };
>>>> ```
>>>
>>> As Foo above doesn't have a super-class, and nothing sub-classes
> it,
>>> the
>>> %ConvertToSubClassCode isn't having any effect.
>>>
>>>> It works for `open`, but not for `dosomething` due to
>>>> ConvertToSubClassCode make `open` returns a `_Foo`, they have no
>>>> inherits from python's view.
>>>
>>> Sorry, I don't understand what you mean. What do you mean by "it
>>> works"?
>>>
>>>> I can't change the C++ sdk as it out of my control.
>>>> So is there any chance to make SIP works for such case?
>>>
>>> Your example is too incomplete to say.
>>>
>>> Phil

[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} \
</style> </head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);" class="elementToProof"> Thanks, now it work with a simple `<font \
size="2"><span style="font-size:11pt" class="ContentPasted0">typedef struct _Foo \
Foo;</span></font>` in sip file.<br> </div>
<div id="appendonsend"></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size: 11pt; color: rgb(0, 0, 0);" \
face="Calibri, sans-serif"><b>From:</b> Phil Thompson \
&lt;phil@riverbankcomputing.com&gt;<br> <b>Sent:</b> Monday, May 1, 2023 12:51 AM<br>
<b>To:</b> ‪‪‪‪just_fancy@live.com‬‬‬‬ \
&lt;just_fancy@live.com&gt;<br> <b>Cc:</b> pyqt@riverbankcomputing.com \
&lt;pyqt@riverbankcomputing.com&gt;<br> <b>Subject:</b> Re: \
回复:ConvertToSubClassCode for IDispatch</font> <div>&nbsp;</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText elementToProof">On 30/04/2023 16:53, \
‪‪‪‪just_fancy@live.com‬‬‬‬ wrote:<br> &gt; Yes it means compiles and \
runs fine.<br> &gt; What did you mean `wrapped _Foo`?<br>
&gt; The _Foo just write as normal class, no special code in sip file.<br>
<br>
'wrapped _Foo' means created a .sip file for it.<br>
<br>
If I've understood correctly then you could just refer to _Foo rather <br>
than Foo in your .sip files.<br>
<br>
Alternatively you could add the missing...<br>
<br>
typedef struct _Foo Foo;<br>
<br>
...to the .sip file for _Foo.<br>
<br>
Either way, don't define Foo as a class in a .sip file.<br>
<br>
Phil<br>
<br>
&gt; -------- 原始邮件 --------<br>
&gt; 发件人: Phil Thompson &lt;phil@riverbankcomputing.com&gt;<br>
&gt; 日期: 2023年4月30日周日 23:42<br>
&gt; 收件人: &quot;‪‪‪‪just_fancy@live.com‬‬‬‬&quot;<br>
&gt; &lt;just_fancy@live.com&gt;<br>
&gt; 抄送: pyqt@riverbankcomputing.com<br>
&gt; 主 题: Re: 回复:ConvertToSubClassCode for IDispatch<br>
&gt; On 30/04/2023 16:10, ‪‪‪‪just_fancy@live.com‬‬‬‬<br>
&gt; wrote:<br>
&gt;&gt; No, it's `typedef interface Foo Foo` and without further definition.<br>
&gt;&gt; It works for `open` I mean the returned foo, it could use as _Foo<br>
&gt;&gt; normally (_Foo contains methods).<br>
&gt;&gt; But I can't pass the foo returns from `open` to `dosomething` . It's<br>
&gt;&gt; actully a _Foo because I use ConvertToSubClassCode for `Foo`<br>
&gt; <br>
&gt; &quot;It works&quot; means it compiles or it runs correctly?<br>
&gt; <br>
&gt; Have you wrapped _Foo?<br>
&gt; <br>
&gt; Phil<br>
&gt; <br>
&gt;&gt; -------- 原始邮件 --------<br>
&gt;&gt; 发件人: Phil Thompson &lt;phil@riverbankcomputing.com&gt;<br>
&gt;&gt; 日期: 2023年4月30日周日 22:27<br>
&gt;&gt; 收件人: Weitian Leung &lt;Just_Fancy@live.com&gt;<br>
&gt;&gt; 抄送: pyqt@riverbankcomputing.com<br>
&gt;&gt; 主 题: Re: ConvertToSubClassCode for IDispatch<br>
&gt;&gt; <br>
&gt;&gt;&gt; On 30/04/2023 14:39, Weitian Leung wrote:<br>
&gt;&gt;&gt;&gt; Hello,<br>
&gt;&gt;&gt;&gt; I have a IDispatch related sdk header, say it contains two<br>
&gt;&gt;&gt;&gt; IDispatch interfaces:<br>
&gt;&gt;&gt;&gt; ```<br>
&gt;&gt;&gt;&gt; interface _Foo : public IDispatch {…};<br>
&gt;&gt;&gt;&gt; typedef interface Foo Foo; // No definition at all<br>
&gt;&gt;&gt;&gt; ```<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt; Do you mean...<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt; typedef interface _Foo Foo;<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt;&gt; `Foo` can be QueryInterface from `_Foo` in C++ (or just do a<br>
&gt;&gt;&gt; cast),<br>
&gt;&gt;&gt;&gt; and for this case I asume they are just the same class.<br>
&gt;&gt;&gt;&gt; <br>
&gt;&gt;&gt;&gt; As the sdk internal only uses the Foo interface, such as:<br>
&gt;&gt;&gt;&gt; ```<br>
&gt;&gt;&gt;&gt; interface Bar : public IDispatch<br>
&gt;&gt;&gt;&gt; {<br>
&gt;&gt;&gt;&gt; bool open(…, Foo** out);<br>
&gt;&gt;&gt;&gt; void dosomething(Foo* f);<br>
&gt;&gt;&gt;&gt; };<br>
&gt;&gt;&gt;&gt; ```<br>
&gt;&gt;&gt;&gt; <br>
&gt;&gt;&gt;&gt; So I use ConvertToSubClassCode to resolve the buggy sdk:<br>
&gt;&gt;&gt;&gt; ```<br>
&gt;&gt;&gt;&gt; class Foo /Abstract,NoDefaultCtors/<br>
&gt;&gt;&gt;&gt; {<br>
&gt;&gt;&gt;&gt; %ConvertToSubClassCode<br>
&gt;&gt;&gt;&gt; sipType = sipType__Foo;<br>
&gt;&gt;&gt;&gt; %End<br>
&gt;&gt;&gt;&gt; };<br>
&gt;&gt;&gt;&gt; ```<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt; As Foo above doesn't have a super-class, and nothing sub-classes<br>
&gt; it,<br>
&gt;&gt;&gt; the<br>
&gt;&gt;&gt; %ConvertToSubClassCode isn't having any effect.<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt;&gt; It works for `open`, but not for `dosomething` due to<br>
&gt;&gt;&gt;&gt; ConvertToSubClassCode make `open` returns a `_Foo`, they have no<br>
&gt;&gt;&gt;&gt; inherits from python's view.<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt; Sorry, I don't understand what you mean. What do you mean by \
&quot;it<br> &gt;&gt;&gt; works&quot;?<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt;&gt; I can't change the C++ sdk as it out of my control.<br>
&gt;&gt;&gt;&gt; So is there any chance to make SIP works for such case?<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt; Your example is too incomplete to say.<br>
&gt;&gt;&gt; <br>
&gt;&gt;&gt; Phil<br>
</div>
</span></font></div>
</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic