mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
gnc objects have a lot in common. This thingy will try to
abstract out all teh common-ness between them. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9464 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
a96b219f3d
commit
846d3e4421
@ -46,6 +46,7 @@ libgncmod_engine_la_SOURCES = \
|
|||||||
qofbook.c \
|
qofbook.c \
|
||||||
qofclass.c \
|
qofclass.c \
|
||||||
qofid.c \
|
qofid.c \
|
||||||
|
qofinstance.c \
|
||||||
qofobject.c \
|
qofobject.c \
|
||||||
qofquery.c \
|
qofquery.c \
|
||||||
qofquerycore.c \
|
qofquerycore.c \
|
||||||
@ -100,6 +101,7 @@ gncinclude_HEADERS = \
|
|||||||
qofbook.h \
|
qofbook.h \
|
||||||
qofclass.h \
|
qofclass.h \
|
||||||
qofid.h \
|
qofid.h \
|
||||||
|
qofinstance.h \
|
||||||
qofobject.h \
|
qofobject.h \
|
||||||
qofquery.h \
|
qofquery.h \
|
||||||
qofquerycore.h \
|
qofquerycore.h \
|
||||||
|
30
src/engine/qofinstance.c
Normal file
30
src/engine/qofinstance.c
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* qofinstance.c
|
||||||
|
*
|
||||||
|
* Object instance holds many common fields that most
|
||||||
|
* gnucash objects use.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2003 Linas Vepstas <linas@linas.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "qofinstance.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
qof_instance_init (QofInstance *inst)
|
||||||
|
{
|
||||||
|
inst->kvp_data = kvp_frame_new();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
qof_instance_release (QofInstance *inst)
|
||||||
|
{
|
||||||
|
kvp_frame_delete (inst->kvp_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
KvpFrame*
|
||||||
|
qof_instance_get_slots (QofInstance *inst)
|
||||||
|
{
|
||||||
|
if (!inst) return NULL;
|
||||||
|
return inst->kvp_data;
|
||||||
|
}
|
||||||
|
|
47
src/engine/qofinstance.h
Normal file
47
src/engine/qofinstance.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* qofinstance.h
|
||||||
|
*
|
||||||
|
* Object instance holds many common fields that most
|
||||||
|
* gnucash objects use.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2003 Linas Vepstas <linas@linas.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef QOF_INSTANCE_H
|
||||||
|
#define QOF_INSTANCE_H
|
||||||
|
#include "kvp_frame.h"
|
||||||
|
|
||||||
|
/* --- type macros --- */
|
||||||
|
/* cheesy, but will do for now, eventually should be more gtk-like */
|
||||||
|
#define QOF_INSTANCE(object) (&((object)->inst))
|
||||||
|
|
||||||
|
typedef struct QofInstance_s QofInstance;
|
||||||
|
|
||||||
|
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...)
|
||||||
|
*
|
||||||
|
GUID guid;
|
||||||
|
QofBook * book;
|
||||||
|
int editlevel;
|
||||||
|
gboolean do_free;
|
||||||
|
gboolean dirty;
|
||||||
|
*/
|
||||||
|
KvpFrame *kvp_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Initialise the memory associated with an instance */
|
||||||
|
void qof_instance_init (QofInstance *inst);
|
||||||
|
|
||||||
|
/** release the data associated with this instance. Dont actually free
|
||||||
|
* the memory associated with teh instance. */
|
||||||
|
void qof_instance_release (QofInstance *inst);
|
||||||
|
|
||||||
|
/** return the pointer to the kvp_data */
|
||||||
|
KvpFrame* qof_instance_get_slots (QofInstance *);
|
||||||
|
|
||||||
|
#endif /* QOF_INSTANCE_H */
|
Loading…
Reference in New Issue
Block a user