linas at linas.org
Mon May 3 11:07:05 EDT 2004
FYI, there are now two example progs on the web:
Although neither directly adress your question.
On Mon, May 03, 2004 at 10:33:32AM +0100, Neil Williams was heard to remark:
> I can't get this clear and I can't find any documentation on exactly how to
> iterate over the existing, registered, GnuCash objects. At the moment, QOF
> isn't make a whole lot of sense. Do I have to create and register yet another
> object to query the invoice object?
> If not, how do I access the foreach
> routine for GncInvoice?
I think qof_object_foreach() should also work (and should be easier to
get at and use than qof_collection_foreach().)
> Where's the documentation for using QOF and Gnucash together?
In theory, the docs should auto build with doxygen
I think you need to
configure --enable-doxygen or --enable-dot
These docs may be, um minimal.
> GncInvoice *firstinvoice = gncInvoiceCreate (testbook);
> gncInvoiceSetID(firstinvoice, "1001");
> GncInvoice *secondinvoice = gncInvoiceCreate (testbook);
> gncInvoiceSetID(secondinvoice, "2002");
> printf("Invoice ID: %s\n", gncInvoiceGetID(firstinvoice));
> QofCollection *coll = qof_book_get_collection (testbook, GNC_ID_INVOICE);
> printf("Coll data type: %s\n",qof_collection_get_type(coll));
/** Call the callback for each entity in the collection. */
void qof_collection_foreach (QofCollection *,
QofEntityForeachCB, gpointer user_data);
typedef void (*QofEntityForeachCB) (QofEntity *, gpointer user_data);
You'll need to upcast the entity to gncInvoice.
I'll accept working, compilable example code for the qof/examples
directory. Also, diffs to the .h files where most documentation
pub 1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas at linas.org>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984 3F54 64A9 9A82 0104 5933
More information about the gnucash-devel