Object_Private
[Object: Dynamic Object Class Framework]


Detailed Description

Private interfaces, not meant to be used by applications.

Private interfaces, not meant to be used by applications.

Private interfaces, not meant to be used by applications.


Files

file  qofbackend-p.h
 private api for data storage backend
file  qofobject-p.h
 the Core Object Registration/Lookup Private Interface

Data Structures

struct  QofBackendProvider_s
struct  QofBackend_s
struct  _QofBook

Book_Private

#define qof_book_set_guid(book, guid)   qof_entity_set_guid(QOF_ENTITY(book), guid)
void qof_book_set_backend (QofBook *book, QofBackend *be)
void qof_book_set_schedxactions (QofBook *book, GList *newList)
gboolean qof_book_register (void)

Backend_Private

Pseudo-object defining how the engine can interact with different back-ends (which may be SQL databases, or network interfaces to remote GnuCash servers. File-io is just one type of backend).

The callbacks will be called at the appropriate times during a book session to allow the backend to store the data as needed.

void qof_backend_register_provider (QofBackendProvider *)
void qof_backend_set_error (QofBackend *be, QofBackendError err)
QofBackendError qof_backend_get_error (QofBackend *be)
void qof_backend_set_message (QofBackend *be, const char *format,...)
char * qof_backend_get_message (QofBackend *be)
void qof_backend_init (QofBackend *be)
gchar qof_book_get_open_marker (QofBook *book)
gint32 qof_book_get_version (QofBook *book)
guint32 qof_book_get_idata (QofBook *book)
void qof_book_set_version (QofBook *book, gint32 version)
void qof_book_set_idata (QofBook *book, guint32 idata)

Class_Private

void qof_class_init (void)
void qof_class_shutdown (void)
QofSortFunc qof_class_get_default_sort (QofIdTypeConst obj_name)

Entity_Private

void qof_entity_set_guid (QofEntity *ent, const GUID *guid)
void qof_collection_insert_entity (QofCollection *, QofEntity *)
void qof_collection_mark_clean (QofCollection *)
void qof_collection_mark_dirty (QofCollection *)

Objects_Private

void qof_object_book_begin (QofBook *book)
void qof_object_book_end (QofBook *book)
gboolean qof_object_is_dirty (QofBook *book)
void qof_object_mark_clean (QofBook *book)


Define Documentation

#define qof_book_set_guid book,
guid   )     qof_entity_set_guid(QOF_ENTITY(book), guid)
 

Deprecated:
use qof_entity_set_guid instead but only in backends (when reading the GUID from the data source).

Definition at line 110 of file qofbook-p.h.


Function Documentation

QofBackendError qof_backend_get_error QofBackend be  ) 
 

The qof_backend_get_error() routine pops an error code off the error stack.

Definition at line 58 of file qofbackend.c.

00059 {
00060    QofBackendError err;
00061    if (!be) return ERR_BACKEND_NO_BACKEND;
00062 
00063    /* use 'stack-pop' semantics */
00064    err = be->last_err;
00065    be->last_err = ERR_BACKEND_NO_ERR;
00066    return err;
00067 }

char* qof_backend_get_message QofBackend be  ) 
 

The qof_backend_get_message() pops the error message string from the Backend. This string should be freed with g_free().

Definition at line 94 of file qofbackend.c.

00095 {
00096    char * msg;
00097    
00098    if (!be) return g_strdup("ERR_BACKEND_NO_BACKEND");
00099    if (!be->error_msg) return NULL;
00100 
00101    /* 
00102     * Just return the contents of the error_msg and then set it to
00103     * NULL.  This is necessary, because the Backends don't seem to
00104     * have a destroy_backend function to take care if freeing stuff
00105     * up.  The calling function should free the copy.
00106     * Also, this is consistent with the qof_backend_get_error() popping.
00107     */
00108 
00109    msg = be->error_msg;
00110    be->error_msg = NULL;
00111    return msg;
00112 }

void qof_backend_register_provider QofBackendProvider  ) 
 

Let the sytem know about a new provider of backends. This function is typically called by the provider library at library load time. This function allows the backend library to tell the QOF infrastructure that it can handle URL's of a certain type. Note that a single backend library may register more than one provider, if it is capable of handling more than one URL access method.

