QOF and child objects

Neil Williams linux at codehelp.co.uk
Tue May 3 14:11:05 EDT 2005

On Tuesday 03 May 2005 6:27 pm, Derek Atkins wrote:
> > > Effectively GncOwner is just a QofEntity with a limited range of
> > > values.
> >
> > But a QofEntity is an instance, QofObject is the definition and that's
> > the basis of the tables.
> True, but GncOwner is effectively a QofEntity, which was sort of my point. 


> All it does is say that the contained object is of type X with guid Y.

> I think we can solve that if we have a new type of core QofClass (or
> QofObject -- I keep forgetting the terms)

I remember it as:
QofClass for parameters, QofObject for loops. (i.e. foreach, create + compare)
clA parA    Obj, LOops.

If I want to find out about an entity, I use the class, if I want to find more 
of this kind of entity I use the object.

Kind of. (Works for me, anyway.)

So this would be an object.

> that is basically just a 
> container class.  It's effectively a special QOF type that contains other
> QofClasses.  When you output a "reference" to this container class you get
> back a tuple: <container name, contained type, guid>.

OK, we've got special QOF structs for QofBook, QofCollection, etc., this could 
be QofContainer. Holding the e_type of the contained type as char*, the guid. 
I'm not so sure about a name. It could simply have a type and GUID of it's 
own. I've already got a struct to do that for references: QofEntityReference.

QofIdType type   // The type of entity
GUID * ref_guid  // The GUID of the REFERENCE entity
const QofParam * param  // The parameter used to get/set this reference.
const GUID * ent_guid      // The GUID of the original entity.

Currently, this is populated as QSF goes through the book by object type and 
picks out those parameters that are not of the basic QOF types, string, 
boolean, date etc.

Something along those lines could be done. In effect, it's already a container 
- it's just that it only occurs in the backend.

It could be done with a different registration call. qof_container_register() 
or qof_object_container()

> This way you have one "special case" in QOF (for the Container class) and
> the application can define the "allowed" contained types for each specified
> container class.  This container class is NOT a first class object; it
> boils down to two (or three?) SQL columns (type and guid, clearly) and a
> simple embedded XML reference (type and guid).

I always hated containers!! :-) I'll ponder and come back, if you don't mind!

That's the luxury / curse of being self-taught, you tend to skip the bits that 
don't grab the attention. 

Strange how often we're dragged back to those things by some other route!


Neil Williams

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20050503/cd17b8f4/attachment.bin

More information about the gnucash-devel mailing list