Hi Bjoern,

Thank you for your answer. This is a good suggestion, but I think it is more user-friendly to have properties rather than getters... this is why I was wondering if this was possible with SWIG.

On Thu, Mar 28, 2013 at 10:51 AM, Björn Simon <simon@altair.com> wrote:

Hi Oliver,

 

Why not having the member variables as private/protected and provide getter/setter for Username and only getter for Password?

So using DataSource more as a class than as a struct.

 

Regards,

 

Bjoern

 

From: Olivier Voyer [mailto:olivier.voyer@gmail.com]
Sent: Thursday, March 28, 2013 10:47 AM
To: swig-user@lists.sourceforge.net
Subject: [Swig-user] Read-only property in C++

 

I'm wrapping C++ to Python using SWIG. How can I tell SWIG that a property is read-only?

 

class DataSource

{

public:

            DataSource();

            ~DataSource();

 

            std::string Username

            std::string Password; // Read-only?

}

 

Regards,

 

--
Olivier




--
Olivier