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

List:       pykde
Subject:    Re: SIP: using %InstanceCode for pure virtual class
From:       James Jurack <James.Jurack () ametek ! com>
Date:       2021-08-09 15:26:01
Message-ID: DM6PR07MB7145EAF11E47D7858A3FCB3EFCF69 () DM6PR07MB7145 ! namprd07 ! prod ! outlook ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thank you for that! I had somehow missed the annotations documentation entirely. I \
think perhaps /Abstract/ is the one I need in this case, but I seem to be on the \
right track now. Thanks again!


--

James Jurack

Systems Engineer

[cid:6ba39e1a-7562-4c91-9062-8acc474a02a4]                                            \
[cid:fc8c1e49-c487-4366-99a3-ef3c4077bc1b]

5425 Warner Rd. | Suite 13 | Valley View, OH 44125 | \
http://www.vtiinstruments.com<http://www.vtiinstruments.com/>

P. +1.216.447.8950 x2013 | F: +1.216.447.8951 | \
james.jurack@ametek.com<mailto:email@vtiinstruments.com>


________________________________
From: Phil Thompson <phil@riverbankcomputing.com>
Sent: Saturday, August 7, 2021 5:01 AM
To: James Jurack <James.Jurack@ametek.com>
Cc: pyqt@riverbankcomputing.com <pyqt@riverbankcomputing.com>
Subject: Re: SIP: using %InstanceCode for pure virtual class

***NOTICE*** This came from an external source. Use caution when replying, clicking \
links, or opening attachments.

On 06/08/2021 21:12, James Jurack wrote:
> Hello,
> 
> I am trying to use SIP to wrap a pure virtual class. Since it does not
> have a callable constructor, it instead has a static factory function
> that returns an instance of a hidden subclass.
> 
> From the docs, I've gathered that SIP provides %InstanceCode to cover
> this use case, but it appears it's not doing anything. My class is
> defined in my .sip file like so:
> 
> class MyLib
> {
> %TypeHeaderCode
> #include <MyLib.h>
> %End
> %InstanceCode
> sipCpp = ::MyLib::Create();
> %End
> };
> 
> But there is no change in the CPP code that SIP generates, whether I
> include the %InstanceCode or not; it's still trying to call my class's
> constructor directly, and I can't find my call to Create() anywhere in
> the generated code.
> 
> Am I misunderstanding how %InstanceCode is supposed to work?

You haven't told SIP that there are no default ctors. See...

https://urldefense.com/v3/__https://www.riverbankcomputing.com/static/Docs/sip/annotat \
ions.html*class-annotation-NoDefaultCtors__;Iw!!HKOSU0g!S_W52V65neQiX3WDsLXU8dQBvA-Cc2dMuk6Q22pZQx7TPxi1LAuV9jcjr8xYYQEPGWk$


Phil


