Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

cr-declaration.c File Reference

The definition of the CRDeclaration class. More...

#include <string.h>
#include "cr-declaration.h"
#include "cr-statement.h"
#include "cr-parser.h"

Go to the source code of this file.

Functions

CRDeclarationcr_declaration_new (CRStatement *a_statement, CRString *a_property, CRTerm *a_value)
 Constructor of CRDeclaration.
CRDeclarationcr_declaration_parse_from_buf (CRStatement *a_statement, const guchar *a_str, enum CREncoding a_enc)
 Parses a text buffer that contains a css declaration.
CRDeclarationcr_declaration_parse_list_from_buf (const guchar *a_str, enum CREncoding a_enc)
 Parses a ';' separated list of properties declaration.
CRDeclarationcr_declaration_append (CRDeclaration *a_this, CRDeclaration *a_new)
 Appends a new declaration to the current declarations list.
CRDeclarationcr_declaration_unlink (CRDeclaration *a_decl)
 Unlinks the declaration from the declaration list.
CRDeclarationcr_declaration_prepend (CRDeclaration *a_this, CRDeclaration *a_new)
 prepends a declaration to the current declaration list.
CRDeclarationcr_declaration_append2 (CRDeclaration *a_this, CRString *a_prop, CRTerm *a_value)
 Appends a declaration to the current declaration list.
void cr_declaration_dump (CRDeclaration *a_this, FILE *a_fp, glong a_indent, gboolean a_one_per_line)
 Dumps a declaration list to a file.
void cr_declaration_dump_one (CRDeclaration *a_this, FILE *a_fp, glong a_indent)
 Dumps the first declaration of the declaration list to a file.
gchar * cr_declaration_to_string (CRDeclaration *a_this, gulong a_indent)
 Serializes the declaration into a string.
guchar * cr_declaration_list_to_string (CRDeclaration *a_this, gulong a_indent)
 Serializes the declaration list into a string.
guchar * cr_declaration_list_to_string2 (CRDeclaration *a_this, gulong a_indent, gboolean a_one_decl_per_line)
 Serializes the declaration list into a string.
gint cr_declaration_nr_props (CRDeclaration *a_this)
 Return the number of properties in the declaration;.
CRDeclarationcr_declaration_get_from_list (CRDeclaration *a_this, int itemnr)
 Use an index to get a CRDeclaration from the declaration list.
CRDeclarationcr_declaration_get_by_prop_name (CRDeclaration *a_this, const guchar *a_prop)
 Use property name to get a CRDeclaration from the declaration list.
void cr_declaration_ref (CRDeclaration *a_this)
 Increases the ref count of the current instance of CRDeclaration.
gboolean cr_declaration_unref (CRDeclaration *a_this)
 Decrements the ref count of the current instance of CRDeclaration.
void cr_declaration_destroy (CRDeclaration *a_this)
 Destructor of the declaration list.


Detailed Description

The definition of the CRDeclaration class.

Definition in file cr-declaration.c.


Function Documentation

CRDeclaration* cr_declaration_append CRDeclaration a_this,
CRDeclaration a_new
 

Appends a new declaration to the current declarations list.

Parameters:
a_this the current declaration list.
a_new the declaration to append.
Returns:
the declaration list with a_new appended to it, or NULL in case of error.

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

References CRDeclaration, _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
 

Appends a declaration to the current declaration list.

Parameters:
a_this the current declaration list.
a_prop the property string of the declaration to append.
a_value the value of the declaration to append.
Returns:
the list with the new property appended to it, or NULL in case of an error.

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

References cr_declaration_append(), cr_declaration_new(), CRDeclaration, CRString, CRTerm, 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  ) 
 

Destructor of the declaration list.

Parameters:
a_this the current instance of CRDeclaration.

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

References cr_string_destroy(), cr_term_destroy(), CRDeclaration, _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 a_this,
FILE *  a_fp,
glong  a_indent,
gboolean  a_one_per_line
 

Dumps a declaration list to a file.

Parameters:
a_this the current instance of CRDeclaration.
a_fp the destination file.
a_indent the number of indentation white char.

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

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

void cr_declaration_dump_one CRDeclaration a_this,
FILE *  a_fp,
glong  a_indent
 

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

Parameters:
a_this the current instance of CRDeclaration.
a_fp the destination file.
a_indent the number of indentation white char.

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

References CRDeclaration.

CRDeclaration* cr_declaration_get_by_prop_name CRDeclaration a_this,
const guchar *  a_prop
 

Use property name to get a CRDeclaration from the declaration list.

