cr-statement.h File Reference

Declaration of the CRStatement class. More...

#include <stdio.h>
#include "cr-utils.h"
#include "cr-term.h"
#include "cr-selector.h"
#include "cr-declaration.h"

Go to the source code of this file.

Data Structures

struct  _CRRuleSet
 The abstraction of a css ruleset. More...
struct  _CRAtImportRule
struct  _CRAtMediaRule
 abstraction of an @media rule More...
struct  _CRAtPageRule
 The @page rule abstraction. More...
struct  _CRAtCharsetRule
struct  _CRAtFontFaceRule
struct  _CRStatement
 The abstraction of css statement as defined in the chapter 4 and appendix D.1 of the css2 spec. More...

Typedefs

typedef struct _CRAtMediaRule CRAtMediaRule
typedef struct _CRRuleSet CRRuleSet
typedef struct _CRStyleSheet CRStyleSheet
typedef struct _CRAtImportRule CRAtImportRule
 The @import rule abstraction.
typedef struct _CRAtPageRule CRAtPageRule
typedef struct _CRAtCharsetRule CRAtCharsetRule
 The @charset rule abstraction.
typedef struct _CRAtFontFaceRule CRAtFontFaceRule
 The abstaction of the @font-face rule.

Enumerations

enum  CRStatementType {
  AT_RULE_STMT = 0, RULESET_STMT, AT_IMPORT_RULE_STMT, AT_MEDIA_RULE_STMT,
  AT_PAGE_RULE_STMT, AT_CHARSET_RULE_STMT, AT_FONT_FACE_RULE_STMT
}
 The possible types of css2 statements. More...

Functions

gboolean cr_statement_does_buf_parses_against_core (const guchar *a_buf, enum CREncoding a_encoding)
 cr_statement_does_buf_parses_against_core:
CRStatementcr_statement_parse_from_buf (const guchar *a_buf, enum CREncoding a_encoding)
 cr_statement_parse_from_buf:
CRStatementcr_statement_new_ruleset (CRStyleSheet *a_sheet, CRSelector *a_sel_list, CRDeclaration *a_decl_list, CRStatement *a_media_rule)
 cr_statement_new_ruleset:
CRStatementcr_statement_ruleset_parse_from_buf (const guchar *a_buf, enum CREncoding a_enc)
 cr_statement_ruleset_parse_from_buf:
CRStatementcr_statement_new_at_import_rule (CRStyleSheet *a_container_sheet, CRString *a_url, GList *a_media_list, CRStyleSheet *a_imported_sheet)
 cr_statement_new_at_import_rule:
CRStatementcr_statement_at_import_rule_parse_from_buf (const guchar *a_buf, enum CREncoding a_encoding)
 cr_statement_at_import_rule_parse_from_buf:
CRStatementcr_statement_new_at_media_rule (CRStyleSheet *a_sheet, CRStatement *a_ruleset, GList *a_media)
 cr_statement_new_at_media_rule:
CRStatementcr_statement_at_media_rule_parse_from_buf (const guchar *a_buf, enum CREncoding a_enc)
 cr_statement_at_media_rule_parse_from_buf:
CRStatementcr_statement_new_at_charset_rule (CRStyleSheet *a_sheet, CRString *a_charset)
 cr_statement_new_at_charset_rule:
CRStatementcr_statement_at_charset_rule_parse_from_buf (const guchar *a_buf, enum CREncoding a_encoding)
 cr_statement_at_charset_rule_parse_from_buf:
CRStatementcr_statement_new_at_font_face_rule (CRStyleSheet *a_sheet, CRDeclaration *a_font_decls)
 cr_statement_new_at_font_face_rule:
CRStatementcr_statement_font_face_rule_parse_from_buf (const guchar *a_buf, enum CREncoding a_encoding)
 cr_statement_font_face_rule_parse_from_buf:
CRStatementcr_statement_new_at_page_rule (CRStyleSheet *a_sheet, CRDeclaration *a_decl_list, CRString *a_name, CRString *a_pseudo)
 cr_statement_new_at_page_rule:
CRStatementcr_statement_at_page_rule_parse_from_buf (const guchar *a_buf, enum CREncoding a_encoding)
 cr_statement_at_page_rule_parse_from_buf:
enum CRStatus cr_statement_set_parent_sheet (CRStatement *a_this, CRStyleSheet *a_sheet)
 cr_statement_set_parent_sheet:
