## cr-statement

cr-statement

## Synopsis

    struct              CRAtCharsetRule;
    struct              CRAtFontFaceRule;
    struct              CRAtImportRule;
    struct              CRAtMediaRule;
    struct              CRAtPageRule;
    struct              CRRuleSet;
                        CRStatement;
                        CRStyleSheet;
    CRStatement *       cr_statement_append                 (CRStatement *a_this,
                                                             CRStatement *a_new);
    enum CRStatus       cr_statement_at_charset_rule_get_charset
                                                            (CRStatement const *a_this,
                                                             CRString **a_charset);
    CRStatement *       cr_statement_at_charset_rule_parse_from_buf
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_encoding);
    enum CRStatus       cr_statement_at_charset_rule_set_charset
                                                            (CRStatement *a_this,
                                                             CRString *a_charset);
    enum CRStatus       cr_statement_at_font_face_rule_add_decl
                                                            (CRStatement *a_this,
                                                             CRString *a_prop,
                                                             CRTerm *a_value);
    enum CRStatus       cr_statement_at_font_face_rule_get_decls
                                                            (CRStatement *a_this,
                                                             CRDeclaration **a_decls);
    enum CRStatus       cr_statement_at_font_face_rule_set_decls
                                                            (CRStatement *a_this,
                                                             CRDeclaration *a_decls);
    enum CRStatus       cr_statement_at_import_rule_get_imported_sheet
                                                            (CRStatement *a_this,
                                                             CRStyleSheet **a_sheet);
    enum CRStatus       cr_statement_at_import_rule_get_url (CRStatement const *a_this,
                                                             CRString **a_url);
    CRStatement *       cr_statement_at_import_rule_parse_from_buf
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_encoding);
    enum CRStatus       cr_statement_at_import_rule_set_imported_sheet
                                                            (CRStatement *a_this,
                                                             CRStyleSheet *a_sheet);
    enum CRStatus       cr_statement_at_import_rule_set_url (CRStatement *a_this,
                                                             CRString *a_url);
    CRStatement *       cr_statement_at_media_get_from_list (CRStatement *a_this,
                                                             int itemnr);
    gint                cr_statement_at_media_nr_rules      (CRStatement const *a_this);
    CRStatement *       cr_statement_at_media_rule_parse_from_buf
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_enc);
    enum CRStatus       cr_statement_at_page_rule_get_declarations
                                                            (CRStatement *a_this,
                                                             CRDeclaration **a_decl_list);
    enum CRStatus       cr_statement_at_page_rule_get_sel   (CRStatement const *a_this,
                                                             CRSelector **a_sel);
    CRStatement *       cr_statement_at_page_rule_parse_from_buf
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_encoding);
    enum CRStatus       cr_statement_at_page_rule_set_declarations
                                                            (CRStatement *a_this,
                                                             CRDeclaration *a_decl_list);
    enum CRStatus       cr_statement_at_page_rule_set_sel   (CRStatement *a_this,
                                                             CRSelector *a_sel);
    void                cr_statement_destroy                (CRStatement *a_this);
    gboolean            cr_statement_does_buf_parses_against_core
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_encoding);
    void                cr_statement_dump                   (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             gulong a_indent);
    void                cr_statement_dump_charset           (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             gulong a_indent);
    void                cr_statement_dump_font_face_rule    (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             glong a_indent);
    void                cr_statement_dump_import_rule       (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             gulong a_indent);
    void                cr_statement_dump_media_rule        (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             gulong a_indent);
    void                cr_statement_dump_page              (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             gulong a_indent);
    void                cr_statement_dump_ruleset           (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             glong a_indent);
    CRStatement *       cr_statement_font_face_rule_parse_from_buf
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_encoding);
    CRStatement *       cr_statement_get_from_list          (CRStatement *a_this,
                                                             int itemnr);
    enum CRStatus       cr_statement_get_parent_sheet       (CRStatement *a_this,
                                                             CRStyleSheet **a_sheet);
    gchar *             cr_statement_list_to_string         (CRStatement const *a_this,
                                                             gulong a_indent);
    CRStatement *       cr_statement_new_at_charset_rule    (CRStyleSheet *a_sheet,
                                                             CRString *a_charset);
    CRStatement *       cr_statement_new_at_font_face_rule  (CRStyleSheet *a_sheet,
                                                             CRDeclaration *a_font_decls);
    CRStatement *       cr_statement_new_at_import_rule     (CRStyleSheet *a_container_sheet,
                                                             CRString *a_url,
                                                             GList *a_media_list,
                                                             CRStyleSheet *a_imported_sheet);
    CRStatement *       cr_statement_new_at_media_rule      (CRStyleSheet *a_sheet,
                                                             CRStatement *a_ruleset,
                                                             GList *a_media);
    CRStatement *       cr_statement_new_at_page_rule       (CRStyleSheet *a_sheet,
                                                             CRDeclaration *a_decl_list,
                                                             CRString *a_name,
                                                             CRString *a_pseudo);
    CRStatement *       cr_statement_new_ruleset            (CRStyleSheet *a_sheet,
                                                             CRSelector *a_sel_list,
                                                             CRDeclaration *a_decl_list,
                                                             CRStatement *a_media_rule);
    gint                cr_statement_nr_rules               (CRStatement const *a_this);
    CRStatement *       cr_statement_parse_from_buf         (const guchar *a_buf,
                                                             enum CREncoding a_encoding);
    CRStatement *       cr_statement_prepend                (CRStatement *a_this,
                                                             CRStatement *a_new);
    enum CRStatus       cr_statement_ruleset_append_decl    (CRStatement *a_this,
                                                             CRDeclaration *a_decl);
    enum CRStatus       cr_statement_ruleset_append_decl2   (CRStatement *a_this,
                                                             CRString *a_prop,
                                                             CRTerm *a_value);
    enum CRStatus       cr_statement_ruleset_get_declarations
                                                            (CRStatement *a_this,
                                                             CRDeclaration **a_decl_list);
    enum CRStatus       cr_statement_ruleset_get_sel_list   (CRStatement const *a_this,
                                                             CRSelector **a_list);
    CRStatement *       cr_statement_ruleset_parse_from_buf (const guchar *a_buf,
                                                             enum CREncoding a_enc);
    enum CRStatus       cr_statement_ruleset_set_decl_list  (CRStatement *a_this,
                                                             CRDeclaration *a_list);
    enum CRStatus       cr_statement_ruleset_set_sel_list   (CRStatement *a_this,
                                                             CRSelector *a_sel_list);
    enum CRStatus       cr_statement_set_parent_sheet       (CRStatement *a_this,
                                                             CRStyleSheet *a_sheet);
    gchar *             cr_statement_to_string              (CRStatement const *a_this,
                                                             gulong a_indent);
    CRStatement *       cr_statement_unlink                 (CRStatement *a_stmt);

