Logo Search packages:      
Sourcecode: inkscape version File versions

CRStatement* cr_statement_parse_from_buf ( const guchar *  a_buf,
enum CREncoding  a_encoding 
)

Parses a buffer that contains a css statement and returns an instance of CRStatement in case of successfull parsing. TODO: at support of "@import" rules.

Parameters:
a_buf the buffer to parse.
a_encoding the character encoding of a_buf.
Returns:
the newly built instance of CRStatement in case of successfull parsing, NULL otherwise.

Definition at line 965 of file cr-statement.c.

References cr_statement_at_charset_rule_parse_from_buf(), cr_statement_at_import_rule_parse_from_buf(), cr_statement_at_media_rule_parse_from_buf(), cr_statement_at_page_rule_parse_from_buf(), cr_statement_font_face_rule_parse_from_buf(), and cr_statement_ruleset_parse_from_buf().

{
        CRStatement *result = NULL;

        /*
         *The strategy of this function is "brute force".
         *It tries to parse all the types of #CRStatement it knows about.
         *I could do this a smarter way but I don't have the time now.
         *I think I will revisit this when time of performances and
         *pull based incremental parsing comes.
         */

        result = cr_statement_ruleset_parse_from_buf (a_buf, a_encoding);
        if (!result) {
                result = cr_statement_at_charset_rule_parse_from_buf
                        (a_buf, a_encoding);
        } else {
                goto out;
        }

        if (!result) {
                result = cr_statement_at_media_rule_parse_from_buf
                        (a_buf, a_encoding);
        } else {
                goto out;
        }

        if (!result) {
                result = cr_statement_at_charset_rule_parse_from_buf
                        (a_buf, a_encoding);
        } else {
                goto out;
        }

        if (!result) {
                result = cr_statement_font_face_rule_parse_from_buf
                        (a_buf, a_encoding);

        } else {
                goto out;
        }

        if (!result) {
                result = cr_statement_at_page_rule_parse_from_buf
                        (a_buf, a_encoding);
        } else {
                goto out;
        }

        if (!result) {
                result = cr_statement_at_import_rule_parse_from_buf
                        (a_buf, a_encoding);
        } else {
                goto out;
        }

      out:
        return result;
}


Generated by  Doxygen 1.6.0   Back to index