Public Attributes

mcs_backend_t Struct Reference

Contains the vtable and some references for an mcs storage backend. More...

#include <mcs.h>

List of all members.

Public Attributes

void * handle
const char * name
 The unique name identifying the backend.
mcs_handle_t *(* mcs_new )(char *domain)
 Creates a new mcs.handle object.
void(* mcs_destroy )(mcs_handle_t *handle)
 Implementation-specific destructor function.
mcs_response_t(* mcs_get_string )(mcs_handle_t *handle, const char *section, const char *key, char **value)
 Retrieves a string from the configuration backend.
mcs_response_t(* mcs_get_int )(mcs_handle_t *handle, const char *section, const char *key, int *value)
 Retrieves an integer from the configuration backend.
mcs_response_t(* mcs_get_bool )(mcs_handle_t *handle, const char *section, const char *key, int *value)
 Retrieves a boolean value from the configuration backend.
mcs_response_t(* mcs_get_float )(mcs_handle_t *handle, const char *section, const char *key, float *value)
 Retrieves a float value from the configuration backend.
mcs_response_t(* mcs_get_double )(mcs_handle_t *handle, const char *section, const char *key, double *value)
 Retrieves a double-precision float value from the configuration backend.
mcs_response_t(* mcs_set_string )(mcs_handle_t *handle, const char *section, const char *key, const char *value)
 Sets a string value in the configuration backend.
mcs_response_t(* mcs_set_int )(mcs_handle_t *handle, const char *section, const char *key, int value)
 Sets an integer value in the configuration backend.
mcs_response_t(* mcs_set_bool )(mcs_handle_t *handle, const char *section, const char *key, int value)
 Sets a boolean value in the configuration backend.
mcs_response_t(* mcs_set_float )(mcs_handle_t *handle, const char *section, const char *key, float value)
 Sets a floating point value in the configuration backend.
mcs_response_t(* mcs_set_double )(mcs_handle_t *handle, const char *section, const char *key, double value)
 Sets a double-precision floating point value in the configuration backend.
mcs_response_t(* mcs_unset_key )(mcs_handle_t *handle, const char *section, const char *key)
 Removes a value from the configuration backend.
mowgli_queue_t *(* mcs_get_keys )(mcs_handle_t *handle, const char *section)
 Returns a deque of keys associated with a section.
mowgli_queue_t *(* mcs_get_sections )(mcs_handle_t *handle)
 Returns a deque of sections associated with the config backend.

Detailed Description

Contains the vtable and some references for an mcs storage backend.

Storage backends are provided by modules which are loaded during mcs_init().

Your typical storage backend will include at least these functions, although the backend interface may and likely will change in mcs2. That is being considered for later, though, so you should write backends compliant to this API for now.

For some example backends, look in the MCS source.


Member Data Documentation

dlopen(3) handle, filled in by mcs.

Referenced by mcs_load_plugins(), and mcs_unload_plugins().

Implementation-specific destructor function.

This is the destructor for your mcs.handle sub-class. Base mowgli.object work has already been done by the time this is called, therefore mowgli.object work should be avoided here.

Parameters:
handle A mcs.handle object to deinitialise.
mcs_response_t(* mcs_backend_t::mcs_get_bool)(mcs_handle_t *handle, const char *section, const char *key, int *value)

Retrieves a boolean value from the configuration backend.

Parameters:
handle A mcs.handle object to search for the key in.
section A section name to look for the key in.
key The name of the key to look up.
value A pointer to the memory location to put the value in.
mcs_response_t(* mcs_backend_t::mcs_get_double)(mcs_handle_t *handle, const char *section, const char *key, double *value)

Retrieves a double-precision float value from the configuration backend.

Parameters:
handle A mcs.handle object to search for the key in.
section A section name to look for the key in.
key The name of the key to look up.
value A pointer to the memory location to put the value in.
mcs_response_t(* mcs_backend_t::mcs_get_float)(mcs_handle_t *handle, const char *section, const char *key, float *value)