enum CRStatus cr_statement_get_parent_sheet (CRStatement *a_this, CRStyleSheet **a_sheet)
 cr_statement_get_parent_sheet:
CRStatementcr_statement_append (CRStatement *a_this, CRStatement *a_new)
 cr_statement_append:
CRStatementcr_statement_prepend (CRStatement *a_this, CRStatement *a_new)
 cr_statement_prepend:
CRStatementcr_statement_unlink (CRStatement *a_stmt)
 cr_statement_unlink:
enum CRStatus cr_statement_ruleset_set_sel_list (CRStatement *a_this, CRSelector *a_sel_list)
 cr_statement_ruleset_set_sel_list:
enum CRStatus cr_statement_ruleset_get_sel_list (CRStatement const *a_this, CRSelector **a_list)
 cr_statement_ruleset_get_sel_list:
enum CRStatus cr_statement_ruleset_set_decl_list (CRStatement *a_this, CRDeclaration *a_list)
 cr_statement_ruleset_set_decl_list:
enum CRStatus cr_statement_ruleset_get_declarations (CRStatement *a_this, CRDeclaration **a_decl_list)
 cr_statement_ruleset_get_declarations:
enum CRStatus cr_statement_ruleset_append_decl2 (CRStatement *a_this, CRString *a_prop, CRTerm *a_value)
 cr_statement_ruleset_append_decl2:
enum CRStatus cr_statement_ruleset_append_decl (CRStatement *a_this, CRDeclaration *a_decl)
 cr_statement_ruleset_append_decl:
enum CRStatus cr_statement_at_import_rule_set_imported_sheet (CRStatement *a_this, CRStyleSheet *a_sheet)
 cr_statement_at_import_rule_set_imported_sheet:
enum CRStatus cr_statement_at_import_rule_get_imported_sheet (CRStatement *a_this, CRStyleSheet **a_sheet)
 cr_statement_at_import_rule_get_imported_sheet:
enum CRStatus cr_statement_at_import_rule_set_url (CRStatement *a_this, CRString *a_url)
 cr_statement_at_import_rule_set_url:
enum CRStatus cr_statement_at_import_rule_get_url (CRStatement const *a_this, CRString **a_url)
 cr_statement_at_import_rule_get_url:
gint cr_statement_at_media_nr_rules (CRStatement const *a_this)
 cr_statement_at_media_nr_rules:
CRStatementcr_statement_at_media_get_from_list (CRStatement *a_this, int itemnr)
 cr_statement_at_media_get_from_list:
enum CRStatus cr_statement_at_page_rule_set_sel (CRStatement *a_this, CRSelector *a_sel)
enum CRStatus cr_statement_at_page_rule_get_sel (CRStatement const *a_this, CRSelector **a_sel)
enum CRStatus cr_statement_at_page_rule_set_declarations (CRStatement *a_this, CRDeclaration *a_decl_list)
 cr_statement_at_page_rule_set_declarations:
enum CRStatus cr_statement_at_page_rule_get_declarations (CRStatement *a_this, CRDeclaration **a_decl_list)
 cr_statement_at_page_rule_get_declarations:
enum CRStatus cr_statement_at_charset_rule_set_charset (CRStatement *a_this, CRString *a_charset)
 cr_statement_at_charset_rule_set_charset:
enum CRStatus cr_statement_at_charset_rule_get_charset (CRStatement const *a_this, CRString **a_charset)
 cr_statement_at_charset_rule_get_charset: : the current @charset rule statement.
enum CRStatus cr_statement_at_font_face_rule_set_decls (CRStatement *a_this, CRDeclaration *a_decls)
 cr_statement_at_font_face_rule_set_decls:
enum CRStatus cr_statement_at_font_face_rule_get_decls (CRStatement *a_this, CRDeclaration **a_decls)
 cr_statement_at_font_face_rule_get_decls:
enum CRStatus cr_statement_at_font_face_rule_add_decl (CRStatement *a_this, CRString *a_prop, CRTerm *a_value)
 cr_statement_at_font_face_rule_add_decl:
gchar * cr_statement_to_string (CRStatement const *a_this, gulong a_indent)
 cr_statement_to_string:
gchar * cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent)
void cr_statement_dump (CRStatement const *a_this, FILE *a_fp, gulong a_indent)
 cr_statement_dump:
