Logo Search packages:      
Sourcecode: inkscape version File versions

SPObject* sp_object_get_child_by_repr ( SPObject object,
Inkscape::XML::Node repr 
)

Return object's child whose node pointer equals repr.

Definition at line 689 of file sp-object.cpp.

References SPObject::_last_child, SPObject::children, and SPObject::next.

Referenced by sp_gradient_child_added(), sp_object_child_added(), sp_object_order_changed(), and sp_object_remove_child().

{
    g_return_val_if_fail(object != NULL, NULL);
    g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
    g_return_val_if_fail(repr != NULL, NULL);

    if (object->_last_child && SP_OBJECT_REPR(object->_last_child) == repr)
        return object->_last_child;   // optimization for common scenario
    for ( SPObject *child = object->children ; child ; child = child->next ) {
        if ( SP_OBJECT_REPR(child) == repr ) {
            return child;
        }
    }

    return NULL;
}


Generated by  Doxygen 1.6.0   Back to index