[SIP] How to hide helper functions?

Weitian Leung just_fancy at live.com
Sat Jul 2 10:30:10 BST 2022


No because the Python Foo.get_Count() will only raise an exception.
Not exactly, because the interface is created by another interface, get_Count()  can be called normally.

Is it due to python property need to call the C++ method explicitly?
________________________________
From: Phil Thompson <phil at riverbankcomputing.com>
Sent: Saturday, July 2, 2022 4:34 PM
To: Weitian Leung <Just_Fancy at live.com>
Cc: pyqt at riverbankcomputing.com <pyqt at riverbankcomputing.com>
Subject: Re: [SIP] How to hide helper functions?

On 02/07/2022 09:09, Weitian Leung wrote:
> I have such situation that want to hide the handwritten functions, for
> example
> struct Foo /Abstract/
> {
>     HRESULT get_Count(long *count /Out/) = 0;
>     long getCount();
>     %MethodCode
>         long count = 0;
>         sipCpp->get_Count(&count);
>         sipRes = count;
>     %End
>     %Property(name=Count, get=getCount)
> };
> the getCount is not the original interface method, I just want to make
> the get_Count be a property, so write one helper function and use the
> %Property directive.
> But I don't want the user see or call the getCount method directly,
> only the get_Count or Count property is acceptable.
>
> It is possible do that?

No.

> Or is any other way to expose get_Count as a property?

No because the Python Foo.get_Count() will only raise an exception.

Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20220702/35c96f15/attachment.htm>


More information about the PyQt mailing list