Logo Search packages:      
Sourcecode: inkscape version File versions

Extension::param_t * Inkscape::Extension::Extension::param_shared ( const gchar *  name,
GSList *  list 
) [inline, private]

This function looks through the linked list for a parameter structure with the name of the passed in name.

Returns:
Parameter structure with a name of 'name'
Parameters:
name The name to search for
list The list to look for
This is an inline function that is used by all the get_param and set_param functions to find a param_t in the linked list with the passed in name. It is done as an inline so that it will be optimized into a 'jump' by the compiler.

This function can throw a 'param_not_exist' exception if the name is not found.

The first thing that this function checks is if the list is NULL. It could be NULL because there are no parameters for this extension or because all of them have been checked (I'll spoil the ending and tell you that this function is called recursively). If the list is NULL then the 'param_not_exist' exception is thrown.

Otherwise, the function looks at the current param_t that the element list points to. If the name of that param_t matches the passed in name then that param_t is returned. Otherwise, this function is called again with g_slist_next as a parameter.

Definition at line 470 of file extension.cpp.

References Inkscape::Extension::Extension::param_t::name.

Referenced by get_param_bool(), get_param_float(), get_param_int(), get_param_string(), set_param_bool(), set_param_float(), set_param_int(), and set_param_string().

{
    Extension::param_t * output;
    
    if (name == NULL) {
        throw Extension::param_not_exist();
    }
    if (list == NULL) {
        throw Extension::param_not_exist();
    }

    output = static_cast<Extension::param_t *>(list->data);
    if (!strcmp(output->name, name)) {
        return output;
    }

    return Extension::param_shared(name, g_slist_next(list));
}


Generated by  Doxygen 1.6.0   Back to index