Top |
Functions
CRDeclaration * | cr_declaration_new () |
CRDeclaration * | cr_declaration_parse_from_buf () |
CRDeclaration * | cr_declaration_parse_list_from_buf () |
CRDeclaration * | cr_declaration_append () |
CRDeclaration * | cr_declaration_append2 () |
CRDeclaration * | cr_declaration_prepend () |
CRDeclaration * | cr_declaration_unlink () |
void | cr_declaration_dump () |
void | cr_declaration_dump_one () |
gint | cr_declaration_nr_props () |
CRDeclaration * | cr_declaration_get_from_list () |
CRDeclaration * | cr_declaration_get_by_prop_name () |
gchar * | cr_declaration_to_string () |
guchar * | cr_declaration_list_to_string () |
guchar * | cr_declaration_list_to_string2 () |
void | cr_declaration_ref () |
gboolean | cr_declaration_unref () |
void | cr_declaration_destroy () |
Functions
cr_declaration_new ()
CRDeclaration * cr_declaration_new (CRStatement *a_statement
,CRString *a_property
,CRTerm *a_value
);
Returns the newly built instance of CRDeclaration, or NULL in case of error.
The returned CRDeclaration takes ownership of a_property
and a_value
.
(E.g. cr_declaration_destroy on this CRDeclaration will also free
a_property
and a_value
.)
Parameters
a_statement |
the statement this declaration belongs to. can be NULL. |
|
a_property |
the property string of the declaration |
|
a_value |
the value expression of the declaration. Constructor of CRDeclaration. |
cr_declaration_parse_from_buf ()
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. Returns the parsed declaration, or NULL in case of error.
cr_declaration_parse_list_from_buf ()
CRDeclaration * cr_declaration_parse_list_from_buf (const guchar *a_str
,enum CREncoding a_enc
);
Parses a ';' separated list of properties declaration. Returns the parsed list of declaration, NULL if parsing failed.
cr_declaration_append ()
CRDeclaration * cr_declaration_append (CRDeclaration *a_this
,CRDeclaration *a_new
);
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.
cr_declaration_append2 ()
CRDeclaration * cr_declaration_append2 (CRDeclaration *a_this
,CRString *a_prop
,CRTerm *a_value
);
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.
cr_declaration_prepend ()
CRDeclaration * cr_declaration_prepend (CRDeclaration *a_this
,CRDeclaration *a_new
);
prepends a declaration to the current declaration list.
Returns the list with a_new prepended or NULL in case of error.
cr_declaration_unlink ()
CRDeclaration *
cr_declaration_unlink (CRDeclaration *a_decl
);
Unlinks the declaration from the declaration list. case of a successfull completion, NULL otherwise.
Returns a pointer to the unlinked declaration in
cr_declaration_dump ()
void cr_declaration_dump (CRDeclaration const *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. |
|
a_one_per_line |
whether to put one declaration per line of not . |
cr_declaration_dump_one ()
void cr_declaration_dump_one (CRDeclaration const *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. |
cr_declaration_nr_props ()
gint
cr_declaration_nr_props (CRDeclaration const *a_this
);
Parameters
a_this |
the current instance of CRDeclaration. Return the number of properties in the declaration |
cr_declaration_get_from_list ()
CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this
,int itemnr
);
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.
Parameters
a_this |
the current instance of CRDeclaration. |
|
itemnr |
the index into the declaration list. |
cr_declaration_get_by_prop_name ()
CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration *a_this
,const guchar *a_str
);
Use property name to get a CRDeclaration from the declaration list. Returns CRDeclaration with property name a_prop, or NULL if not found.
cr_declaration_to_string ()
gchar * cr_declaration_to_string (CRDeclaration const *a_this
,gulong a_indent
);
Serializes the declaration into a string
Returns the serialized form the declaration. The caller must
free the string using g_free()
.
Parameters
a_this |
the current instance of CRDeclaration. |
|
a_indent |
the number of indentation white char to put before the actual serialisation. |
cr_declaration_list_to_string ()
guchar * cr_declaration_list_to_string (CRDeclaration const *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. |
cr_declaration_list_to_string2 ()
guchar * cr_declaration_list_to_string2 (CRDeclaration const *a_this
,gulong a_indent
,gboolean a_one_decl_per_line
);
Serializes the declaration list into a string Returns the serialized form the declararation.
Parameters
a_this |
the current instance of CRDeclaration. |
|
a_indent |
the number of indentation white char |
|
a_one_decl_per_line |
whether to output one doc per line or not. to put before the actual serialisation. |
cr_declaration_ref ()
void
cr_declaration_ref (CRDeclaration *a_this
);
Increases the ref count of the current instance of CRDeclaration.
cr_declaration_unref ()
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.
Returns TRUE if a_this
was destroyed (ref count reached zero),
FALSE otherwise.
cr_declaration_destroy ()
void
cr_declaration_destroy (CRDeclaration *a_this
);
Destructor of the declaration list.
Types and Values
struct CRDeclaration
struct CRDeclaration { /**The property.*/ CRString *property ; /**The value of the property.*/ CRTerm *value ; /*the ruleset that contains this declaration*/ CRStatement *parent_statement ; /*the next declaration*/ CRDeclaration *next ; /*the previous one declaration*/ CRDeclaration *prev ; /*does the declaration have the important keyword ?*/ gboolean important ; glong ref_count ; CRParsingLocation location ; /*reserved for future usage*/ gpointer rfu0 ; gpointer rfu1 ; gpointer rfu2 ; gpointer rfu3 ; };
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;