QOF iteration and callbacks

Derek Atkins warlord at MIT.EDU
Fri Jun 18 16:49:37 EDT 2004

Neil Williams <linux at codehelp.co.uk> writes:

> "one can then ask, at run time, what parameters are associated with a given 
> type, even if those parameters were not known at compile time."
> src/doc/html/group__Class.html

Yes, at this point there are no APIs to implement this.  

> I can see how to query individual parameters from qofclass when you know the 
> name and I've got access to the getter and setter func's - what I'm looking 
> at now is a generic way to read back everything originally set by 
> qof_class_register - to build a complete list of all registered objects, 
> types and data. This will be the core of the rules and it has to cover 
> everything possible in a GNCBook - and as agreed already, without requiring 
> any objects to be re-defined in code, it's all run-time stuff. I can see how 
> qof_class_register reads the params into a GHashTable - how do I read the 
> entire hashtable back?

Right now none exists.

> I've looked at:
> GSList * qof_query_build_param_list (char const *param, ...);
> haven't got it right yet though. It looks more like something I'd need later 
> to look for a match in the second book prior to comparison.

Nah, this is a helper function to build a parameter list.  Look at the
return value, a GSList..  That should give a clue as to what this
function is doing (building a list).

> I've got access to the GUID's, the QofIdType's and almost everything else. I'm 
> hoping I don't have to copy a whole batch of these sections from the source 
> tree:
> /** @name Account parameter names */
> /** @{ */
> #define ACCOUNT_KVP		"kvp"
> #define ACCOUNT_NAME_		"name"
> #define ACCOUNT_CODE_		"code"
> #define ACCOUNT_DESCRIPTION_	"desc"
> #define ACCOUNT_NOTES_		"notes"
> #define ACCOUNT_BALANCE_	"balance"
> #define ACCOUNT_CLEARED_	"cleared"
> #define ACCOUNT_RECONCILED_	"reconciled"
> #define ACCOUNT_PRESENT_	"present"
> #define ACCOUNT_FUTURE_MINIMUM_ "future-minimum"
> #define ACCOUNT_TAX_RELATED	"tax-related-p"
> /** @} */
> when they are all already loaded:
> gboolean xaccAccountRegister (void)
> {
>   static QofParam params[] = {}
> }

Right now this is what you need to do.


       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-devel mailing list