Logo Search packages:      
Sourcecode: inkscape version File versions

SPRepr* sp_repr_lookup_name ( SPRepr *  repr,
gchar const *  name,
gint  maxdepth 
)

Recursively find the SPRepr matching the given XML name.

Returns:
A pointer to the matching SPRepr
Parameters:
repr The SPRepr to start from
name The desired XML name

Definition at line 392 of file repr-util.cpp.

{
    g_return_val_if_fail (repr != NULL, NULL);
    g_return_val_if_fail (name != NULL, NULL);

    GQuark const quark = g_quark_from_string (name);

    if ( (GQuark)repr->code() == quark ) return repr;
    if ( maxdepth == 0 ) return NULL;

    // maxdepth == -1 means unlimited
    if ( maxdepth == -1 ) maxdepth = 0;

    SPRepr * found = NULL;
    for (SPRepr *child = repr->firstChild() ; child && !found; child = child->next() ) {
        found = sp_repr_lookup_name ( child, name, maxdepth-1 );
    }

    return found;
}


Generated by  Doxygen 1.6.0   Back to index