void cr_statement_dump_ruleset (CRStatement const *a_this, FILE *a_fp, glong a_indent)
 cr_statement_dump_ruleset:
void cr_statement_dump_font_face_rule (CRStatement const *a_this, FILE *a_fp, glong a_indent)
 cr_statement_dump_font_face_rule:
void cr_statement_dump_page (CRStatement const *a_this, FILE *a_fp, gulong a_indent)
 cr_statement_dump_page:
void cr_statement_dump_media_rule (CRStatement const *a_this, FILE *a_fp, gulong a_indent)
 cr_statement_dump_media_rule:
void cr_statement_dump_import_rule (CRStatement const *a_this, FILE *a_fp, gulong a_indent)
 cr_statement_dump_import_rule:
void cr_statement_dump_charset (CRStatement const *a_this, FILE *a_fp, gulong a_indent)
 cr_statement_dump_charset:
gint cr_statement_nr_rules (CRStatement const *a_this)
 cr_statement_nr_rules:
CRStatementcr_statement_get_from_list (CRStatement *a_this, int itemnr)
 cr_statement_get_from_list:
void cr_statement_destroy (CRStatement *a_this)
 cr_statement_destroy:


Detailed Description

Declaration of the CRStatement class.

Definition in file cr-statement.h.


Typedef Documentation

The @charset rule abstraction.

Definition at line 126 of file cr-statement.h.

The abstaction of the @font-face rule.

Definition at line 133 of file cr-statement.h.

The @import rule abstraction.

Definition at line 88 of file cr-statement.h.

typedef struct _CRAtMediaRule CRAtMediaRule

Definition at line 54 of file cr-statement.h.

typedef struct _CRAtPageRule CRAtPageRule

Definition at line 113 of file cr-statement.h.

typedef struct _CRRuleSet CRRuleSet

Definition at line 56 of file cr-statement.h.

typedef struct _CRStyleSheet CRStyleSheet

Definition at line 84 of file cr-statement.h.


Enumeration Type Documentation

The possible types of css2 statements.

Enumerator:
AT_RULE_STMT  A generic css at-rule each unknown at-rule will be of this type.

A css at-rule

RULESET_STMT 
AT_IMPORT_RULE_STMT  A css2 import rule.
AT_MEDIA_RULE_STMT  A css2 media rule.
AT_PAGE_RULE_STMT  A css2 page rule.
AT_CHARSET_RULE_STMT  A css2 charset rule.
AT_FONT_FACE_RULE_STMT  A css2 font face rule.

Definition at line 144 of file cr-statement.h.


Function Documentation

CRStatement* cr_statement_append ( CRStatement a_this,
CRStatement a_new 
)

cr_statement_append:

: the current instance of the statement list. : 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.

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

References _CRStatement::next, and _CRStatement::prev.

Referenced by cr_statement_new_ruleset().

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

cr_statement_at_charset_rule_get_charset: : the current @charset rule statement.

: out parameter. The returned charset string if and only if the function returned CR_OK.

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

Returns CR_OK upon successful completion, an error code otherwise.

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

References AT_CHARSET_RULE_STMT, _CRAtCharsetRule::charset, _CRStatement::charset_rule, CR_BAD_PARAM_ERROR, CR_OK, _CRStatement::kind, and _CRStatement::type.

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

cr_statement_at_charset_rule_parse_from_buf:

: the buffer to parse. : 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.

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

References CR_OK, cr_parser_destroy(), cr_parser_new_from_buf(), cr_parser_parse_charset(), cr_parser_try_to_skip_spaces_and_comments(), cr_statement_new_at_charset_rule(), cr_string_destroy(), and cr_utils_trace_info.

Referenced by cr_statement_parse_from_buf().

enum CRStatus cr_statement_at_charset_rule_set_charset ( CRStatement a_this,
CRString a_charset 
)

cr_statement_at_charset_rule_set_charset:

: the current @charset rule statement. : the charset to set.

Sets the charset of the current @charset rule statement.

Returns CR_OK upon successful completion, an error code otherwise.

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

References AT_CHARSET_RULE_STMT, _CRAtCharsetRule::charset, _CRStatement::charset_rule, CR_BAD_PARAM_ERROR, CR_OK, cr_string_destroy(), _CRStatement::kind, and _CRStatement::type.

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

cr_statement_at_font_face_rule_add_decl:

