cr-declaration.h File Reference

The declaration of the CRDeclaration class. More...

#include <stdio.h>
#include "cr-utils.h"
#include "cr-term.h"
#include "cr-parsing-location.h"

Go to the source code of this file.

Data Structures

struct  _CRDeclaration

Typedefs

typedef struct _CRStatement CRStatement
typedef struct _CRDeclaration CRDeclaration
 The abstraction of a css declaration defined by the css2 spec in chapter 4.

Functions

CRDeclarationcr_declaration_new (CRStatement *a_statement, CRString *a_property, CRTerm *a_value)
 cr_declaration_new: : the statement this declaration belongs to.
CRDeclarationcr_declaration_parse_from_buf (CRStatement *a_statement, const guchar *a_str, enum CREncoding a_enc)
 cr_declaration_parse_from_buf: : the parent css2 statement of this this declaration.
CRDeclarationcr_declaration_parse_list_from_buf (const guchar *a_str, enum CREncoding a_enc)
 cr_declaration_parse_list_from_buf: : the input buffer that contains the list of declaration to parse.
CRDeclarationcr_declaration_append (CRDeclaration *a_this, CRDeclaration *a_new)
 cr_declaration_append: : the current declaration list.
CRDeclarationcr_declaration_append2 (CRDeclaration *a_this, CRString *a_prop, CRTerm *a_value)
 cr_declaration_append2: : the current declaration list.
CRDeclarationcr_declaration_prepend (CRDeclaration *a_this, CRDeclaration *a_new)
 cr_declaration_prepend: : the current declaration list.
CRDeclarationcr_declaration_unlink (CRDeclaration *a_decl)
 cr_declaration_unlink: : the declaration to unlink.
void cr_declaration_dump (CRDeclaration const *a_this, FILE *a_fp, glong a_indent, gboolean a_one_per_line)
 cr_declaration_dump: : the current instance of CRDeclaration.
void cr_declaration_dump_one (CRDeclaration const *a_this, FILE *a_fp, glong a_indent)
 cr_declaration_dump_one: : the current instance of CRDeclaration.
gint cr_declaration_nr_props (CRDeclaration const *a_this)
 cr_declaration_nr_props: : the current instance of CRDeclaration.
CRDeclarationcr_declaration_get_from_list (CRDeclaration *a_this, int itemnr)
 cr_declaration_get_from_list: : the current instance of CRDeclaration.
CRDeclarationcr_declaration_get_by_prop_name (CRDeclaration *a_this, const guchar *a_str)
 cr_declaration_get_by_prop_name: : the current instance of CRDeclaration.
gchar * cr_declaration_to_string (CRDeclaration const *a_this, gulong a_indent)
 cr_declaration_to_string: : the current instance of CRDeclaration.
guchar * cr_declaration_list_to_string (CRDeclaration const *a_this, gulong a_indent)
 cr_declaration_list_to_string: : the current instance of CRDeclaration.
guchar * cr_declaration_list_to_string2 (CRDeclaration const *a_this, gulong a_indent, gboolean a_one_decl_per_line)
 cr_declaration_list_to_string2: : the current instance of CRDeclaration.
void cr_declaration_ref (CRDeclaration *a_this)
 cr_declaration_ref: : the current instance of CRDeclaration.
gboolean cr_declaration_unref (CRDeclaration *a_this)
 cr_declaration_unref: : the current instance of CRDeclaration.
void cr_declaration_destroy (CRDeclaration *a_this)
 cr_declaration_destroy: : the current instance of CRDeclaration.


Detailed Description

The declaration of the CRDeclaration class.

Definition in file cr-declaration.h.


Typedef Documentation

typedef struct _CRDeclaration CRDeclaration

The abstraction of a css declaration defined by the css2 spec in chapter 4.

It is actually a chained list of property/value pairs.

Definition at line 46 of file cr-declaration.h.

typedef struct _CRStatement CRStatement

Definition at line 39 of file cr-declaration.h.


Function Documentation

CRDeclaration* cr_declaration_append ( CRDeclaration a_this,
CRDeclaration a_new 
)

cr_declaration_append: : the current declaration list.

: the declaration to append.

Appends a new declaration to the current declarations list. Returns the declaration list with a_new appended to it, or NULL in case of error.

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

References _CRDeclaration::next, and _CRDeclaration::prev.

Referenced by cr_declaration_append2(), cr_declaration_parse_list_from_buf(), and cr_statement_ruleset_append_decl().

