start filling in some of the blanks

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9468 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-10-11 22:45:02 +00:00
parent 73bdc18387
commit 907d38b21e
2 changed files with 39 additions and 7 deletions

View File

@ -7,12 +7,21 @@
* Copyright (C) 2003 Linas Vepstas <linas@linas.org>
*/
#include "qofbook.h"
#include "qofid.h"
#include "qofid-p.h"
#include "qofinstance.h"
void
qof_instance_init (QofInstance *inst)
qof_instance_init (QofInstance *inst, QofBook *book)
{
inst->book = book;
inst->kvp_data = kvp_frame_new();
inst->editlevel = 0;
inst->do_free = FALSE;
inst->dirty = FALSE;
qof_entity_guid_new (qof_book_get_entity_table (book),&inst->guid);
}
void
@ -21,6 +30,20 @@ qof_instance_release (QofInstance *inst)
kvp_frame_delete (inst->kvp_data);
}
const GUID *
qof_instance_get_guid (QofInstance *inst)
{
if (!inst) return NULL;
return &inst->guid;
}
QofBook *
qof_instance_get_book (QofInstance *inst)
{
if (!inst) return NULL;
return inst->book;
}
KvpFrame*
qof_instance_get_slots (QofInstance *inst)
{

View File

@ -9,7 +9,10 @@
#ifndef QOF_INSTANCE_H
#define QOF_INSTANCE_H
#include "guid.h"
#include "kvp_frame.h"
#include "qofbook.h"
/* --- type macros --- */
/* cheesy, but will do for now, eventually should be more gtk-like, handle
@ -22,26 +25,32 @@ struct QofInstance_s
{
/*
* UNDER CONSTRUCTION!
* This is temp scaffolding for now,
* eventually, it should hold at least the following fields:
* (and maybe more, such as refrence counting...)
* This is mostly scaffolding for now,
* eventually, it may hold more fields, such as refrence counting...
*
*/
GUID guid;
QofBook * book;
KvpFrame *kvp_data;
int editlevel;
gboolean do_free;
gboolean dirty;
*/
KvpFrame *kvp_data;
};
/** Initialise the memory associated with an instance */
void qof_instance_init (QofInstance *inst);
void qof_instance_init (QofInstance *, QofBook *);
/** release the data associated with this instance. Dont actually free
* the memory associated with teh instance. */
void qof_instance_release (QofInstance *inst);
/** Return the book pointer */
QofBook * qof_instance_get_book (QofInstance *);
/* Return the GUID of this instance */
const GUID * qof_instance_get_guid (QofInstance *);
/** return the pointer to the kvp_data */
KvpFrame* qof_instance_get_slots (QofInstance *);