[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Graphics properties as objects
From: |
Michael Goffioul |
Subject: |
Re: Graphics properties as objects |
Date: |
Wed, 2 Jan 2008 19:10:21 +0100 |
On 1/2/08, Shai Ayal <address@hidden> wrote:
> I'm a bit reluctant to ask (maybe I'm showing my lack of c++
> knowledge), but can you explain what problem this code tries to solve,
> and what is the method of solution?
This is just a skeleton, to illustrate what I had in mind. It does not
contain all features. For the things I'm trying to address, I'd refer to
my initial mail in this thread: if you want to have states in your
properties (like hidden state), or if you want to have property-specific
data (like listeners), or if you want to create list of properties (like
for dynamic properties), my opinion is that it would be much easier
to create property classes, with a common base class. This is
what my proposal is trying to address: formalizing the concept of
"property".
What the proposed code does not show yet, is the fact that some
features could be implemented in a more elegant way: for instance
the get method, that could be common for all graphics objects
octave_value base_properties::get (const caseless_str& name)
{
std::map<caseless_str,property>::iterator it = all_props.find (name);
if (it != all_props.end ())
return (*it).get ();
else
{
warning ("unknown property: %s", name.c_str ());
return octave_value ();
}
}
Michael.
Re: Graphics properties as objects, John W. Eaton, 2008/01/02