: the current @font-face rule statement. : the property of the declaration. : 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.

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

References AT_FONT_FACE_RULE_STMT, CR_BAD_PARAM_ERROR, cr_declaration_append2(), cr_declaration_ref(), CR_ERROR, CR_OK, _CRAtFontFaceRule::decl_list, _CRStatement::font_face_rule, _CRStatement::kind, and _CRStatement::type.

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

cr_statement_at_font_face_rule_get_decls:

: the current @font-face rule statement. : 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.

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

References AT_FONT_FACE_RULE_STMT, CR_BAD_PARAM_ERROR, CR_OK, _CRAtFontFaceRule::decl_list, _CRStatement::font_face_rule, _CRStatement::kind, and _CRStatement::type.

enum CRStatus cr_statement_at_font_face_rule_set_decls ( CRStatement a_this,
CRDeclaration a_decls 
)

cr_statement_at_font_face_rule_set_decls:

: the current @font-face rule statement. : 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.

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

References AT_FONT_FACE_RULE_STMT, CR_BAD_PARAM_ERROR, cr_declaration_ref(), cr_declaration_unref(), CR_OK, _CRAtFontFaceRule::decl_list, _CRStatement::font_face_rule, _CRStatement::kind, and _CRStatement::type.

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

cr_statement_at_import_rule_get_imported_sheet:

: the current @import rule statement. : 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.

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

References AT_IMPORT_RULE_STMT, CR_BAD_PARAM_ERROR, CR_OK, _CRStatement::import_rule, _CRStatement::kind, _CRAtImportRule::sheet, and _CRStatement::type.

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

cr_statement_at_import_rule_get_url:

: the current @import rule statement. : 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.

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

References AT_IMPORT_RULE_STMT, CR_BAD_PARAM_ERROR, CR_OK, _CRStatement::import_rule, _CRStatement::kind, _CRStatement::type, and _CRAtImportRule::url.

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

cr_statement_at_import_rule_parse_from_buf:

: the buffer to parse. : 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.

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

References CR_OK, cr_parser_destroy(), cr_parser_new_from_buf(), cr_parser_parse_import(), cr_parser_try_to_skip_spaces_and_comments(), cr_parsing_location_copy(), cr_statement_new_at_import_rule(), cr_string_destroy(), cr_utils_trace_info, and _CRStatement::location.

Referenced by cr_statement_parse_from_buf().

enum CRStatus cr_statement_at_import_rule_set_imported_sheet ( CRStatement a_this,
CRStyleSheet a_sheet 
)

cr_statement_at_import_rule_set_imported_sheet:

Sets a stylesheet to the current @import rule. : the current @import rule. : 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.

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

References AT_IMPORT_RULE_STMT, CR_BAD_PARAM_ERROR, CR_OK, _CRStatement::import_rule, _CRStatement::kind, _CRAtImportRule::sheet, and _CRStatement::type.

enum CRStatus cr_statement_at_import_rule_set_url ( CRStatement a_this,
CRString a_url 
)

cr_statement_at_import_rule_set_url:

: the current @import rule statement. : the url to set.

Sets an url to the current @import rule statement.

Returns CR_OK upon successful completion, an error code otherwise.

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

References AT_IMPORT_RULE_STMT, CR_BAD_PARAM_ERROR, CR_OK, cr_string_destroy(), _CRStatement::import_rule, _CRStatement::kind, _CRStatement::type, and _CRAtImportRule::url.

CRStatement* cr_statement_at_media_get_from_list ( CRStatement a_this,
int  itemnr 
)

cr_statement_at_media_get_from_list:

: the current instance of CRStatement. : 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.

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

References AT_MEDIA_RULE_STMT, cr_statement_get_from_list(), _CRStatement::kind, _CRStatement::media_rule, _CRAtMediaRule::rulesets, and _CRStatement::type.

gint cr_statement_at_media_nr_rules ( CRStatement const *  a_this  ) 

cr_statement_at_media_nr_rules:

: the current instance of CRStatement.

Returns the number of rules in the media rule;

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

References AT_MEDIA_RULE_STMT, CR_BAD_PARAM_ERROR, cr_statement_nr_rules(), _CRStatement::kind, _CRStatement::media_rule, _CRAtMediaRule::rulesets, and _CRStatement::type.

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

cr_statement_at_media_rule_parse_from_buf:

