registry

registry — Class to store a mapping of qualified names (QName) to other qualified names.

Functions

Description

A qualified name is a name or a string in the context of another name, or namespace. This object implement a function of a tuple (namespace, name, namespace) to a name. For the moment there is no need to enumerate all tuples (namespace, name) pair given a base pair, i.e. a function from tuple (namespace, name) to a list of tuples (namespace,name).

We support two kinds of mapping:

  • you can give a direct mapping between two QName,

  • or you can give a function that will manage mapping between one namespace and another one.

For internal use inside lasso we define the following namespaces:

For functional mappings the mapping function must return constant strings created using g_intern_string() or using g_type_name().

Functions

LassoRegistryTranslationFunction ()

const char *
(*LassoRegistryTranslationFunction) (const char *from_namespace,
                                     const char *from_name,
                                     const char *to_namespace);

lasso_registry_default_add_direct_mapping ()

lasso_error_t
lasso_registry_default_add_direct_mapping
                               (const char *from_namespace,
                                const char *from_name,
                                const char *to_namespace,
                                const char *to_name);

Add a new mapping from a QName to a QName.

Parameters

from_namespace

the namespace of the mapped QName

 

from_name

the name of the mapped QName

 

to_namespace

the namepsace of the mapped to QName

 

to_name

the name of the mapped to QName

 

Returns

0 if successfull, LASSO_REGISTRY_ERROR_KEY_EXISTS if this mapping is already registered, LASSO_PARAM_ERROR_INVALID_VALUE if one the argument is invalid.


lasso_registry_default_add_functional_mapping ()

lasso_error_t
lasso_registry_default_add_functional_mapping
                               (const char *from_namespace,
                                const char *to_namespace,
                                LassoRegistryTranslationFunction translation_function);

from_namespace : URI of the source namespace to_namespace : URI of the destination namespace translation_function : a function mapping string to string from the first namespace to the second one

Register a new mapping from from_namesapce to to_namespace using the translation_function into the default mapping. This functions is not forced to return a value for any string, it can return NULL.

Returns

0 if successfull, LASSO_REGISTRY_ERROR_KEY_EXISTS if this mapping is already registered, LASSO_PARAM_ERROR_INVALID_VALUE if one the argument is invalid.


lasso_registry_default_get_mapping ()

const char *
lasso_registry_default_get_mapping (const char *from_namespace,
                                    const char *from_name,
                                    const char *to_namespace);

Retrieve the name of the QName in the namespace to_namespace that maps the QName from_namespace:from_name.

Parameters

from_namespace

the namespace of the mapped QName

 

from_name

the name of the mapped QName

 

to_namespace

the namepsace of the mapped to QName

 

Returns

the name string of the QName or NULL if no mapping exists.

Types and Values