Definition at line 65 of file qofsession.c.

00066 {
00067         provider_list = g_slist_prepend (provider_list, prov);
00068 }

void qof_backend_set_error QofBackend be,
QofBackendError  err
 

The qof_backend_set_error() routine pushes an error code onto the error stack. (FIXME: the stack is 1 deep in current implementation).

Definition at line 48 of file qofbackend.c.

00049 {
00050    if (!be) return;
00051 
00052    /* use stack-push semantics. Only the earliest error counts */
00053    if (ERR_BACKEND_NO_ERR != be->last_err) return;
00054    be->last_err = err;
00055 }

void qof_backend_set_message QofBackend be,
const char *  format,
  ...
 

The qof_backend_set_message() assigns a string to the backend error message.

Definition at line 70 of file qofbackend.c.

00071 {
00072    va_list args;
00073    char * buffer;
00074    
00075    if (!be) return;
00076   
00077    /* If there's already something here, free it */
00078    if (be->error_msg) g_free(be->error_msg);
00079 
00080    if (!format) {
00081        be->error_msg = NULL;
00082        return;
00083    }
00084 
00085    va_start(args, format);
00086    buffer = (char *)g_strdup_vprintf(format, args);
00087    va_end(args);
00088 
00089    be->error_msg = buffer;
00090 }

guint32 qof_book_get_idata QofBook book  ) 
 

get the book tag number

used for kvp management in sql backends.

Definition at line 302 of file qofbook.c.

00303 {
00304         if(!book) { return 0; }
00305         return book->idata;
00306 }

gchar qof_book_get_open_marker QofBook book  ) 
 

Allow backends to see if the book is open

Returns:
'y' if book is open, otherwise 'n'.

Definition at line 290 of file qofbook.c.

00291 {
00292         if(!book) { return 'n'; }
00293         return book->book_open;
00294 }

gint32 qof_book_get_version QofBook book  ) 
 

get the book version

used for tracking multiuser updates in backends.

Returns:
-1 if no book exists, 0 if the book is new, otherwise the book version number.

Definition at line 296 of file qofbook.c.

00297 {
00298         if(!book) { return -1; }
00299         return book->version;
00300 }

void qof_book_set_schedxactions QofBook book,
GList *  newList
 

Deprecated:

void qof_collection_insert_entity QofCollection ,
QofEntity
 

Take entity, remove it from whatever collection its currently in, and place it in a new collection. To be used only for moving entity from one book to another.

Definition at line 191 of file qofid.c.

00192 {
00193   if (!col || !ent) return;
00194   if (guid_equal(&ent->guid, guid_null())) return;
00195   g_return_if_fail (col->e_type == ent->e_type);
00196   qof_collection_remove_entity (ent);
00197   g_hash_table_insert (col->hash_of_entities, &ent->guid, ent);
00198   ent->collection = col;
00199 }

void qof_collection_mark_clean QofCollection  ) 
 

reset value of dirty flag

Definition at line 334 of file qofid.c.

00335 {
00336    if (!col) return;
00337    col->is_dirty = FALSE;
00338 }

void qof_entity_set_guid QofEntity ent,
const GUID guid
 

Set the ID of the entity, over-riding the previous ID. Very dangerous, use only for file i/o work.

Definition at line 91 of file qofid.c.

00092 {
00093   QofCollection *col;
00094   if (guid_equal (guid, &ent->guid)) return;
00095 
00096   col = ent->collection;
00097   qof_collection_remove_entity (ent);
00098   ent->guid = *guid;
00099   qof_collection_insert_entity (col, ent);
00100 }

void qof_object_book_begin QofBook book  ) 
 

To be called from within the book

Definition at line 60 of file qofobject.c.

00061 {
00062   GList *l;
00063 
00064   if (!book) return;
00065   ENTER (" ");
00066   for (l = object_modules; l; l = l->next) {
00067     QofObject *obj = l->data;
00068     if (obj->book_begin)
00069       obj->book_begin (book);
00070   }
00071 
00072   /* Remember this book for later */
00073   book_list = g_list_prepend (book_list, book);
00074   LEAVE (" ");
00075 }


Generated on Fri Oct 21 15:50:00 2005 for QOF by  doxygen 1.4.5