Logo Search packages:      
Sourcecode: inkscape version File versions

gchar* cr_declaration_to_string ( CRDeclaration a_this,
gulong  a_indent 
)

Serializes the declaration into a string

Parameters:
a_this the current instance of CRDeclaration.
a_indent the number of indentation white char to put before the actual serialisation.

Definition at line 464 of file cr-declaration.c.

References cr_term_to_string().

Referenced by cr_declaration_list_to_string(), cr_declaration_list_to_string2(), and dump().

{
        GString *stringue = NULL;

        gchar *str = NULL,
                *result = NULL;

        g_return_val_if_fail (a_this, NULL);

      stringue = g_string_new (NULL);

      if (a_this->property 
          && a_this->property->stryng
          && a_this->property->stryng->str) {
            str = g_strndup (a_this->property->stryng->str,
                         a_this->property->stryng->len);
            if (str) {
                  cr_utils_dump_n_chars2 (' ', stringue, 
                                    a_indent);
                  g_string_append (stringue, str);
                  g_free (str);
                  str = NULL;
            } else
                        goto error;

                if (a_this->value) {
                        guchar *value_str = NULL;

                        value_str = cr_term_to_string (a_this->value);
                        if (value_str) {
                                g_string_append_printf (stringue, " : %s",
                                                        value_str);
                                g_free (value_str);
                        } else
                                goto error;
                }
                if (a_this->important == TRUE) {
                        g_string_append_printf (stringue, " %s",
                                                "!important");
                }
        }
        if (stringue && stringue->str) {
                result = stringue->str;
                g_string_free (stringue, FALSE);
        }
        return result;

      error:
        if (stringue) {
                g_string_free (stringue, TRUE);
                stringue = NULL;
        }
        if (str) {
                g_free (str);
                str = NULL;
        }

        return result;
}


Generated by  Doxygen 1.6.0   Back to index