## Description

## Details

### struct CRAtCharsetRule

    struct CRAtCharsetRule {
    	CRString * charset ;
    };

### struct CRAtFontFaceRule

    struct CRAtFontFaceRule {
    	/*a list of instanaces of #CRDeclaration*/
    	CRDeclaration *decl_list ;
    };

### struct CRAtImportRule

    struct CRAtImportRule {
    	/**the url of the import rule*/
    	CRString *url ;

            GList *media_list ;

    	/**
    	 *the stylesheet fetched from the url, if any.
    	 *this is not "owned" by #CRAtImportRule which means
    	 *it is not destroyed by the destructor of #CRAtImportRule.
    	 */
    	CRStyleSheet * sheet;
    };

### struct CRAtMediaRule

    struct CRAtMediaRule {
    	GList *media_list ;
    	CRStatement *rulesets ;
    };

### struct CRAtPageRule

    struct CRAtPageRule {
    	/**a list of instances of #CRDeclaration*/
    	CRDeclaration *decl_list ;

    	/**page selector. Is a pseudo selector*/
    	CRString *name ;
    	CRString *pseudo ;
    };

### struct CRRuleSet

    struct CRRuleSet {
    	/**A list of instances of #CRSimpeSel*/
    	CRSelector *sel_list ;

    	/**A list of instances of #CRDeclaration*/
    	CRDeclaration *decl_list ;

    	/**
    	 *The parent media rule, or NULL if
    	 *no parent media rule exists.
    	 */
    	CRStatement *parent_media_rule ;
    };