CRDeclaration* cr_declaration_append2 ( CRDeclaration a_this,
CRString a_prop,
CRTerm a_value 
)

cr_declaration_append2: : the current declaration list.

: the property string of the declaration to append. : the value of the declaration to append.

Appends a declaration to the current declaration list. Returns the list with the new property appended to it, or NULL in case of an error.

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

References cr_declaration_append(), cr_declaration_new(), and _CRDeclaration::parent_statement.

Referenced by cr_statement_at_font_face_rule_add_decl(), and cr_statement_ruleset_append_decl2().

void cr_declaration_destroy ( CRDeclaration a_this  ) 

cr_declaration_destroy: : the current instance of CRDeclaration.

Destructor of the declaration list.

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

References cr_string_destroy(), cr_term_destroy(), _CRDeclaration::next, _CRDeclaration::prev, _CRDeclaration::property, and _CRDeclaration::value.

Referenced by cr_declaration_parse_list_from_buf(), cr_declaration_unref(), and cr_statement_ruleset_set_decl_list().

void cr_declaration_dump ( CRDeclaration const *  a_this,
FILE *  a_fp,
glong  a_indent,
gboolean  a_one_per_line 
)

cr_declaration_dump: : the current instance of CRDeclaration.

: the destination file. : the number of indentation white char. : whether to put one declaration per line of not .

Dumps a declaration list to a file.

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

References _CRDeclaration::next, and _CRDeclaration::prev.

void cr_declaration_dump_one ( CRDeclaration const *  a_this,
FILE *  a_fp,
glong  a_indent 
)

cr_declaration_dump_one: : the current instance of CRDeclaration.

: the destination file. : the number of indentation white char.

Dumps the first declaration of the declaration list to a file.

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

CRDeclaration* cr_declaration_get_by_prop_name ( CRDeclaration a_this,
const guchar *  a_prop 
)

cr_declaration_get_by_prop_name: : the current instance of CRDeclaration.

: the property name to search for.

Use property name to get a CRDeclaration from the declaration list. Returns CRDeclaration with property name a_prop, or NULL if not found.

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

References _CRDeclaration::next, and _CRDeclaration::property.

CRDeclaration* cr_declaration_get_from_list ( CRDeclaration a_this,
int  itemnr 
)

cr_declaration_get_from_list: : the current instance of CRDeclaration.

: the index into the declaration list.

Use an index to get a CRDeclaration from the declaration list.

Returns CRDeclaration at position itemnr, if itemnr > number of declarations - 1, it will return NULL.

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

References _CRDeclaration::next.

guchar* cr_declaration_list_to_string ( CRDeclaration const *  a_this,
gulong  a_indent 
)

cr_declaration_list_to_string: : the current instance of CRDeclaration.

: the number of indentation white char to put before the actual serialisation.

Serializes the declaration list into a string

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

References cr_declaration_to_string(), and _CRDeclaration::next.

guchar* cr_declaration_list_to_string2 ( CRDeclaration const *  a_this,
gulong  a_indent,
gboolean  a_one_decl_per_line 
)

cr_declaration_list_to_string2: : the current instance of CRDeclaration.

: the number of indentation white char : whether to output one doc per line or not. to put before the actual serialisation.

Serializes the declaration list into a string Returns the serialized form the declararation.

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

References cr_declaration_to_string(), and _CRDeclaration::next.

CRDeclaration* cr_declaration_new ( CRStatement a_statement,
CRString a_property,
CRTerm a_value 
)

cr_declaration_new: : the statement this declaration belongs to.

can be NULL. : the property string of the declaration : the value expression of the declaration. Constructor of CRDeclaration.

Returns the newly built instance of CRDeclaration, or NULL in case of error.

The returned CRDeclaration takes ownership of and . (E.g. cr_declaration_destroy on this CRDeclaration will also free and .)

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

References AT_FONT_FACE_RULE_STMT, AT_PAGE_RULE_STMT, cr_term_ref(), cr_utils_trace_info, _CRDeclaration::parent_statement, _CRDeclaration::property, RULESET_STMT, _CRStatement::type, and _CRDeclaration::value.

Referenced by cr_declaration_append2(), cr_declaration_parse_from_buf(), and cr_declaration_parse_list_from_buf().

gint cr_declaration_nr_props ( CRDeclaration const *  a_this  ) 

cr_declaration_nr_props: : the current instance of CRDeclaration.

Return the number of properties in the declaration

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

