QOF  0.7.5
Object_Private

Data Structures

struct  QofBackendProvider_s
struct  QofBackend_s
struct  _QofBook

Files

file  qofbackend-p.h
 

private api for data storage backend


file  qofbook-p.h
 

Private QofBook interface.


file  qofobject-p.h
 

the Core Object Registration/Lookup Private Interface


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_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)

Book_Private

void qof_book_set_backend (QofBook *book, QofBackend *be)
 Set the backend used by this book.
gboolean qof_book_register (void)

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)
gboolean qof_object_compliance (QofIdTypeConst type_name, gboolean warn)
 check an object can be created and supports iteration

Detailed Description

Private interfaces, not meant to be used by applications.


Function Documentation

void qof_backend_init ( QofBackend be)
Deprecated:
Deprecated:

Definition at line 37 of file qofbackend.c.

{
    be->session_begin = NULL;
    be->session_end = NULL;
    be->destroy_backend = NULL;
    be->load = NULL;
    be->begin = NULL;
    be->commit = NULL;
    be->rollback = NULL;
    be->compile_query = NULL;
    be->free_query = NULL;
    be->run_query = NULL;
    be->sync = NULL;
    be->load_config = NULL;
    be->events_pending = NULL;
    be->process_events = NULL;
    be->percentage = NULL;
    be->backend_configuration = kvp_frame_new ();
#ifndef QOF_DISABLE_DEPRECATED
    be->last_err = QOF_SUCCESS;
    if (be->error_msg)
        g_free (be->error_msg);
    be->error_msg = NULL;
    be->price_lookup = NULL;
    be->export = NULL;
#endif
}

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

{
    provider_list = g_slist_prepend (provider_list, prov);
}
guint32 qof_book_get_idata ( QofBook book)

get the book tag number

used for kvp management in sql backends.

Definition at line 295 of file qofbook.c.

{
    if (!book)
    {
        return 0;
    }
    return book->idata;
}
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 275 of file qofbook.c.

{
    if (!book)
    {
        return 'n';
    }
    return book->book_open;
}
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 285 of file qofbook.c.

{
    if (!book)
    {
        return -1;
    }
    return book->version;
}
gboolean qof_book_register ( void  )

Register books with the framework

Definition at line 376 of file qofbook.c.

{
    static QofParam params[] = {
        {QOF_PARAM_GUID, QOF_TYPE_GUID,
                (QofAccessFunc) qof_entity_get_guid,
            NULL, NULL},
        {QOF_PARAM_KVP, QOF_TYPE_KVP,
                (QofAccessFunc) qof_instance_get_slots,
            NULL, NULL},
        {NULL, NULL, NULL, NULL, NULL},
    };

    qof_class_register (QOF_ID_BOOK, NULL, params);

    return TRUE;
}
void qof_book_set_backend ( QofBook book,
QofBackend be 
)

Set the backend used by this book.

qof_book_set_backend() is used by backends to initialize the pointers in the book structure to something that contains actual data. These routines should not be used otherwise. (Its somewhat questionable if the backends should even be doing this much, but for backwards compatibility, we leave these here.)

Should only be used within a backend itself.

Definition at line 170 of file qofbook.c.

{
    if (!book)
        return;
    ENTER ("book=%p be=%p", book, be);
    book->backend = be;
    LEAVE (" ");
}

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

{
    if (!col || !ent)
        return;
    if (guid_equal (&ent->guid, guid_null ()))
        return;
    g_return_if_fail (col->e_type == ent->e_type);
    qof_collection_remove_entity (ent);
    g_hash_table_insert (col->hash_of_entities, &ent->guid, ent);
    qof_collection_mark_dirty (col);
    ent->collection = col;
}

reset value of dirty flag

Definition at line 368 of file qofid.c.

{
    if (col)
    {
        col->is_dirty = FALSE;
    }
}
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 92 of file qofid.c.

{
    QofCollection *col;
    if (guid_equal (guid, &ent->guid))
        return;

    col = ent->collection;
    qof_collection_remove_entity (ent);
    ent->guid = *guid;
    qof_collection_insert_entity (col, ent);
}
void qof_object_book_begin ( QofBook book)

To be called from within the book

Definition at line 60 of file qofobject.c.

{
    GList *l;

    if (!book)
        return;
    ENTER (" ");
    for (l = object_modules; l; l = l->next)
    {
        QofObject *obj = l->data;
        if (obj->book_begin)
            obj->book_begin (book);
    }

    /* Remember this book for later */
    book_list = g_list_prepend (book_list, book);
    LEAVE (" ");
}
gboolean qof_object_compliance ( QofIdTypeConst  type_name,
gboolean  warn 
)

check an object can be created and supports iteration

Parameters:
type_nameobject to check
warnIf 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 155 of file qofobject.c.

{
    const QofObject *obj;

    obj = qof_object_lookup (type_name);
    if ((obj->create == NULL) || (obj->foreach == NULL))
    {
        if (warn)
        {
            PINFO (" Object type %s is not fully QOF compliant",
                obj->e_type);
        }
        return FALSE;
    }
    return TRUE;
}