### CRStatement

    typedef struct {
    	/**
    	 *The type of the statement.
    	 */
    	enum CRStatementType type ;

    	union
    	{
    		CRRuleSet *ruleset ;
    		CRAtImportRule *import_rule ;
    		CRAtMediaRule *media_rule ;
    		CRAtPageRule *page_rule ;
    		CRAtCharsetRule *charset_rule ;
    		CRAtFontFaceRule *font_face_rule ;
    	} kind ;

            /*
             *the specificity of the selector
             *that matched this statement.
             *This is only used by the cascading
             *order determination algorithm.
             */
            gulong specificity ;

            /*
             *the style sheet that contains
             *this css statement.
             */
            CRStyleSheet *parent_sheet ;
    	CRStatement *next ;
    	CRStatement *prev ;

            CRParsingLocation location ;

            /**
             *a custom pointer useable by
             *applications that use libcroco.
             *libcroco itself will never modify
             *this pointer.
             */
            gpointer app_data ;

            /**
             *a custom pointer used
             *by the upper layers of libcroco.
             *application should never use this
             *pointer.
             */
            gpointer croco_data ;
    } CRStatement;

### CRStyleSheet

    typedef struct {
    	/**The css statements list*/
    	CRStatement *statements ;

            enum CRStyleOrigin origin ;

            /*the parent import rule, if any.*/
            CRStatement *parent_import_rule ;

    	/**custom data used by libcroco*/
    	gpointer croco_data ;

    	/**
    	 *custom application data pointer
    	 *Can be used by applications.
    	 */
    	gpointer app_data ;

    	/**
    	 *the reference count of this insance
    	 *Please, don't never ever modify it
    	 *directly. Use cr_stylesheet_ref()
    	 *and cr_stylesheet_unref() instead.
    	 */
    	gulong ref_count ;
    } CRStyleSheet;

### cr_statement_append ()

    CRStatement *       cr_statement_append                 (CRStatement *a_this,
                                                             CRStatement *a_new);

`a_this`: the current instance of the statement list. `a_new`: a_new the new instance of CRStatement to append.

Appends a new statement to the statement list.

Returns : | the new list statement list, or NULL in cas of failure.

### cr_statement_at_charset_rule_get_charset ()

    enum CRStatus       cr_statement_at_charset_rule_get_charset
                                                            (CRStatement const *a_this,
                                                             CRString **a_charset);

Gets the charset string associated to the current @charset rule statement.

`a_this` : | the current @charset rule statement.
`a_charset` : | out parameter. The returned charset string if and only if the function returned CR_OK.
Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_at_charset_rule_parse_from_buf ()

    CRStatement *       cr_statement_at_charset_rule_parse_from_buf
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_encoding);

`a_buf`: the buffer to parse. `a_encoding`: the character encoding of the buffer.

Parses a buffer that contains an '@charset' rule and creates an instance of CRStatement of type AT_CHARSET_RULE_STMT.

Returns : | the newly built instance of CRStatement.

### cr_statement_at_charset_rule_set_charset ()

    enum CRStatus       cr_statement_at_charset_rule_set_charset
                                                            (CRStatement *a_this,
                                                             CRString *a_charset);

`a_this`: the current @charset rule statement. `a_charset`: the charset to set.

Sets the charset of the current @charset rule statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_at_font_face_rule_add_decl ()

    enum CRStatus       cr_statement_at_font_face_rule_add_decl
                                                            (CRStatement *a_this,
                                                             CRString *a_prop,
                                                             CRTerm *a_value);

`a_this`: the current @font-face rule statement. `a_prop`: the property of the declaration. `a_value`: the value of the declaration.

Adds a declaration to the current @font-face rule statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_at_font_face_rule_get_decls ()

    enum CRStatus       cr_statement_at_font_face_rule_get_decls
                                                            (CRStatement *a_this,
                                                             CRDeclaration **a_decls);

