Logo Search packages:      
Sourcecode: inkscape version File versions

unsigned int sp_repr_get_boolean ( SPRepr *  repr,
const gchar *  key,
unsigned int *  val 
)

Parses the boolean value of an attribute "key" in repr and sets val accordingly, or to FALSE if the attr is not set.

Returns:
TRUE if the attr was set, FALSE otherwise.

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

{
    const gchar *v;

    g_return_val_if_fail (repr != NULL, FALSE);
    g_return_val_if_fail (key != NULL, FALSE);
    g_return_val_if_fail (val != NULL, FALSE);

    v = sp_repr_attr (repr, key);

    if (v != NULL) {
        if (!g_strcasecmp (v, "true") ||
            !g_strcasecmp (v, "yes" ) ||
            !g_strcasecmp (v, "y"   ) ||
            (atoi (v) != 0)) {
            *val = TRUE;
        } else {
            *val = FALSE;
        }
        return TRUE;
    } else {
        *val = FALSE;
        return FALSE;
    }
}


Generated by  Doxygen 1.6.0   Back to index