[PyQt] Help with wrapping protected enum

Demetrius Cassidy dcassidy36 at mass.rr.com
Fri May 7 05:04:00 BST 2010


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));
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100507/53ea03a9/attachment-0001.html>


More information about the PyQt mailing list