`a_this`: the current @font-face rule statement. `a_decls`: out parameter. The returned declaration list if and only if this function returns CR_OK.

Gets the declaration list associated to the current instance of @font-face rule statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_at_font_face_rule_set_decls ()

    enum CRStatus       cr_statement_at_font_face_rule_set_decls
                                                            (CRStatement *a_this,
                                                             CRDeclaration *a_decls);

`a_this`: the current @font-face rule statement. `a_decls`: the declarations list to set.

Sets a declaration list to the current @font-face rule statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_at_import_rule_get_imported_sheet ()

    enum CRStatus       cr_statement_at_import_rule_get_imported_sheet
                                                            (CRStatement *a_this,
                                                             CRStyleSheet **a_sheet);

`a_this`: the current @import rule statement. `a_sheet`: out parameter. The returned stylesheet if and only if the function returns CR_OK.

Gets the stylesheet contained by the @import rule statement.

Returns : | CR_OK upon sucessful completion, an error code otherwise.

### cr_statement_at_import_rule_get_url ()

    enum CRStatus       cr_statement_at_import_rule_get_url (CRStatement const *a_this,
                                                             CRString **a_url);

`a_this`: the current @import rule statement. `a_url`: out parameter. The returned url if and only if the function returned CR_OK.

Gets the url of the @import rule statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_at_import_rule_parse_from_buf ()

    CRStatement *       cr_statement_at_import_rule_parse_from_buf
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_encoding);

`a_buf`: the buffer to parse. `a_encoding`: the encoding of a_buf.

Parses a buffer that contains an "@import" rule and instanciate a CRStatement of type AT_IMPORT_RULE_STMT

Returns : | the newly built instance of CRStatement in case of a successful parsing, NULL otherwise.

### cr_statement_at_import_rule_set_imported_sheet ()

    enum CRStatus       cr_statement_at_import_rule_set_imported_sheet
                                                            (CRStatement *a_this,
                                                             CRStyleSheet *a_sheet);

Sets a stylesheet to the current @import rule. `a_this`: the current @import rule. `a_sheet`: the stylesheet. The stylesheet is owned by the current instance of CRStatement, that is, the stylesheet will be destroyed when the current instance of CRStatement is destroyed.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_at_import_rule_set_url ()

    enum CRStatus       cr_statement_at_import_rule_set_url (CRStatement *a_this,
                                                             CRString *a_url);

`a_this`: the current @import rule statement. `a_url`: the url to set.

Sets an url to the current @import rule statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_at_media_get_from_list ()

    CRStatement *       cr_statement_at_media_get_from_list (CRStatement *a_this,
                                                             int itemnr);

`a_this`: the current instance of CRStatement. `itemnr`: the index into the media rule list of rules.

Use an index to get a CRStatement from the media rule list of rules.

Returns : | CRStatement at position itemnr, if itemnr > number of rules - 1, it will return NULL.

### cr_statement_at_media_nr_rules ()

    gint                cr_statement_at_media_nr_rules      (CRStatement const *a_this);

`a_this`: the current instance of CRStatement.

Returns : | the number of rules in the media rule;

### cr_statement_at_media_rule_parse_from_buf ()

    CRStatement *       cr_statement_at_media_rule_parse_from_buf
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_enc);

`a_buf`: the input to parse. `a_enc`: the encoding of the buffer.

Parses a buffer that contains an "@media" declaration and builds an @media css statement.

Returns : | the @media statement, or NULL if the buffer could not be successfully parsed.

### cr_statement_at_page_rule_get_declarations ()

    enum CRStatus       cr_statement_at_page_rule_get_declarations
                                                            (CRStatement *a_this,
                                                             CRDeclaration **a_decl_list);

`a_this`: the current @page rule statement. `a_decl_list`: out parameter. The returned declaration list.

Gets the declaration list associated to the current @page rule statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_at_page_rule_get_sel ()

    enum CRStatus       cr_statement_at_page_rule_get_sel   (CRStatement const *a_this,
                                                             CRSelector **a_sel);

### cr_statement_at_page_rule_parse_from_buf ()

    CRStatement *       cr_statement_at_page_rule_parse_from_buf
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_encoding);