References _CRDeclaration::next.

CRDeclaration* cr_declaration_parse_from_buf ( CRStatement a_statement,
const guchar *  a_str,
enum CREncoding  a_enc 
)

cr_declaration_parse_from_buf: : the parent css2 statement of this this declaration.

Must be non NULL and of type RULESET_STMT (must be a ruleset). : the string that contains the statement. : the encoding of a_str.

Parses a text buffer that contains a css declaration. Returns the parsed declaration, or NULL in case of error.

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

References cr_declaration_new(), CR_OK, cr_parser_destroy(), cr_parser_new_from_buf(), cr_parser_parse_declaration(), cr_parser_try_to_skip_spaces_and_comments(), cr_string_destroy(), cr_term_destroy(), _CRDeclaration::important, RULESET_STMT, and _CRStatement::type.

CRDeclaration* cr_declaration_parse_list_from_buf ( const guchar *  a_str,
enum CREncoding  a_enc 
)

cr_declaration_parse_list_from_buf: : the input buffer that contains the list of declaration to parse.

: the encoding of a_str

Parses a ';' separated list of properties declaration. Returns the parsed list of declaration, NULL if parsing failed.

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

References cr_declaration_append(), cr_declaration_destroy(), cr_declaration_new(), CR_END_OF_INPUT_ERROR, CR_ERROR, CR_OK, cr_parser_destroy(), cr_parser_get_tknzr(), cr_parser_new_from_buf(), cr_parser_parse_declaration(), cr_parser_try_to_skip_spaces_and_comments(), cr_string_destroy(), cr_term_destroy(), cr_tknzr_peek_char(), cr_tknzr_read_char(), and _CRDeclaration::important.

CRDeclaration* cr_declaration_prepend ( CRDeclaration a_this,
CRDeclaration a_new 
)

cr_declaration_prepend: : the current declaration list.

: the declaration to prepend.

prepends a declaration to the current declaration list.

Returns the list with a_new prepended or NULL in case of error.

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

References _CRDeclaration::next, and _CRDeclaration::prev.

void cr_declaration_ref ( CRDeclaration a_this  ) 

cr_declaration_ref: : the current instance of CRDeclaration.

Increases the ref count of the current instance of CRDeclaration.

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

References _CRDeclaration::ref_count.

Referenced by cr_statement_at_font_face_rule_add_decl(), cr_statement_at_font_face_rule_set_decls(), cr_statement_at_page_rule_set_declarations(), and cr_statement_new_at_page_rule().

gchar* cr_declaration_to_string ( CRDeclaration const *  a_this,
gulong  a_indent 
)

cr_declaration_to_string: : the current instance of CRDeclaration.

: the number of indentation white char to put before the actual serialisation.

Serializes the declaration into a string Returns the serialized form the declaration. The caller must free the string using g_free().

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

References cr_term_to_string(), cr_utils_dump_n_chars2(), _CRDeclaration::important, _CRDeclaration::property, and _CRDeclaration::value.

Referenced by cr_declaration_list_to_string(), and cr_declaration_list_to_string2().

CRDeclaration* cr_declaration_unlink ( CRDeclaration a_decl  ) 

cr_declaration_unlink: : the declaration to unlink.

Unlinks the declaration from the declaration list. case of a successfull completion, NULL otherwise.

Returns a pointer to the unlinked declaration in

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

References AT_FONT_FACE_RULE_STMT, AT_PAGE_RULE_STMT, _CRAtPageRule::decl_list, _CRAtFontFaceRule::decl_list, _CRRuleSet::decl_list, _CRStatement::font_face_rule, _CRStatement::kind, _CRDeclaration::next, _CRStatement::page_rule, _CRDeclaration::parent_statement, _CRDeclaration::prev, _CRStatement::ruleset, RULESET_STMT, and _CRStatement::type.

gboolean cr_declaration_unref ( CRDeclaration a_this  ) 

cr_declaration_unref: : the current instance of CRDeclaration.

Decrements the ref count of the current instance of CRDeclaration. If the ref count reaches zero, the current instance of CRDeclaration if destroyed. Returns TRUE if was destroyed (ref count reached zero), FALSE otherwise.

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

References cr_declaration_destroy(), and _CRDeclaration::ref_count.

Referenced by cr_statement_at_font_face_rule_set_decls(), and cr_statement_at_page_rule_set_declarations().


Generated on Wed Feb 4 16:36:54 2009 for Libcroco by  doxygen 1.5.5