| libdexterplugin Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Prerequisites | ||||
#include <dexterplugin.h>
DexterPluginIConfig;
struct DexterPluginIConfigInterface;
gboolean dexterplugin_iconfig_has_group (DexterPluginIConfig *iconfig,
const gchar *group);
gboolean dexterplugin_iconfig_get_groups (DexterPluginIConfig *iconfig,
gchar ***return_groups,
gsize *length);
gboolean dexterplugin_iconfig_get_keys (DexterPluginIConfig *iconfig,
const gchar *group,
gchar ***return_keys,
gsize *length,
GError **error);
gboolean dexterplugin_iconfig_get_string (DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gchar **return_string,
GError **error);
gboolean dexterplugin_iconfig_get_string_list
(DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gchar ***return_strings,
gsize *length,
GError **error);
gboolean dexterplugin_iconfig_get_boolean (DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gboolean *return_boolean,
GError **error);
gboolean dexterplugin_iconfig_get_boolean_list
(DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gboolean **return_booleans,
gsize *length,
GError **error);
gboolean dexterplugin_iconfig_get_integer (DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gint *return_integer,
GError **error);
gboolean dexterplugin_iconfig_get_integer_list
(DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gint **return_integers,
gsize *length,
GError **error);
gboolean dexterplugin_iconfig_key_error (DexterPluginIConfig *iconfig,
GError *error);
Plugins can access the configuration file from this interface.
Example demonstrating how plugins can access the configuration file:
#include <dexterplugin.h>
#define MY_SERVICE_UUID "86127315-6de6-43cd-a835-fbd25476390d"
void some_plugin_function ()
{
gchar *important_key;
/* Obtain key "Important" in config file section [86127315-6de6-43cd-a835-fbd25476390d]. */
if (!dexterplugin_iconfig_get_string (DEXTER_ICONFIG,
MY_SERVICE_UUID, "Important",
&important_key, NULL))
{
g_warning ("Important key not found");
...
}
/* use important_key and when done, free it. */
g_free (important_key);
}
typedef struct _DexterPluginIConfig DexterPluginIConfig;
The configuration file interface.
struct DexterPluginIConfigInterface {
/* virtual methods */
gboolean (*has_group) (DexterPluginIConfig *iconfig,
const gchar *group);
gboolean (*get_groups) (DexterPluginIConfig *iconfig,
gchar ***return_groups,
gsize *length);
gboolean (*get_keys) (DexterPluginIConfig *iconfig,
const gchar *group,
gchar ***return_keys,
gsize *length,
GError **error);
gboolean (*get_string) (DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gchar **return_string,
GError **error);
gboolean (*get_string_list) (DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gchar ***return_strings,
gsize *length,
GError **error);
gboolean (*get_boolean) (DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gboolean *return_boolean,
GError **error);
gboolean (*get_boolean_list) (DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gboolean **return_booleans,
gsize *length,
GError **error);
gboolean (*get_integer) (DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gint *return_integer,
GError **error);
gboolean (*get_integer_list) (DexterPluginIConfig *iconfig,
const gchar *group,
const gchar *key,
gint **return_integers,
gsize *length,
GError **error);
gboolean (*key_error) (DexterPluginIConfig *iconfig,
GError *error);
};
Definition of the configuration file interface.
gboolean dexterplugin_iconfig_has_group (DexterPluginIConfig *iconfig,const gchar *group);
Returns whether or not the specified group exists in the config file.
|
a DexterPluginIConfig. |
|
gchar group name within the config file. |
Returns : |
gboolean indicating if group is in the config file or not. |
gboolean dexterplugin_iconfig_get_groups (DexterPluginIConfig *iconfig,gchar ***return_groups,gsize *length);
Sets return_groups to a list of all groups in the config file.
Use g_strfreev() to free *return_groups.
|
a DexterPluginIConfig. |
|
address of a (gchar **) return pointer to hold list of groups. |
|
address of optional gsize to hold number of groups returned, or NULL. |
Returns : |
gboolean indicating success or failure. |
gboolean dexterplugin_iconfig_get_keys (DexterPluginIConfig *iconfig,const gchar *group,gchar ***return_keys,gsize *length,GError **error);
Sets return_keys to a list of all keys in the config file for the specified group.
Use g_strfreev() to free *return_keys.
|
a DexterPluginIConfig. |
|
gchar group name within the config file. |
|
address of a (gchar **) return pointer to hold list of keys. |
|
address of optional gsize to hold number of keys returned, or NULL. |
|
return location for optional GError. |
Returns : |
gboolean indicating success or failure. |
gboolean dexterplugin_iconfig_get_string (DexterPluginIConfig *iconfig,const gchar *group,const gchar *key,gchar **return_string,GError **error);
Sets return_string to the key value in the config file for the specified group and key.
Use g_free() to free *return_string.
gboolean dexterplugin_iconfig_get_string_list (DexterPluginIConfig *iconfig,const gchar *group,const gchar *key,gchar ***return_strings,gsize *length,GError **error);
Sets return_strings to a key value list in the config file for the specified group and key.
Use g_strfreev() to free *return_strings.
|
a DexterPluginIConfig. |
|
gchar group name within the config file. |
|
gchar key name within the config file. |
|
address of a (gchar **) return pointer to hold key value list. |
|
address of optional gsize to hold number of strings returned, or NULL. |
|
return location for optional GError. |
Returns : |
gboolean indicating success or failure. |
gboolean dexterplugin_iconfig_get_boolean (DexterPluginIConfig *iconfig,const gchar *group,const gchar *key,gboolean *return_boolean,GError **error);
Sets return_boolean to the key value in the config file for the specified group and key.
gboolean dexterplugin_iconfig_get_boolean_list (DexterPluginIConfig *iconfig,const gchar *group,const gchar *key,gboolean **return_booleans,gsize *length,GError **error);
Sets return_booleans to a key value list in the config file for the specified group and key.
Use g_free() to free *return_booleans.
|
a DexterPluginIConfig. |
|
gchar group name within the config file. |
|
gchar key name within the config file. |
|
address of a (gboolean *) return pointer to hold key value list. |
|
address of optional gsize to hold number of booleans returned, or NULL. |
|
return location for optional GError. |
Returns : |
gboolean indicating success or failure. |
gboolean dexterplugin_iconfig_get_integer (DexterPluginIConfig *iconfig,const gchar *group,const gchar *key,gint *return_integer,GError **error);
Sets return_integer to the key value in the config file for the specified group and key.
gboolean dexterplugin_iconfig_get_integer_list (DexterPluginIConfig *iconfig,const gchar *group,const gchar *key,gint **return_integers,gsize *length,GError **error);
Sets return_integers to a key value list in the config file for the specified group and key.
Use g_free() to free *return_integers.
|
a DexterPluginIConfig. |
|
gchar group name within the config file. |
|
gchar key name within the config file. |
|
address of a (gint *) return pointer to hold key value list. |
|
address of optional gsize to hold number of integers returned, or NULL. |
|
return location for optional GError. |
Returns : |
gboolean indicating success or failure. |
gboolean dexterplugin_iconfig_key_error (DexterPluginIConfig *iconfig,GError *error);
Returns whether or not the specified GError is a key error indicating that the group or key was not found.
|
a DexterPluginIConfig. |
|
a GError from a previous operation. |
Returns : |
gboolean indicating if the specified GError is a key error. |