Logo Search packages:      
Sourcecode: inkscape version File versions

Inkscape::Extension::Dependency::Dependency ( SPRepr *  in_repr  ) 

Create a dependency using an XML definition.

Parameters:
in_repr XML definition of the dependency
This function mostly looks for the 'location' and 'type' attributes and turns them into the enums of the same name. This makes things a little bit easier to use later. Also, a pointer to the core content is pulled out -- also to make things easier.

Definition at line 52 of file dependency.cpp.

References _description, _location, _location_str, _repr, _string, _type, _type_str, LOCATION_CNT, LOCATION_PATH, and TYPE_CNT.

{
    _type = TYPE_CNT;
    _location = LOCATION_PATH;
    _repr = in_repr;
    _string = NULL;
    _description = NULL;

    sp_repr_ref(_repr);

    const gchar * location = sp_repr_attr(_repr, "location");
    for (int i = 0; i < LOCATION_CNT && location != NULL; i++) {
        if (!strcmp(location, _location_str[i])) {
            _location = (location_t)i;
            break;
        }
    }

    const gchar * type = sp_repr_attr(_repr, "type");
    for (int i = 0; i < TYPE_CNT && type != NULL; i++) {
        if (!strcmp(type, _type_str[i])) {
            _type = (type_t)i;
            break;
        }
    }

    _string = sp_repr_content(sp_repr_children(_repr));

    _description = sp_repr_attr(_repr, "description");

    return;
}


Generated by  Doxygen 1.6.0   Back to index