`a_buf`: the character buffer to parse. `a_encoding`: the character encoding of a_buf.

Parses a buffer that contains an "@page" production and, if the parsing succeeds, builds the page statement.

Returns : | the newly built at page statement in case of successful parsing, NULL otherwise.

### cr_statement_at_page_rule_set_declarations ()

    enum CRStatus       cr_statement_at_page_rule_set_declarations
                                                            (CRStatement *a_this,
                                                             CRDeclaration *a_decl_list);

`a_this`: the current @page rule statement. `a_decl_list`: the declaration list to add. Will be freed by the current instance of CRStatement when it is destroyed.

Sets a declaration list to the current @page rule statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_at_page_rule_set_sel ()

    enum CRStatus       cr_statement_at_page_rule_set_sel   (CRStatement *a_this,
                                                             CRSelector *a_sel);

### cr_statement_destroy ()

    void                cr_statement_destroy                (CRStatement *a_this);

`a_this`: the current instance of CRStatement.

Destructor of CRStatement.

### cr_statement_does_buf_parses_against_core ()

    gboolean            cr_statement_does_buf_parses_against_core
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_encoding);

`a_buf`: the buffer to parse. `a_encoding`: the character encoding of a_buf.

Tries to parse a buffer and says whether if the content of the buffer is a css statement as defined by the "Core CSS Grammar" (chapter 4 of the css spec) or not.

Returns : | TRUE if the buffer parses against the core grammar, false otherwise.

### cr_statement_dump ()

    void                cr_statement_dump                   (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             gulong a_indent);

`a_this`: the current css2 statement. `a_fp`: the destination file pointer. `a_indent`: the number of white space indentation characters.

Dumps the css2 statement to a file.

### cr_statement_dump_charset ()

    void                cr_statement_dump_charset           (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             gulong a_indent);

`a_this`: the current instance of the @charset rule statement. `a_fp`: the destination file pointer. `a_indent`: the number of indentation white spaces.

Dumps an @charset rule statement to a file.

### cr_statement_dump_font_face_rule ()

    void                cr_statement_dump_font_face_rule    (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             glong a_indent);

`a_this`: the current instance of font face rule statement. `a_fp`: the destination file pointer. `a_indent`: the number of white space indentation.

Dumps a font face rule statement to a file.

### cr_statement_dump_import_rule ()

    void                cr_statement_dump_import_rule       (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             gulong a_indent);

`a_fp`: the destination file pointer. `a_indent`: the number of white space indentations.

Dumps an @import rule statement to a file.

### cr_statement_dump_media_rule ()

    void                cr_statement_dump_media_rule        (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             gulong a_indent);

`a_this`: the statement to dump. `a_fp`: the destination file pointer `a_indent`: the number of white spaces indentation.

Dumps an @media rule statement to a file.

### cr_statement_dump_page ()

    void                cr_statement_dump_page              (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             gulong a_indent);

`a_this`: the statement to dump on stdout. `a_fp`: the destination file pointer. `a_indent`: the number of indentation white spaces.

Dumps an @page rule statement on stdout.

### cr_statement_dump_ruleset ()

    void                cr_statement_dump_ruleset           (CRStatement const *a_this,
                                                             FILE *a_fp,
                                                             glong a_indent);

`a_this`: the current instance of CRStatement. `a_fp`: the destination file pointer. `a_indent`: the number of indentation white spaces to add.

Dumps a ruleset statement to a file.

### cr_statement_font_face_rule_parse_from_buf ()

    CRStatement *       cr_statement_font_face_rule_parse_from_buf
                                                            (const guchar *a_buf,
                                                             enum CREncoding a_encoding);

`a_buf`: the buffer to parse. `a_encoding`: the character encoding of a_buf.

Parses a buffer that contains an "@font-face" rule and builds an instance of CRStatement of type AT_FONT_FACE_RULE_STMT out of it.

Returns : | the newly built instance of CRStatement in case of successufull parsing, NULL otherwise.

### cr_statement_get_from_list ()

    CRStatement *       cr_statement_get_from_list          (CRStatement *a_this,
                                                             int itemnr);

