Logo Search packages:      
Sourcecode: inkscape version File versions

unsigned int sp_repr_get_boolean ( Inkscape::XML::Node repr,
gchar const *  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 455 of file repr-util.cpp.

References Inkscape::XML::Node::attribute().

{
    gchar const *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 = repr->attribute(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