Parameters:
a_this the current instance of CRDeclaration.
a_prop the property name to search for.
Returns:
CRDeclaration with property name a_prop, or NULL if not found.

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

References CRDeclaration, _CRDeclaration::next, _CRDeclaration::property, and _CRString::stryng.

CRDeclaration* cr_declaration_get_from_list CRDeclaration a_this,
int  itemnr
 

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

Parameters:
a_this the current instance of CRDeclaration.
itemnr the index into the declaration list.
Returns:
CRDeclaration at position itemnr, if itemnr > number of declarations - 1, it will return NULL.

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

References CRDeclaration, and _CRDeclaration::next.

guchar* cr_declaration_list_to_string CRDeclaration a_this,
gulong  a_indent
 

Serializes the declaration list into a string.

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

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

References cr_declaration_to_string(), CRDeclaration, and _CRDeclaration::next.

guchar* cr_declaration_list_to_string2 CRDeclaration a_this,
gulong  a_indent,
gboolean  a_one_decl_per_line
 

Serializes the declaration list into a string.

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

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

References cr_declaration_to_string(), CRDeclaration, and _CRDeclaration::next.

CRDeclaration* cr_declaration_new CRStatement a_statement,
CRString a_property,
CRTerm a_value
 

Constructor of CRDeclaration.

Parameters:
a_property the property string of the declaration
a_value the value expression of the declaration.
Returns:
the newly built instance of CRDeclaration, or NULL in case of error.

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

References AT_FONT_FACE_RULE_STMT, AT_PAGE_RULE_STMT, cr_term_ref(), cr_utils_trace_info, CRDeclaration, CRStatement, CRString, CRTerm, _CRDeclaration::parent_statement, _CRDeclaration::property, RULESET_STMT, 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 a_this  ) 
 

Return the number of properties in the declaration;.

Parameters:
a_this the current instance of CRDeclaration.
Returns:
number of properties in the declaration list.

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

References CRDeclaration, and _CRDeclaration::next.

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

Parses a text buffer that contains a css declaration.

Parameters:
a_statement the parent css2 statement of this this declaration. Must be non NULL and of type RULESET_STMT (must be a ruleset).
a_str the string that contains the statement.
a_enc the encoding of a_str.
Returns:
the parsed declaration, or NULL in case of error.

Definition at line 107 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, CRParser, CRStatement, CRStatus, CRString, CRTerm, _CRDeclaration::important, and RULESET_STMT.

CRDeclaration* cr_declaration_parse_list_from_buf const guchar *  a_str,
enum CREncoding  a_enc
 

Parses a ';' separated list of properties declaration.

Parameters:
a_str the input buffer that contains the list of declaration to parse.
a_enc the encoding of a_str
Returns:
the parsed list of declaration, NULL if parsing failed.

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

References cr_declaration_append(), cr_declaration_destroy(), cr_declaration_new(), 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(), CRDeclaration, CRParser, CRStatus, CRString, CRTerm, CRTknzr, and _CRDeclaration::important.

CRDeclaration* cr_declaration_prepend CRDeclaration a_this,
CRDeclaration a_new
 

prepends a declaration to the current declaration list.

Parameters:
a_this the current declaration list.
a_new the declaration to prepend.
Returns:
the list with a_new prepended or NULL in case of error.

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

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

void cr_declaration_ref CRDeclaration a_this  ) 
 

Increases the ref count of the current instance of CRDeclaration.

Parameters:
a_this the current instance of CRDeclaration.

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

References CRDeclaration, and _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 a_this,
gulong  a_indent
 

Serializes the declaration into a string.

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

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

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

Referenced by cr_declaration_list_to_string(), and cr_declaration_list_to_string2().

CRDeclaration* cr_declaration_unlink CRDeclaration a_decl  ) 
 

Unlinks the declaration from the declaration list.

Parameters:
a_decl the declaration to unlink.
Returns:
a pointer to the unlinked declaration in case of a successfull completion, NULL otherwise.

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

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

gboolean cr_declaration_unref CRDeclaration a_this  ) 
 

Decrements the ref count of the current instance of CRDeclaration.

If the ref count reaches zero, the current instance of CRDeclaration if destroyed.

Parameters:
a_this the current instance of CRDeclaration.
Returns:
TRUE if the current instance of CRDeclaration has been destroyed (ref count reached zero), FALSE otherwise.

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

References cr_declaration_destroy(), CRDeclaration, and _CRDeclaration::ref_count.

Referenced by cr_statement_at_font_face_rule_set_decls(), and cr_statement_at_page_rule_set_declarations().


Generated on Fri Oct 29 08:29:13 2004 for Libcroco by  doxygen 1.3.9.1