Thread overview
STLSOFT_METHOD_PROPERTY_GETSET
Jul 19, 2005
Peter Schregle
Jul 19, 2005
Matthew
Jul 26, 2005
Matthew
July 19, 2005
I'm using the STLSOFT_METHOD_PROPERTY_GETSET macro to implement properties. Now, I want the setter functions to return a reference to their class, so that I can chain calls to setters, like:

// definition of setters in some class
class image
{
...
class_type & set_width(int width) { m_width = width; return *this; }
class_type & set_height(int height) { m_height = height; return *this; }
...
};

// use of setters
image a;
a.set_width(100).set_height(100);

But I still want the other possibility, to use the properties as such:
// use of properties
image b;
b.width = 100;
b.height = 100;

Now, the STLSOFT_METHOD_PROPERTY_GETSET macro does not like setters that return a reference to thieir containing class. I'm wondering what it would take to change the code to allow such type of setters.

Peter





July 19, 2005
Hmm, not sure off the top of my head. Let me think on it a day or so. :-)

Cheers

Matthew

"Peter Schregle" <p.schregle@impuls-imaging.com> wrote in message news:dbior4$28ej$1@digitaldaemon.com...
> I'm using the STLSOFT_METHOD_PROPERTY_GETSET macro to implement properties. Now, I want the setter functions to return a reference to their class, so that I can chain calls to setters, like:
>
> // definition of setters in some class
> class image
> {
> ...
> class_type & set_width(int width) { m_width = width; return *this; }
> class_type & set_height(int height) { m_height = height; return *this; }
> ...
> };
>
> // use of setters
> image a;
> a.set_width(100).set_height(100);
>
> But I still want the other possibility, to use the properties as such:
> // use of properties
> image b;
> b.width = 100;
> b.height = 100;
>
> Now, the STLSOFT_METHOD_PROPERTY_GETSET macro does not like setters that return a reference to thieir containing class. I'm wondering what it would take to change the code to allow such type of setters.
>
> Peter
>
>
>
>
> 


July 26, 2005
I'm going to release STLSoft 1.8.4 in the next day or so, and this will _not_ be in there, but I will look at it as soon as that release is done.

"Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:dbiqr7$2a7n$1@digitaldaemon.com...
> Hmm, not sure off the top of my head. Let me think on it a day or so. :-)
>
> Cheers
>
> Matthew
>
> "Peter Schregle" <p.schregle@impuls-imaging.com> wrote in message news:dbior4$28ej$1@digitaldaemon.com...
>> I'm using the STLSOFT_METHOD_PROPERTY_GETSET macro to implement properties. Now, I want the setter functions to return a reference to their class, so that I can chain calls to setters, like:
>>
>> // definition of setters in some class
>> class image
>> {
>> ...
>> class_type & set_width(int width) { m_width = width; return
>> *this; }
>> class_type & set_height(int height) { m_height = height; return
>> *this; }
>> ...
>> };
>>
>> // use of setters
>> image a;
>> a.set_width(100).set_height(100);
>>
>> But I still want the other possibility, to use the properties as
>> such:
>> // use of properties
>> image b;
>> b.width = 100;
>> b.height = 100;
>>
>> Now, the STLSOFT_METHOD_PROPERTY_GETSET macro does not like setters that return a reference to thieir containing class. I'm wondering what it would take to change the code to allow such type of setters.
>>
>> Peter
>>
>>
>>
>>
>>
>
>