[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: StdProp for UML attributes?



Le Wed, Apr 03, 2002, à 10:07:01AM -0500, Andrew S Halper a écrit:
> I'm attempting to write the StdProp code for the UML attributes, and I
> was wondering what the appropriate property type should be?  At first I
> thought ListProperty (defined in lib/prop_widgets.h), but now I think
> that might not be what I want.  Is there an available property type I
> should use, or is it necessary to invent one?


Hmmm. Basically, YMMV. I had written PROP_TYPE_SARRAY and PROP_TYPE_DARRAY
for that purpose too (PROP_TYPE_LIST being used to display the text
representation of properties). There is also PROP_TYPE_BUTTON to be able to
receive events.

What I had in mind was the following:
	* the attributes proper are represented as a DARRAY of the
individual properties (in the "extra" field of the PropDescriptor, set
"record" to point to an array of PropDescriptors describing the contained
struct; set the "newrec" and "freerec" to the allocator/deallocator routines
for that element. Yes, this is better called "operator new" and "operator 
delete"). The darray is only used for copy/paste and load/save (and, in
general, holds the state).

	* There is a textual representation of the darray in a
PROP_TYPE_LIST. This list is used to select the attribute being edited. This
property is only used for display purposes.
	* There is a set of properties for each field of the record of the
darray which is being edited (selected in the list). This set of properties
only hold a copy of the darray record property values, and is not
saved/loaded. It is copied from the darray record upon list item selection,
and copied back upon selectio of another item (or the prop dialog is
closed).
	* There are add/remove buttons so the user can add and remove
elements to the darray.

Of course, the real fun is that the operations darray holds a nested darray
of parameters:

	darray OperationsList { /* only a lookalike */
		string name;
		string return_type;
		enum { ... } accessibility_type;
		enum { ... } qualifier_type; /* const, volatile, final etc. */
		
		darray ParameterList {
			string name;
			string type;
			enum { ... } directionality_type; /* in, out, in/out */
			enum { ... } various_stuff /* reference, value, etc. */
		};
	};		

You'll certainly want to "practice" on the attributes darray; this should be
only something like
	darray AttributesList { 
		string name;
		string type;
		enum { ... } accessibility_type;
	}; 
which should be quite fun already to craft (if you take into account that
the whole stuff shall also be put into a notebook, with some pages perhaps
divided into multicols and frames...)

As of now, all this code is mostly unused; I hadn't got the time to finish
that since August. I'd be extremely grateful if you were to pick this up !

(you may find out that all this code is completely buggy, non-working, or
find that you need to write additional property types. You may also find
that you're going to break the file-level compatibility and finally keeping
the ad-hoc load&save routines)

	-- Cyrille

-- 
Grumpf.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK