Re: Dynamic knowledge about g_objects



On Fri, 2003-11-28 at 08:37, David Marín Carreño wrote:

*snip*

We're going to implement all these current structures as g-object
"classes". All them will have a common abstract parent class called
"AfDalDataNode".

But, for my gtktreemodel implementation I need to know, having a generic
AfDalDataNode pointer, information about its attributes (number of
attributes and their types). 
My treemodel will not have information about each actual AfDalDataNode
subclasses: it must be generic.

Can I do this? How?

If I understand you correctly, each subclass of the datanode will have a
number of typed attributes, and the model needs to know about these
attributes, without knowing anything more about the subclasses, correct?

In this case, a rough outline of how to do it:

The AfDalDataNode class should have a get_attributes method that each of
the subclasses can override and then an
af_dal_data_node_get_attributes() function which will call the class'
method (which should be overridden) to get the attributes.  This could
return something like a GList of attribute structures, or whatever would
be appropriate.

Hope that answers your question

-charlie




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