Retrieves a float value from the configuration backend.

Parameters:
handle A mcs.handle object to search for the key in.
section A section name to look for the key in.
key The name of the key to look up.
value A pointer to the memory location to put the value in.
mcs_response_t(* mcs_backend_t::mcs_get_int)(mcs_handle_t *handle, const char *section, const char *key, int *value)

Retrieves an integer from the configuration backend.

Parameters:
handle A mcs.handle object to search for the key in.
section A section name to look for the key in.
key The name of the key to look up.
value A pointer to the memory location to put the value in.
mowgli_queue_t*(* mcs_backend_t::mcs_get_keys)(mcs_handle_t *handle, const char *section)

Returns a deque of keys associated with a section.

Parameters:
handle A mcs.handle object to get the keys from.
section A section name to get the keys from.

Returns a deque of sections associated with the config backend.

Parameters:
handle A mcs.handle object to get the sections from.
mcs_response_t(* mcs_backend_t::mcs_get_string)(mcs_handle_t *handle, const char *section, const char *key, char **value)

Retrieves a string from the configuration backend.

Parameters:
handle A mcs.handle object to search for the key in.
section A section name to look for the key in.
key The name of the key to look up.
value A pointer to the memory location to put the value in.

Creates a new mcs.handle object.

The mcs.handle object returned by this function is not fully initialized in this function, base mowgli.object work is done in the primary constructor. This just creates the derived class which is presented to the user as mcs.handle.

As such, you should avoid mowgli.object functions in both the constructor and destructor vtable functions.

Parameters:
domain A string representing the domain to associate with.

Referenced by mcs_new().

mcs_response_t(* mcs_backend_t::mcs_set_bool)(mcs_handle_t *handle, const char *section, const char *key, int value)

Sets a boolean value in the configuration backend.

Parameters:
handle A mcs.handle object to add the key to.
section A section name to add the key to.
key The name of the key to add.
value The value the key should have.
mcs_response_t(* mcs_backend_t::mcs_set_double)(mcs_handle_t *handle, const char *section, const char *key, double value)

Sets a double-precision floating point value in the configuration backend.

Parameters:
handle A mcs.handle object to add the key to.
section A section name to add the key to.
key The name of the key to add.
value The value the key should have.
mcs_response_t(* mcs_backend_t::mcs_set_float)(mcs_handle_t *handle, const char *section, const char *key, float value)

Sets a floating point value in the configuration backend.

Parameters:
handle A mcs.handle object to add the key to.
section A section name to add the key to.
key The name of the key to add.
value The value the key should have.
mcs_response_t(* mcs_backend_t::mcs_set_int)(mcs_handle_t *handle, const char *section, const char *key, int value)

Sets an integer value in the configuration backend.

Parameters:
handle A mcs.handle object to add the key to.
section A section name to add the key to.
key The name of the key to add.
value The value the key should have.
mcs_response_t(* mcs_backend_t::mcs_set_string)(mcs_handle_t *handle, const char *section, const char *key, const char *value)

Sets a string value in the configuration backend.

Parameters:
handle A mcs.handle object to add the key to.
section A section name to add the key to.
key The name of the key to add.
value The value the key should have.
mcs_response_t(* mcs_backend_t::mcs_unset_key)(mcs_handle_t *handle, const char *section, const char *key)

Removes a value from the configuration backend.

Parameters:
handle A mcs.handle object to remove the key from.
section A section name to remove the key from.
key The name of the key to remove.
const char* mcs_backend_t::name

The unique name identifying the backend.

This is the name of the backend, e.g. KDE's KConfig storage system would be called "kconfig". It is used to uniquely identify the storage backend so that it can be selected in via policies and programatically.

Custom backends should use an application-specific name unless they have global scope. In any case, the name should be unique.

Referenced by mcs_backend_select(), and mcs_new().


The documentation for this struct was generated from the following file: