[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
patch: add accessor methods to properties
From: |
John W. Eaton |
Subject: |
patch: add accessor methods to properties |
Date: |
Fri, 15 Jun 2007 14:39:50 -0400 |
On 15-Jun-2007, Shai Ayal wrote:
| As one more step towards a c++ interface to object graphics I attach
| a patch which adds a get_XXX accesor methos to each property XXX.
| This is done using a macro ADD_PROPERTY for all properties except
| for 4 axes_properties which are a special case since they need to be
| mutable. If more properties like these pop up, we could add a
| special ADD_MUTABLE_PROPERTY macro
OK, I applied this patch and went ahead with the mutable macro. I did
it like this:
#define OCTAVE_GRAPHICS_PROPERTY_INTERNAL(TAG, TYPE, NAME) \
private: TAG TYPE NAME; \
public: const TYPE& get_ ## NAME () const { return NAME; } \
private:
#define OCTAVE_GRAPHICS_PROPERTY(TYPE, NAME) \
OCTAVE_GRAPHICS_PROPERTY_INTERNAL ( , TYPE, NAME)
#define OCTAVE_GRAPHICS_MUTABLE_PROPERTY(TYPE, NAME) \
OCTAVE_GRAPHICS_PROPERTY_INTERNAL (mutable, TYPE, NAME)
and also added #undefs for these at the end of graphics.h.
Thanks,
jwe