: the input to parse. : 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.

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

References cr_doc_handler_get_result(), cr_doc_handler_new(), cr_doc_handler_unref(), CR_OK, cr_parser_destroy(), cr_parser_new_from_buf(), cr_parser_parse_media(), cr_parser_set_sac_handler(), cr_parser_try_to_skip_spaces_and_comments(), and cr_utils_trace_info.

Referenced by cr_statement_parse_from_buf().

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

cr_statement_at_page_rule_get_declarations:

: the current @page rule statement. : 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.

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

References AT_PAGE_RULE_STMT, CR_BAD_PARAM_ERROR, CR_OK, _CRAtPageRule::decl_list, _CRStatement::kind, _CRStatement::page_rule, and _CRStatement::type.

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 
)

cr_statement_at_page_rule_parse_from_buf:

: the character buffer to parse. : 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.

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

References cr_doc_handler_get_result(), cr_doc_handler_new(), cr_doc_handler_unref(), CR_OK, cr_parser_destroy(), cr_parser_new_from_buf(), cr_parser_parse_page(), cr_parser_set_sac_handler(), cr_parser_try_to_skip_spaces_and_comments(), and cr_utils_trace_info.

Referenced by cr_statement_parse_from_buf().

enum CRStatus cr_statement_at_page_rule_set_declarations ( CRStatement a_this,
CRDeclaration a_decl_list 
)

cr_statement_at_page_rule_set_declarations:

: the current @page rule statement. : 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.

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

References AT_PAGE_RULE_STMT, CR_BAD_PARAM_ERROR, cr_declaration_ref(), cr_declaration_unref(), CR_OK, _CRAtPageRule::decl_list, _CRStatement::kind, _CRStatement::page_rule, and _CRStatement::type.

enum CRStatus cr_statement_at_page_rule_set_sel ( CRStatement a_this,
CRSelector a_sel 
)

void cr_statement_destroy ( CRStatement a_this  ) 

cr_statement_destroy:

: the current instance of CRStatement.

Destructor of CRStatement.

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

References _CRStatement::next, and _CRStatement::prev.

Referenced by cr_statement_ruleset_parse_from_buf(), and cr_stylesheet_destroy().

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

cr_statement_does_buf_parses_against_core:

: the buffer to parse. : 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.

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

References CR_OK, cr_parser_destroy(), cr_parser_new_from_buf(), cr_parser_parse_statement_core(), and cr_parser_set_use_core_grammar().

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

cr_statement_dump:

: the current css2 statement. : the destination file pointer. : the number of white space indentation characters.

Dumps the css2 statement to a file.

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

References cr_statement_to_string().

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

cr_statement_dump_charset:

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

Dumps an @charset rule statement to a file.

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

References AT_CHARSET_RULE_STMT, and _CRStatement::type.

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

cr_statement_dump_font_face_rule:

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

Dumps a font face rule statement to a file.

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

References AT_FONT_FACE_RULE_STMT, and _CRStatement::type.

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

cr_statement_dump_import_rule:

: the destination file pointer. : the number of white space indentations.

Dumps an @import rule statement to a file.

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

References AT_IMPORT_RULE_STMT, _CRStatement::import_rule, _CRStatement::kind, and _CRStatement::type.

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

cr_statement_dump_media_rule:

: the statement to dump. : the destination file pointer : the number of white spaces indentation.

Dumps an @media rule statement to a file.

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

References AT_MEDIA_RULE_STMT, and _CRStatement::type.

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

cr_statement_dump_page:

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

Dumps an @page rule statement on stdout.

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

References AT_PAGE_RULE_STMT, _CRStatement::kind, _CRStatement::page_rule, and _CRStatement::type.

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

cr_statement_dump_ruleset:

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

Dumps a ruleset statement to a file.

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

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

cr_statement_font_face_rule_parse_from_buf:

: the buffer to parse. : 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.

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

References cr_doc_handler_get_result(), cr_doc_handler_new(), cr_doc_handler_unref(), CR_OK, cr_parser_destroy(), cr_parser_new_from_buf(), cr_parser_parse_font_face(), cr_parser_set_sac_handler(), and cr_parser_try_to_skip_spaces_and_comments().

Referenced by cr_statement_parse_from_buf().

CRStatement* cr_statement_get_from_list ( CRStatement a_this,
int  itemnr 
)

