31 #define QOF_CONFIG_DESC "desc" 32 #define QOF_CONFIG_TIP "tip" 39 be->session_begin = NULL;
40 be->session_end = NULL;
41 be->destroy_backend = NULL;
46 be->compile_query = NULL;
47 be->free_query = NULL;
50 be->load_config = NULL;
51 be->events_pending = NULL;
52 be->process_events = NULL;
53 be->percentage = NULL;
64 (be->begin) (be, inst);
83 (be->commit) (be, inst);
91 g_return_if_fail (be);
108 g_return_if_fail (be || option);
109 count = be->config_count;
112 switch (option->
type)
116 value = kvp_value_new_gint64 (*(gint64 *) option->
value);
121 value = kvp_value_new_double (*(gdouble *) option->
value);
131 value = kvp_value_new_string ((
const gchar *) option->
value);
162 temp = g_strdup_printf (
"/%s", option->
option_name);
166 g_strdup_printf (
"/%s/%s", QOF_CONFIG_DESC,
172 g_strdup_printf (
"/%s/%s", QOF_CONFIG_TIP,
178 be->config_count = count;
185 g_return_val_if_fail (be, NULL);
186 be->config_count = 0;
187 return be->backend_configuration;
190 struct config_iterate
203 config_foreach_cb (
const gchar * key,
KvpValue * value, gpointer data)
210 struct config_iterate *helper;
212 g_return_if_fail (key || value || data);
213 helper = (
struct config_iterate *) data;
214 if (!helper->recursive)
216 PERR (
" no parent frame");
228 ENTER (
" key=%s", key);
230 option.
type = kvp_value_get_type (value);
238 option.
value = (gpointer) & int64;
243 db = kvp_value_get_double (value);
244 option.
value = (gpointer) & db;
249 num = kvp_value_get_numeric (value);
250 option.
value = (gpointer) & num;
260 option.
value = (gpointer) kvp_value_get_time (value);
283 parent = g_strdup_printf (
"/%s/%s", QOF_CONFIG_DESC, key);
284 option.
description = kvp_frame_get_string (helper->recursive, parent);
286 parent = g_strdup_printf (
"/%s/%s", QOF_CONFIG_TIP, key);
287 option.
tooltip = kvp_frame_get_string (helper->recursive, parent);
291 helper->fcn (&option, helper->data);
297 (*(gint64 *) option.
value));
303 (*(gdouble *) option.
value));
315 (gchar *) option.
value);
352 struct config_iterate helper;
360 helper.recursive = config;
370 if (!be->load_config)
372 (be->load_config) (be, config);
382 return (be->get_config) (be);
398 const gchar * filename,
const gchar * init_fcn)
401 typedef void (*backend_init) (void);
403 backend_init gmod_init;
406 g_return_val_if_fail (g_module_supported (), FALSE);
407 fullpath = g_module_build_path (directory, filename);
408 backend = g_module_open (fullpath, G_MODULE_BIND_LAZY);
411 PERR (
" No backend found. %s", g_module_error ());
415 if (!g_module_symbol (backend, init_fcn, g))
417 PERR (
" Backend did not initialise. %s", g_module_error ());
420 g_module_make_resident (backend);
#define PERR(format, args...)
void kvp_frame_set_numeric(KvpFrame *frame, const gchar *path, QofNumeric nval)
store the value of the QofNumeric at the indicated path.
void kvp_frame_set_time(KvpFrame *frame, const gchar *path, QofTime *qt)
Store a copy of the QofTime at the indicated path.
const gchar * description
struct _KvpFrame KvpFrame
void kvp_frame_set_gint64(KvpFrame *frame, const gchar *path, gint64 ival)
store the value of the gint64 at the indicated path.
gboolean qof_load_backend_library(const gchar *directory, const gchar *filename, const gchar *init_fcn)
Load a QOF-compatible backend shared library.
KvpFrame * qof_backend_complete_frame(QofBackend *be)
gboolean kvp_frame_is_empty(KvpFrame *frame)
void(* QofBackendOptionCB)(QofBackendOption *, gpointer data)
#define LEAVE(format, args...)
KvpFrame * kvp_frame_set_value(KvpFrame *frame, const gchar *key_path, const KvpValue *value)
Copy the KvpValue into the frame.
128bit denominator/numerator maths.
void kvp_frame_delete(KvpFrame *frame)
gint64 kvp_value_get_gint64(const KvpValue *value)
struct _KvpValue KvpValue
void qof_backend_prepare_option(QofBackend *be, QofBackendOption *option)
void qof_backend_option_foreach(KvpFrame *config, QofBackendOptionCB cb, gpointer data)
const gchar * option_name
gchar * kvp_value_get_string(const KvpValue *value)
KvpFrame * qof_backend_get_config(QofBackend *be)
Get the available configuration options.
void kvp_frame_for_each_slot(KvpFrame *f, KvpValueForeachCB proc, gpointer data)
private api for data storage backend
struct QofTime64 QofTime
Use a 64-bit signed int QofTime.
void kvp_frame_set_double(KvpFrame *frame, const gchar *path, gdouble dval)
store the value of the double at the indicated path.
KvpFrame * kvp_frame_new(void)
gint safe_strcmp(const gchar *da, const gchar *db)
void qof_backend_load_config(QofBackend *be, KvpFrame *config)
Load configuration options specific to this backend.
#define ENTER(format, args...)
const gchar * QofLogModule
void kvp_frame_set_string(KvpFrame *frame, const gchar *path, const gchar *str)
Store a copy of the string at the indicated path.
64bit time/date handling.
void qof_backend_prepare_frame(QofBackend *be)