[PyQt] SIP: overloaded functions with the same Python signature

GOO Creations goocreations at gmail.com
Mon Jul 5 22:36:57 BST 2010


Hello

This may sound like a really stupid question, but I can't find proper 
documentation/examples online:

I'm using SIP for my C++ - Python bindings. My C++ class has 2 functions 
with the same name.

----------------------------------------------------------
The C++ class:

class MyHasher
{
public:

     enum HashAlgorithm
     {
         Md4,
         Md5,
         Sha1
     };

     MyHasher();
     QString getFileHash(QString data, HashAlgorithm hash = Md5);
     QString getFileHash(QString data, HashAlgorithm hash = Md5, int 
numberOfBytes = 2048);
};
----------------------------------------------------------

The sip file:

class MyHasher
{

%TypeHeaderCode
#include <myhasher.h>
%End

public:

     enum HashAlgorithm
     {
         Md4,
         Md5,
         Sha1
     };

     MyHasher();
     QString getFileHash(QString data, HashAlgorithm hash = Md5);
     QString getFileHash(QString data, HashAlgorithm hash = Md5, int 
numberOfBytes = 2048);
};
----------------------------------------------------------



When I compile it, I'm getting the error:
sip: MyHasher::getFileHash() has overloaded functions with the same 
Python signature

When I remove one of the getFileHash functions, everything is working 
fine, but the problem seems to be with 2 functions with the same name at 
the same time.

How can I correct this in SIP?

Thank you!!
Christoph



More information about the PyQt mailing list