cr_statement_get_from_list:

: the current instance of CRStatement. : 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.

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

References _CRStatement::next.

Referenced by cr_statement_at_media_get_from_list(), and cr_stylesheet_statement_get_from_list().

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

cr_statement_get_parent_sheet:

: the current CRStatement. : 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.

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

References CR_BAD_PARAM_ERROR, CR_OK, and _CRStatement::parent_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 
)

cr_statement_new_at_charset_rule:

: 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.

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

References AT_CHARSET_RULE_STMT, _CRAtCharsetRule::charset, _CRStatement::charset_rule, cr_statement_set_parent_sheet(), cr_utils_trace_info, _CRStatement::kind, and _CRStatement::type.

Referenced by cr_statement_at_charset_rule_parse_from_buf().

CRStatement* cr_statement_new_at_font_face_rule ( CRStyleSheet a_sheet,
CRDeclaration a_font_decls 
)

cr_statement_new_at_font_face_rule:

: 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.

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

References AT_FONT_FACE_RULE_STMT, cr_statement_set_parent_sheet(), cr_utils_trace_info, _CRAtFontFaceRule::decl_list, _CRStatement::font_face_rule, _CRStatement::kind, and _CRStatement::type.

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

cr_statement_new_at_import_rule:

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

Creates a new instance of CRStatment of type CRAtImportRule.

Returns the newly built instance of CRStatement.

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

References AT_IMPORT_RULE_STMT, cr_statement_set_parent_sheet(), cr_utils_trace_info, _CRStatement::import_rule, _CRStatement::kind, _CRAtImportRule::media_list, _CRAtImportRule::sheet, _CRStatement::type, and _CRAtImportRule::url.

Referenced by cr_statement_at_import_rule_parse_from_buf().

CRStatement* cr_statement_new_at_media_rule ( CRStyleSheet a_sheet,
CRStatement a_rulesets,
GList *  a_media 
)

cr_statement_new_at_media_rule:

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

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

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

References AT_MEDIA_RULE_STMT, cr_statement_set_parent_sheet(), cr_utils_trace_info, _CRStatement::kind, _CRAtMediaRule::media_list, _CRStatement::media_rule, _CRStatement::next, RULESET_STMT, _CRAtMediaRule::rulesets, and _CRStatement::type.

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

cr_statement_new_at_page_rule:

: a list of instances of CRDeclarations which is actually the list of declarations that applies to this page rule. : 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.

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

References AT_PAGE_RULE_STMT, cr_declaration_ref(), cr_statement_set_parent_sheet(), cr_utils_trace_info, _CRAtPageRule::decl_list, _CRStatement::kind, _CRAtPageRule::name, _CRStatement::page_rule, _CRAtPageRule::pseudo, and _CRStatement::type.

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

cr_statement_new_ruleset:

: the list of CRSimpleSel (selectors) the rule applies to. : the list of instances of CRDeclaration that composes the ruleset. : 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.

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

References AT_MEDIA_RULE_STMT, cr_selector_ref(), cr_statement_append(), cr_statement_set_parent_sheet(), cr_utils_trace_info, _CRRuleSet::decl_list, _CRStatement::kind, _CRStatement::media_rule, _CRRuleSet::parent_media_rule, _CRStatement::ruleset, RULESET_STMT, _CRAtMediaRule::rulesets, _CRRuleSet::sel_list, and _CRStatement::type.

gint cr_statement_nr_rules ( CRStatement const *  a_this  ) 

cr_statement_nr_rules:

: the current instance of CRStatement.

Gets the number of rules in the statement list;

Returns number of rules in the statement list.

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

References _CRStatement::next.

Referenced by cr_statement_at_media_nr_rules(), and cr_stylesheet_nr_rules().

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

cr_statement_parse_from_buf:

: the buffer to parse. : 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.

Definition at line 974 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* cr_statement_prepend ( CRStatement a_this,
CRStatement a_new 
)

cr_statement_prepend:

: the current instance of CRStatement. : 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.

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

References _CRStatement::next, and _CRStatement::prev.

enum CRStatus cr_statement_ruleset_append_decl ( CRStatement a_this,
CRDeclaration a_decl 
)

cr_statement_ruleset_append_decl:

Appends a declaration to the current statement.

: the current statement. : the declaration to append.

Returns CR_OK upon sucessful completion, an error code otherwise.

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