`a_this`: the current instance of CRStatement. `itemnr`: the index into the statement list.

Use an index to get a CRStatement from the statement list.

Returns : | CRStatement at position itemnr, if itemnr > number of statements - 1, it will return NULL.

### cr_statement_get_parent_sheet ()

    enum CRStatus       cr_statement_get_parent_sheet       (CRStatement *a_this,
                                                             CRStyleSheet **a_sheet);

`a_this`: the current CRStatement. `a_sheet`: out parameter. A pointer to the sheets that

Gets the sheets that contains the current statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_list_to_string ()

    gchar *             cr_statement_list_to_string         (CRStatement const *a_this,
                                                             gulong a_indent);

### cr_statement_new_at_charset_rule ()

    CRStatement *       cr_statement_new_at_charset_rule    (CRStyleSheet *a_sheet,
                                                             CRString *a_charset);

`a_charset`: the string representing the charset. Note that the newly built instance of CRStatement becomes the owner of a_charset. The caller must not free a_charset !!!.

Creates a new instance of CRStatement of type CRAtCharsetRule.

Returns : | the newly built instance of CRStatement or NULL if an error arises.

### cr_statement_new_at_font_face_rule ()

    CRStatement *       cr_statement_new_at_font_face_rule  (CRStyleSheet *a_sheet,
                                                             CRDeclaration *a_font_decls);

`a_font_decls`: a list of instances of CRDeclaration. Each declaration is actually a font declaration.

Creates an instance of CRStatement of type CRAtFontFaceRule.

Returns : | the newly built instance of CRStatement.

### cr_statement_new_at_import_rule ()

    CRStatement *       cr_statement_new_at_import_rule     (CRStyleSheet *a_container_sheet,
                                                             CRString *a_url,
                                                             GList *a_media_list,
                                                             CRStyleSheet *a_imported_sheet);

`a_url`: the url to connect to the get the file to be imported. `a_sheet`: the imported parsed stylesheet.

Creates a new instance of CRStatment of type CRAtImportRule.

Returns : | the newly built instance of CRStatement.

### cr_statement_new_at_media_rule ()

    CRStatement *       cr_statement_new_at_media_rule      (CRStyleSheet *a_sheet,
                                                             CRStatement *a_ruleset,
                                                             GList *a_media);

`a_ruleset`: the ruleset statements contained in the @media rule. `a_media`: the media string list. A list of GString pointers.

Instanciates an instance of CRStatement of type AT_MEDIA_RULE_STMT (@media ruleset).

### cr_statement_new_at_page_rule ()

    CRStatement *       cr_statement_new_at_page_rule       (CRStyleSheet *a_sheet,
                                                             CRDeclaration *a_decl_list,
                                                             CRString *a_name,
                                                             CRString *a_pseudo);

`a_decl_list`: a list of instances of CRDeclarations which is actually the list of declarations that applies to this page rule. `a_selector`: the page rule selector.

Creates a new instance of CRStatement of type CRAtPageRule.

Returns : | the newly built instance of CRStatement or NULL in case of error.

### cr_statement_new_ruleset ()

    CRStatement *       cr_statement_new_ruleset            (CRStyleSheet *a_sheet,
                                                             CRSelector *a_sel_list,
                                                             CRDeclaration *a_decl_list,
                                                             CRStatement *a_media_rule);

`a_sel_list`: the list of CRSimpleSel (selectors) the rule applies to. `a_decl_list`: the list of instances of CRDeclaration that composes the ruleset. `a_media_types`: a list of instances of GString that describe the media list this ruleset applies to.

Creates a new instance of CRStatement of type CRRulSet.

Returns : | the new instance of CRStatement or NULL if something went wrong.

### cr_statement_nr_rules ()

    gint                cr_statement_nr_rules               (CRStatement const *a_this);

`a_this`: the current instance of CRStatement.

Gets the number of rules in the statement list;

Returns : | number of rules in the statement list.

### cr_statement_parse_from_buf ()

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

`a_buf`: the buffer to parse. `a_encoding`: the character encoding of a_buf.

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

Returns : | the newly built instance of CRStatement in case of successful parsing, NULL otherwise.

