Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Book
[Object: Dynamic Object Class Framework]


Detailed Description

A QOF Book is a dataset. It provides a single handle through which all the various collections of entities can be found. In particular, given only the type of the entity, the collection can be found.

Books also provide the 'natural' place to working with a storage backend, as a book can encapsulate everything held in storage.


Files

file  qofbook.h
 Encapsulate all the information about a dataset.


Defines

#define QOF_BOOK_LOOKUP_ENTITY(book, guid, e_type, c_type)
 Encapsulates all the information about a dataset manipulated by GnuCash. This is the top-most structure used for anchoring data.

#define QOF_BOOK_KVP   "qof-kvp"
#define qof_book_get_guid(X)   qof_entity_get_guid (QOF_ENTITY(X))

Typedefs

typedef _QofBook QofBook
typedef GList QofBookList
typedef void(* QofCollectionForeachCB )(QofCollection *, gpointer user_data)

Functions

gboolean qof_book_register (void)
QofBookqof_book_new (void)
void qof_book_destroy (QofBook *book)
QofCollection * qof_book_get_collection (QofBook *, QofIdType)
void qof_book_foreach_collection (QofBook *, QofCollectionForeachCB, gpointer)
KvpFrameqof_book_get_slots (QofBook *book)
void qof_book_set_data (QofBook *book, const char *key, gpointer data)
gpointer qof_book_get_data (QofBook *book, const char *key)
QofBackendqof_book_get_backend (QofBook *book)
void qof_book_set_backend (QofBook *book, QofBackend *)
gboolean qof_book_not_saved (QofBook *book)
void qof_book_kvp_changed (QofBook *book)
gboolean qof_book_equal (QofBook *book_1, QofBook *book_2)
gint64 qof_book_get_counter (QofBook *book, const char *counter_name)


Define Documentation

#define qof_book_get_guid  )     qof_entity_get_guid (QOF_ENTITY(X))
 

deprecated

#define QOF_BOOK_LOOKUP_ENTITY book,
guid,
e_type,
c_type   ) 
 

Value:

({  \
  QofEntity *val = NULL;                                    \
  if (guid && book) {                                       \
    QofCollection *col;                                     \
    col = qof_book_get_collection (book, e_type);           \
    val = qof_collection_lookup_entity (col, guid);         \
  }                                                         \
  (c_type *) val;                                           \
})
Encapsulates all the information about a dataset manipulated by GnuCash. This is the top-most structure used for anchoring data.

Lookup an entity by guid, returning pointer to the entity


Typedef Documentation

typedef GList QofBookList
 

GList of QofBook

typedef void(* QofCollectionForeachCB)(QofCollection *, gpointer user_data)
 

Invoke the indicated callback on each collection in the book.


Function Documentation

void qof_book_destroy QofBook book  ) 
 

End any editing sessions associated with book, and free all memory associated with it.

gboolean qof_book_equal QofBook book_1,
QofBook book_2
 

The qof_book_equal() method returns TRUE if books are equal. XXX this routine is broken, and does not currently compare data.

QofBackend* qof_book_get_backend QofBook book  ) 
 

DOCUMENT ME!

QofCollection* qof_book_get_collection QofBook ,
QofIdType 
 

Returns:
The table of entities of the given type. If the collection doesn't yet exist for the indicated type, it is created. Thus, this routine is gaurenteed to return a non-NULL value. (Unless the system malloc failed (out of memory) in which case what happens??).

gint64 qof_book_get_counter QofBook book,
const char *  counter_name
 

This will 'get and increment' the named counter for this book. The return value is -1 on error or the incremented counter.

gpointer qof_book_get_data QofBook book,
const char *  key
 

Retreives arbitrary pointers to structs stored by qof_book_set_data.

KvpFrame* qof_book_get_slots QofBook book  ) 
 

Returns:
The kvp data for the book

void qof_book_kvp_changed QofBook book  ) 
 

Call this function when you change the book kvp, to make sure the book is marked 'dirty'.

QofBook* qof_book_new void   ) 
 

Allocate, initialise and return a new QofBook. Books contain references to all of the top-level object containers.

gboolean qof_book_not_saved QofBook book  ) 
 

qof_book_not_saved() will return TRUE if any data in the book hasn't been saved to long-term storage. (Actually, that's not quite true. The book doesn't know anything about saving. Its just that whenever data is modified, the 'dirty' flag is set. This routine returns the value of the 'dirty' flag. Its up to the backend to periodically reset this flag, when it acutally does save the data.)

gboolean qof_book_register void   ) 
 

Register books with the engine

void qof_book_set_data QofBook book,
const char *  key,
gpointer  data
 

The qof_book_set_data() allows arbitrary pointers to structs to be stored in QofBook. This is the "prefered" method for extending QofBook to hold new data types.

XXX FIXME: we need to add a destroy callback, so that when the book gets destroyed, the user gets notified and thus has a chance to clean up.


Generated on Sun May 23 15:41:48 2004 for QOF by doxygen 1.3.6-20040222