Logo Search packages:      
Sourcecode: inkscape version File versions

Inkscape::Extension::Extension::Extension ( SPRepr *  in_repr,
Implementation::Implementation in_imp 
)

Constructs an Extension from a SPRepr.

Returns:
none
Parameters:
in_repr The repr that should be used to build it
This function is the basis of building an extension for Inkscape. It currently extracts the fields from the Repr that are used in the extension. The Repr will likely include other children that are not related to the module directly. If the Repr does not include a name and an ID the module will be left in an errored state.

Definition at line 59 of file extension.cpp.

References _deps, _state, imp, make_param(), name, parameters, repr, STATE_UNLOADED, and timer.

{
    repr = in_repr;
    sp_repr_ref(in_repr);

    id = NULL;
    name = NULL;
    _state = STATE_UNLOADED;
    parameters = NULL;

    if (in_imp == NULL) {
        imp = new Implementation::Implementation();
    } else {
        imp = in_imp;
    }

//  printf("Extension Constructor: ");
    if (repr != NULL) {
        SPRepr *child_repr = sp_repr_children(repr);
        /* TODO: Handle what happens if we don't have these two */
        while (child_repr != NULL) {
            if (!strcmp(sp_repr_name(child_repr), "id")) {
                gchar const *val = sp_repr_content(sp_repr_children(child_repr));
                id = g_strdup (val);
            } /* id */
            if (!strcmp(sp_repr_name(child_repr), "name")) {
                name = g_strdup (sp_repr_content(sp_repr_children(child_repr)));
            } /* name */
            if (!strcmp(sp_repr_name(child_repr), "param")) {
                make_param(child_repr);
            } /* param */
            if (!strcmp(sp_repr_name(child_repr), "dependency")) {
                _deps.push_back(new Dependency(child_repr));
            } /* param */
            child_repr = sp_repr_next(child_repr);
        }

        db.register_ext (this);
    }
//  printf("%s\n", name);
      timer = NULL;

    return;
}


Generated by  Doxygen 1.6.0   Back to index