### cr_statement_prepend ()

    CRStatement *       cr_statement_prepend                (CRStatement *a_this,
                                                             CRStatement *a_new);

`a_this`: the current instance of CRStatement. `a_new`: the new statement to prepend.

Prepends the an instance of CRStatement to the current statement list.

Returns : | the new list with the new statement prepended, or NULL in case of an error.

### cr_statement_ruleset_append_decl ()

    enum CRStatus       cr_statement_ruleset_append_decl    (CRStatement *a_this,
                                                             CRDeclaration *a_decl);

Appends a declaration to the current statement.

`a_this`: the current statement. `a_declaration`: the declaration to append.

Returns : | CR_OK upon sucessful completion, an error code otherwise.

### cr_statement_ruleset_append_decl2 ()

    enum CRStatus       cr_statement_ruleset_append_decl2   (CRStatement *a_this,
                                                             CRString *a_prop,
                                                             CRTerm *a_value);

`a_this`: the current statement. `a_prop`: the property of the declaration. `a_value`: the value of the declaration.

Appends a declaration to the current ruleset statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_ruleset_get_declarations ()

    enum CRStatus       cr_statement_ruleset_get_declarations
                                                            (CRStatement *a_this,
                                                             CRDeclaration **a_decl_list);

`a_this`: the current instance of CRStatement. `a_decl_list`: out parameter. A pointer to the the returned list of declaration. Must not be NULL.

Gets a pointer to the list of declaration contained in the ruleset statement.

Returns : | CR_OK upon successful completion, an error code if something bad happened.

### cr_statement_ruleset_get_sel_list ()

    enum CRStatus       cr_statement_ruleset_get_sel_list   (CRStatement const *a_this,
                                                             CRSelector **a_list);

`a_this`: the current ruleset statement. `a_list`: out parameter. The returned selector list, if and only if the function returned CR_OK.

Gets a pointer to the selector list contained in the current ruleset statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_ruleset_parse_from_buf ()

    CRStatement *       cr_statement_ruleset_parse_from_buf (const guchar *a_buf,
                                                             enum CREncoding a_enc);

`a_buf`: the buffer to parse. `a_enc`: the character encoding of a_buf.

Parses a buffer that contains a ruleset statement an instanciates a CRStatement of type RULESET_STMT.

Returns : | the newly built instance of CRStatement in case of successful parsing, NULL otherwise.

### cr_statement_ruleset_set_decl_list ()

    enum CRStatus       cr_statement_ruleset_set_decl_list  (CRStatement *a_this,
                                                             CRDeclaration *a_list);

`a_this`: the current ruleset statement. `a_list`: the declaration list to be added to the current ruleset statement.

Sets a declaration list to the current ruleset statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_ruleset_set_sel_list ()

    enum CRStatus       cr_statement_ruleset_set_sel_list   (CRStatement *a_this,
                                                             CRSelector *a_sel_list);

`a_this`: the current ruleset statement. `a_sel_list`: the selector list to set. Note that this function increments the ref count of a_sel_list. The sel list will be destroyed at the destruction of the current instance of CRStatement.

Sets a selector list to a ruleset statement.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_set_parent_sheet ()

    enum CRStatus       cr_statement_set_parent_sheet       (CRStatement *a_this,
                                                             CRStyleSheet *a_sheet);

`a_this`: the current instance of CRStatement. `a_sheet`: the sheet that contains the current statement.

Sets the container stylesheet.

Returns : | CR_OK upon successful completion, an error code otherwise.

### cr_statement_to_string ()

    gchar *             cr_statement_to_string              (CRStatement const *a_this,
                                                             gulong a_indent);

`a_this`: the current statement to serialize `a_indent`: the number of white space of indentation.

Serializes a css statement into a string

Returns : | the serialized statement. Must be freed by the caller using `g_free()`.

### cr_statement_unlink ()

    CRStatement *       cr_statement_unlink                 (CRStatement *a_stmt);

`a_this`: the current statements list. `a_to_unlink`: the statement to unlink from the list.

Unlinks a statement from the statements list.

Returns : | the new list where a_to_unlink has been unlinked from, or NULL in case of error.