Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

Inkscape::Extension::Dependency::Dependency ( Inkscape::XML::Node 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 48 of file dependency.cpp.

References _description, _location, _location_str, _repr, _string, _type, _type_str, Inkscape::XML::Node::attribute(), Inkscape::XML::Node::content(), LOCATION_CNT, LOCATION_PATH, sp_repr_children(), TYPE_CNT, and TYPE_FILE.

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

    Inkscape::GC::anchor(_repr);

    const gchar * location = _repr->attribute("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 = _repr->attribute("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_children(_repr)->content();

    _description = _repr->attribute("description");
    if (_description == NULL)
        _description = _repr->attribute("_description");

    return;
}


Generated by  Doxygen 1.6.0   Back to index