[Attachment #5 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} \
</style> </head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> Thank you for that! I had somehow missed the annotations \
documentation entirely. I think perhaps /Abstract/ is the one I need in this case, \
but I seem to be on the right track now. Thanks again!</div> <div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> <br>
</div>
<div id="Signature">
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> <pre style="orphans:auto; widows:auto">-- <br></pre>
<div style="font-family:Cantarell; font-size:14.666666984558105px; \
font-weight:normal; orphans:auto; widows:auto"> <p style="margin:0in 0in 0.0001pt; \
font-family:Calibri,sans-serif"><b><span style="font-size:12pt; \
color:rgb(31,73,125)">James Jurack</span></b></p> <p style="margin:0in 0in 0.0001pt; \
font-family:Calibri,sans-serif; line-height:18.33333396911621px"> <span \
style="color:rgb(31,73,125)">Systems Engineer</span></p> <p style="margin:0in 0in \
0.0001pt; font-family:Calibri,sans-serif; line-height:18.33333396911621px"> <span \
style="color:rgb(31,73,125)"><img class="EmojiInsert" data-outlook-trace="F:1|T:1" \
src="cid:6ba39e1a-7562-4c91-9062-8acc474a02a4"></span><span \
style="color:rgb(31,73,125)">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img class="EmojiInsert" \
data-outlook-trace="F:1|T:1" \
src="cid:fc8c1e49-c487-4366-99a3-ef3c4077bc1b"></span></p> <p style="margin:0in 0in \
0.0001pt; font-family:Calibri,sans-serif"><span style="color:rgb(31,73,125)">5425 \
Warner Rd.&nbsp;</span><b><span style="color:red">|&nbsp;</span></b><span \
style="color:rgb(31,73,125)">Suite 13&nbsp;</span><b><span \
style="color:red">|</span></b><span style="color:rgb(31,73,125)">&nbsp;Valley  View, \
OH 44125&nbsp;</span><b><span style="color:red">|</span></b><span \
style="color:rgb(31,73,125)">&nbsp;<a href="http://www.vtiinstruments.com/" \
style="color:purple">http://www.vtiinstruments.com</a></span></p> <p \
style="margin:0in 0in 0.0001pt; font-family:Calibri,sans-serif; line-height:22px"> \
<span style="color:rgb(31,73,125)">P. +1.216.447.8950 x2013&nbsp;</span><b><span \
style="color:red">|</span></b><span style="color:rgb(31,73,125)">&nbsp;F: \
+1.216.447.8951&nbsp;</span><b><span style="color:red">|</span></b><span \
style="color:rgb(31,73,125)">&nbsp;<a href="mailto:email@vtiinstruments.com" \
style="color:purple">james.jurack@ametek.com</a></span></p> </div>
<br>
</div>
</div>
</div>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,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 face="Calibri, sans-serif" color="#000000" \
style="font-size:11pt"><b>From:</b> Phil Thompson \
&lt;phil@riverbankcomputing.com&gt;<br> <b>Sent:</b> Saturday, August 7, 2021 5:01 \
AM<br> <b>To:</b> James Jurack &lt;James.Jurack@ametek.com&gt;<br>
<b>Cc:</b> pyqt@riverbankcomputing.com &lt;pyqt@riverbankcomputing.com&gt;<br>
<b>Subject:</b> Re: SIP: using %InstanceCode for pure virtual class</font>
<div>&nbsp;</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">***NOTICE*** This came from an external source. Use caution \
when replying, clicking links, or opening attachments.<br> <br>
On 06/08/2021 21:12, James Jurack wrote:<br>
&gt; Hello,<br>
&gt;<br>
&gt; I am trying to use SIP to wrap a pure virtual class. Since it does not<br>
&gt; have a callable constructor, it instead has a static factory function<br>
&gt; that returns an instance of a hidden subclass.<br>
&gt;<br>
&gt; From the docs, I've gathered that SIP provides %InstanceCode to cover<br>
&gt; this use case, but it appears it's not doing anything. My class is<br>
&gt; defined in my .sip file like so:<br>
&gt;<br>
&gt; class MyLib<br>
&gt; {<br>
&gt; %TypeHeaderCode<br>
&gt; #include &lt;MyLib.h&gt;<br>
&gt; %End<br>
&gt; %InstanceCode<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; sipCpp = ::MyLib::Create();<br>
&gt; %End<br>
&gt; };<br>
&gt;<br>
&gt; But there is no change in the CPP code that SIP generates, whether I<br>
&gt; include the %InstanceCode or not; it's still trying to call my class's<br>
&gt; constructor directly, and I can't find my call to Create() anywhere in<br>
&gt; the generated code.<br>
&gt;<br>
&gt; Am I misunderstanding how %InstanceCode is supposed to work?<br>
<br>
You haven't told SIP that there are no default ctors. See...<br>
<br>
<a href="https://urldefense.com/v3/__https://www.riverbankcomputing.com/static/Docs/si \
p/annotations.html*class-annotation-NoDefaultCtors__;Iw!!HKOSU0g!S_W52V65neQiX3WDsLXU8 \
dQBvA-Cc2dMuk6Q22pZQx7TPxi1LAuV9jcjr8xYYQEPGWk$">https://urldefense.com/v3/__https://w \
ww.riverbankcomputing.com/static/Docs/sip/annotations.html*class-annotation-NoDefaultC \
tors__;Iw!!HKOSU0g!S_W52V65neQiX3WDsLXU8dQBvA-Cc2dMuk6Q22pZQx7TPxi1LAuV9jcjr8xYYQEPGWk$</a><br>
 <br>
Phil<br>
</div>
</span></font></div>
</div>
</body>
</html>


["Outlook-vdh5tn3i.jpg" (image/jpeg)]
["Outlook-jbgh1mit.jpg" (image/jpeg)]

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

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