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

Backend_Private

Pseudo-object defining how the engine can interact with different back-ends (which may be SQL databases, or network interfaces to remote QOF 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_message (QofBackend *be, const char *format,...)
char * qof_backend_get_message (QofBackend *be)
void qof_backend_init (QofBackend *be)
void qof_backend_destroy (QofBackend *be)
gchar qof_book_get_open_marker (const QofBook *book)
gint32 qof_book_get_version (const QofBook *book)
void qof_book_set_version (QofBook *book, gint32 version)

Book_Private

void qof_book_set_backend (QofBook *book, QofBackend *be)
gboolean qof_book_register (void)
#define qof_book_set_guid(book, guid)   qof_instance_set_guid(QOF_INSTANCE(book), guid)

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_collection_insert_entity (QofCollection *, QofInstance *)
void qof_collection_mark_clean (QofCollection *)
void qof_collection_mark_dirty (QofCollection *)
void qof_collection_print_dirty (const QofCollection *col, gpointer dummy)

Objects_Private

void qof_object_book_begin (QofBook *book)
void qof_object_book_end (QofBook *book)
gboolean qof_object_is_dirty (const QofBook *book)
void qof_object_mark_clean (QofBook *book)
gboolean qof_object_compliance (QofIdTypeConst type_name, gboolean warn)
 check an object can be created and supports iteration


Define Documentation

#define qof_book_set_guid ( book,
guid   )     qof_instance_set_guid(QOF_INSTANCE(book), guid)

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

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


Function Documentation

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 91 of file qofbackend.c.

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

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 61 of file qofsession.c.

00062 {
00063         provider_list = g_slist_append (provider_list, prov);
00064 }

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 68 of file qofbackend.c.

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

gchar qof_book_get_open_marker ( const QofBook book  ) 

Allow backends to see if the book is open

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

Definition at line 350 of file qofbook.c.

00351 {
00352         if(!book) { return 'n'; }
00353         return book->book_open;
00354 }

gint32 qof_book_get_version ( const 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 356 of file qofbook.c.

00357 {
00358         if(!book) { return -1; }
00359         return book->version;
00360 }

void qof_collection_insert_entity ( QofCollection ,
QofInstance  
)

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 146 of file qofid.c.

00147 {
00148   const GUID *guid;
00149 
00150   if (!col || !ent) return;
00151   guid = qof_instance_get_guid(ent);
00152   if (guid_equal(guid, guid_null())) return;
00153   g_return_if_fail (col->e_type == ent->e_type);
00154   qof_collection_remove_entity (ent);
00155   g_hash_table_insert (col->hash_of_entities, (gpointer)guid, ent);
00156   if (!qof_alt_dirty_mode)
00157     qof_collection_mark_dirty(col);
00158   qof_instance_set_collection(ent, col);
00159 }

void qof_collection_mark_clean ( QofCollection  ) 

reset value of dirty flag

Definition at line 299 of file qofid.c.

00300 {
00301    if (col) { col->is_dirty = FALSE; }
00302 }

void qof_object_book_begin ( QofBook book  ) 

To be called from within the book

Definition at line 57 of file qofobject.c.

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

gboolean qof_object_compliance ( QofIdTypeConst  type_name,
gboolean  warn 
)

check an object can be created and supports iteration

Parameters:
type_name object to check
warn If called only once per operation, pass TRUE to log objects that fail the compliance check. To prevent repeated log messages when calling more than once, pass FALSE.
Returns:
TRUE if object can be created and supports iteration, else FALSE.

Definition at line 141 of file qofobject.c.

00142 {
00143         const QofObject *obj;
00144 
00145         obj = qof_object_lookup(type_name);
00146         if((obj->create == NULL)||(obj->foreach == NULL)){
00147                 if(warn) 
00148                 {
00149                         PINFO (" Object type %s is not fully QOF compliant", obj->e_type);
00150                 }
00151                 return FALSE;
00152         }
00153         return TRUE;
00154 }


Generated on Thu Jul 3 05:07:22 2008 for GnuCash by  doxygen 1.5.2