Top |
Module - AccessorModule - Accessor — A module class to extend features in lt_extension_t. |
int | (*lt_ext_module_version_func_t) () |
const lt_ext_module_funcs_t * | (*lt_ext_module_get_funcs_func_t) () |
char | (*lt_ext_module_singleton_func_t) () |
lt_ext_module_data_t * | (*lt_ext_module_data_new_func_t) () |
lt_bool_t | (*lt_ext_module_precheck_func_t) () |
lt_bool_t | (*lt_ext_module_parse_func_t) () |
char * | (*lt_ext_module_get_tag_func_t) () |
lt_bool_t | (*lt_ext_module_validate_func_t) () |
void | lt_ext_modules_load () |
void | lt_ext_modules_unload () |
lt_ext_module_t * | lt_ext_module_ref () |
void | lt_ext_module_unref () |
#define | LT_MODULE_SYMBOL() |
#define | LT_MODULE_SYMBOL_() |
#define | LT_MODULE_SYMBOL__() |
int | module_get_version () |
const lt_ext_module_funcs_t * | module_get_funcs () |
#define | LT_EXT_MODULE_VERSION |
#define | LT_CONST_DECL |
struct | lt_ext_module_funcs_t |
lt_ext_module_t |
This class provides functionality to extend features in lt_extension_t, such as validating tags more strictly.
int
(*lt_ext_module_version_func_t) (void
);
The type of the module_get_version()
that is required to implement
an extension module.
const lt_ext_module_funcs_t *
(*lt_ext_module_get_funcs_func_t) (void
);
The type of the module_get_funcs()
that is required to implement
an extension module.
char
(*lt_ext_module_singleton_func_t) (void
);
The type of the callback function used to obtain a singleton character for Extension subtag that the module would support.
lt_ext_module_data_t *
(*lt_ext_module_data_new_func_t) (void
);
The type of the callback function used to create a new instance of lt_ext_module_data_t. This is invoked when new Extension subtag appears and keep data.
lt_bool_t (*lt_ext_module_precheck_func_t) (lt_ext_module_data_t *data
,const lt_tag_t *tag
,lt_error_t **error
);
The type of the callback function used to check tag
prior to process
parsing subtags for the extension.
lt_bool_t (*lt_ext_module_parse_func_t) (lt_ext_module_data_t *data
,const char *subtag
,lt_error_t **error
);
The type of the callback function used to parse tags.
char *
(*lt_ext_module_get_tag_func_t) (lt_ext_module_data_t *data
);
The type of the callback function used to obtain the tag.
lt_bool_t
(*lt_ext_module_validate_func_t) (lt_ext_module_data_t *data
);
The type of the callback function used to validate the tags in data
.
void
lt_ext_modules_load (void
);
Load all of the modules on the system, including the internal accessor.
This has to be invoked before processing something with lt_extension_t.
or lt_db_initialize()
does.
void
lt_ext_modules_unload (void
);
Unload all of the modules already loaded.
lt_ext_module_t *
lt_ext_module_ref (lt_ext_module_t *module
);
Increases the reference count of module
.
void
lt_ext_module_unref (lt_ext_module_t *module
);
Decreases the reference count of module
. when its reference count
drops to 0, the object is finalized (i.e. its memory is freed).
#define LT_MODULE_SYMBOL_(__prefix__,__sym__) LT_MODULE_SYMBOL__(__prefix__, __sym__)
int
module_get_version (void
);
Obtains the module version. this must be implemented in a module.
const lt_ext_module_funcs_t *
module_get_funcs (void
);
Obtains a lt_ext_module_funcs_t, callback collection structure that the module would process. this must be implemented in the external module.
#define LT_EXT_MODULE_VERSION 1
Static variable for the module version. this is used to ensure if the built module is compatible with the runtime library.
struct lt_ext_module_funcs_t { LT_CONST_DECL lt_ext_module_singleton_func_t get_singleton; LT_CONST_DECL lt_ext_module_data_new_func_t create_data; LT_CONST_DECL lt_ext_module_precheck_func_t precheck_tag; LT_CONST_DECL lt_ext_module_parse_func_t parse_tag; LT_CONST_DECL lt_ext_module_get_tag_func_t get_tag; LT_CONST_DECL lt_ext_module_validate_func_t validate_tag; };
The lt_ext_module_funcs_t struct is a callback collection to provide an accessor between lt_extension_t and lt_ext_module_t and extend features.
typedef struct _lt_ext_module_t lt_ext_module_t;
All the fields in the lt_ext_module_t structure are private to the lt_ext_module_t implementation.