[PyQt] Help with wrapping protected enum
Phil Thompson
phil at riverbankcomputing.com
Fri May 7 17:29:38 BST 2010
On Fri, 07 May 2010 00:04:00 -0400, Demetrius Cassidy
<dcassidy36 at mass.rr.com> wrote:
> I am having a problem in wrapping a protected enum declared in a child
> class. For some reason, the sip code below is converting
> Element::OptionalCRLF parameters to int, which results in a compiler
> error. If anyone has an idea of what is wrong in my wrapped code, please
> let me know.
>
> sippyptlibPHTMLFormField.cpp
> .\sippyptlibPHTMLFormField.cpp(53) : error C2664:
> 'PHTML::FormField::FormField(const char *,const char
*,PHTML::ElementInSet,
> PHTML::Element::OptionalCRLF,PHTML::DisableCodes,const char *)' : cannot
> convert parameter 4 from 'int' to 'PHTML::Element::OptionalCRLF'
> Conversion to enumeration type requires an explicit cast
> (static_cast, C-style cast or function-style cast)
>
> class PHTML
> {
> public:
> enum ElementInSet {
> InHTML,
> NumElementsInSet
> };
>
> enum DisableCodes {
> Enabled,
> Disabled
> };
>
> PHTML(
> const char * cstr ///< C string representation of the title
> string.
> );
>
> class Element {
> public:
> virtual ~Element();
> protected:
> enum OptionalCRLF { NoCRLF, OpenCRLF, CloseCRLF, BothCRLF };
> Element(
> const char * nam,
> const char * att,
> PHTML::ElementInSet elmt,
> PHTML::ElementInSet req,
> OptionalCRLF opt
> );
> virtual void Output(PHTML & html) const;
> virtual void AddAttr(PHTML & html) const;
> };
>
> class FieldElement : PHTML::Element {
> protected:
> FieldElement(
> const char * nam,
> const char * attr,
> PHTML::ElementInSet elmt,
> OptionalCRLF opt,
> PHTML::DisableCodes disabled
> );
> virtual ~FieldElement();
> virtual void AddAttr(PHTML & html) const;
> };
> };
>
> Offending C++ Code - as you can see 'int a3' should actually be
> PHTML::Element::OptionalCRLF. I am not sure why sip is treating this as
> an int.
>
> sipPHTML_FormField::sipPHTML_FormField(const char *a0,const char
> *a1,PHTML::ElementInSet a2,_*int a3*_,PHTML::DisableCodes a4,const char
> *a5): PHTML::FormField(a0,a1,a2,a3,a4,a5), sipPySelf(0)
> {
> memset(sipPyMethods, 0, sizeof (sipPyMethods));
> }
Fixed in Mercurial.
Thanks,
Phil
More information about the PyQt
mailing list