| Top |
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
.)
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. |
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.
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.
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.
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.
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.
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
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.
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 . |
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.
a_this |
the current instance of CRDeclaration. |
|
a_fp |
the destination file. |
|
a_indent |
the number of indentation white char. |
gint
cr_declaration_nr_props (CRDeclaration const *a_this);
a_this |
the current instance of CRDeclaration. Return the number of properties in the declaration |
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.
a_this |
the current instance of CRDeclaration. |
|
itemnr |
the index into the declaration list. |
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.
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().
a_this |
the current instance of CRDeclaration. |
|
a_indent |
the number of indentation white char to put before the actual serialisation. |
guchar * cr_declaration_list_to_string (CRDeclaration const *a_this,gulong a_indent);
Serializes the declaration list into a string
a_this |
the current instance of CRDeclaration. |
|
a_indent |
the number of indentation white char to put before the actual serialisation. |
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.
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. |
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.
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.
void
cr_declaration_destroy (CRDeclaration *a_this);
Destructor of the declaration list.
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 ;
};
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;