With getFileHash(QString()) the first overload is being called.
If I understand you correct, SIP doesn't allow this?

Christoph



On 2010/07/08 12:16 PM, Phil Thompson wrote:
On Mon, 05 Jul 2010 23:36:57 +0200, GOO Creations<[email protected]>
wrote:
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?
I'm not a C++ expert, but I'm surprised that it allows those overloads.
According to the standard, with...

getFileHash(QString());

...which overload gets called?

Phil


_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to