Logo Search packages:      
Sourcecode: inkscape version File versions

unsigned sp_attribute_lookup ( gchar const *  key  ) 

Returns an SPAttributeEnum; SP_ATTR_INVALID (of value 0) if key isn't recognized.

Definition at line 413 of file attributes.cpp.

Referenced by ec_shape_event_attr_changed(), sp_object_read_attr(), and sp_style_merge_style_from_decl().

{
    static GHashTable *propdict = NULL;

    if (!propdict) {
        unsigned int i;
        propdict = g_hash_table_new(g_str_hash, g_str_equal);
        for (i = 1; i < n_attrs; i++) {
            g_assert(props[i].code == static_cast< gint >(i) );
            g_hash_table_insert(propdict,
                                const_cast<void *>(static_cast<void const *>(props[i].name)),
                                GINT_TO_POINTER(props[i].code));
        }
    }

    return GPOINTER_TO_UINT(g_hash_table_lookup(propdict, key));
}


Generated by  Doxygen 1.6.0   Back to index