References CR_BAD_PARAM_ERROR, cr_declaration_append(), CR_ERROR, CR_OK, _CRRuleSet::decl_list, _CRStatement::kind, _CRStatement::ruleset, RULESET_STMT, and _CRStatement::type.

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

cr_statement_ruleset_append_decl2:

: the current statement. : the property of the declaration. : the value of the declaration.

Appends a declaration to the current ruleset statement.

Returns CR_OK upon successful completion, an error code otherwise.

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

References CR_BAD_PARAM_ERROR, cr_declaration_append2(), CR_ERROR, CR_OK, _CRRuleSet::decl_list, _CRStatement::kind, _CRStatement::ruleset, RULESET_STMT, and _CRStatement::type.

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

cr_statement_ruleset_get_declarations:

: the current instance of CRStatement. : 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.

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

References CR_BAD_PARAM_ERROR, CR_OK, _CRRuleSet::decl_list, _CRStatement::kind, _CRStatement::ruleset, RULESET_STMT, and _CRStatement::type.

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

cr_statement_ruleset_get_sel_list:

: the current ruleset statement. : 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.

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

References CR_BAD_PARAM_ERROR, CR_OK, _CRStatement::kind, _CRStatement::ruleset, RULESET_STMT, _CRRuleSet::sel_list, and _CRStatement::type.

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

cr_statement_ruleset_parse_from_buf:

: the buffer to parse. : 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.

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

References cr_doc_handler_get_result(), cr_doc_handler_new(), cr_doc_handler_unref(), CR_OK, cr_parser_destroy(), cr_parser_new_from_buf(), cr_parser_parse_ruleset(), cr_parser_set_sac_handler(), cr_parser_try_to_skip_spaces_and_comments(), and cr_statement_destroy().

Referenced by cr_statement_parse_from_buf().

enum CRStatus cr_statement_ruleset_set_decl_list ( CRStatement a_this,
CRDeclaration a_list 
)

cr_statement_ruleset_set_decl_list:

: the current ruleset statement. : 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.

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

References CR_BAD_PARAM_ERROR, cr_declaration_destroy(), CR_OK, _CRRuleSet::decl_list, _CRStatement::kind, _CRStatement::ruleset, RULESET_STMT, _CRRuleSet::sel_list, and _CRStatement::type.

enum CRStatus cr_statement_ruleset_set_sel_list ( CRStatement a_this,
CRSelector a_sel_list 
)

cr_statement_ruleset_set_sel_list:

: the current ruleset statement. : 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.

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

References CR_BAD_PARAM_ERROR, CR_OK, cr_selector_ref(), cr_selector_unref(), _CRStatement::kind, _CRStatement::ruleset, RULESET_STMT, _CRRuleSet::sel_list, and _CRStatement::type.

enum CRStatus cr_statement_set_parent_sheet ( CRStatement a_this,
CRStyleSheet a_sheet 
)

cr_statement_set_parent_sheet:

: the current instance of CRStatement. : the sheet that contains the current statement.

Sets the container stylesheet.

Returns CR_OK upon successful completion, an error code otherwise.

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

References CR_BAD_PARAM_ERROR, CR_OK, and _CRStatement::parent_sheet.

Referenced by cr_statement_new_at_charset_rule(), cr_statement_new_at_font_face_rule(), cr_statement_new_at_import_rule(), cr_statement_new_at_media_rule(), cr_statement_new_at_page_rule(), and cr_statement_new_ruleset().

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

cr_statement_to_string:

: the current statement to serialize : 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().

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

References AT_CHARSET_RULE_STMT, AT_FONT_FACE_RULE_STMT, AT_IMPORT_RULE_STMT, AT_MEDIA_RULE_STMT, AT_PAGE_RULE_STMT, cr_utils_trace_info, RULESET_STMT, and _CRStatement::type.

Referenced by cr_statement_dump(), cr_statement_list_to_string(), and cr_stylesheet_to_string().

CRStatement* cr_statement_unlink ( CRStatement a_stmt  ) 

cr_statement_unlink:

: the current statements list. : 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.

Some sanity checks first

Now, the real unlinking job.

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

References _CRStatement::next, _CRStatement::parent_sheet, _CRStatement::prev, and _CRStyleSheet::statements.


Generated on Wed Jul 8 15:11:39 2009 for Libcroco by  doxygen 1.5.7.1