[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Graphics properties as objects
From: |
John W. Eaton |
Subject: |
Re: Graphics properties as objects |
Date: |
Sun, 30 Dec 2007 11:52:24 -0500 |
On 29-Dec-2007, Michael Goffioul wrote:
| On 12/29/07, John W. Eaton <address@hidden> wrote:
| > OK. Are you planning to make all the properties the same type? I
| > don't think we want to do that. Can you outline the class hierarchy
| > that you have in mind?
|
| What I had in mind is something similar as octave_value. The interface
| class is common, but the representation classes are different. Something
| more or less like the following:
|
| class base_graphics_property;
|
| class string_property : public base_graphics_property
| {
| public:
| string_property& operator= (const octave_value& v)
| {
| if (v.is_string ())
| str = v.string_value ();
| else
| error ("invalid string property value");^
| return *this;
| }
| private:
| std::string str;
| };
|
| class graphics_property
| {
| public:
| graphics_property (base_graphics_property *p)
| : rep (p) { }
| graphics_property& operator= (const octave_value& v)
| { *rep = v; }
| private:
| base_graphics_property *rep;
| };
Who is responsible for creating and deleting rep?
jwe