| Libcroco Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
CRStatement; struct CRDeclaration; CRDeclaration * cr_declaration_new (CRStatement *a_statement,CRString *a_property,CRTerm *a_value); CRDeclaration * cr_declaration_parse_from_buf (CRStatement *a_statement,const guchar *a_str,enum CREncoding a_enc); CRDeclaration * cr_declaration_parse_list_from_buf (const guchar *a_str,enum CREncoding a_enc); CRDeclaration * cr_declaration_append (CRDeclaration *a_this,CRDeclaration *a_new); CRDeclaration * cr_declaration_append2 (CRDeclaration *a_this,CRString *a_prop,CRTerm *a_value); CRDeclaration * cr_declaration_prepend (CRDeclaration *a_this,CRDeclaration *a_new); CRDeclaration * cr_declaration_unlink (CRDeclaration *a_decl); void cr_declaration_dump (CRDeclaration const *a_this,FILE *a_fp,glong a_indent,gboolean a_one_per_line); void cr_declaration_dump_one (CRDeclaration const *a_this,FILE *a_fp,glong a_indent); gint cr_declaration_nr_props (CRDeclaration const *a_this); CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this,int itemnr); CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration *a_this,const guchar *a_str); gchar * cr_declaration_to_string (CRDeclaration const *a_this,gulong a_indent); guchar * cr_declaration_list_to_string (CRDeclaration const *a_this,gulong a_indent); guchar * cr_declaration_list_to_string2 (CRDeclaration const *a_this,gulong a_indent,gboolean a_one_decl_per_line); void cr_declaration_ref (CRDeclaration *a_this); gboolean cr_declaration_unref (CRDeclaration *a_this); void cr_declaration_destroy (CRDeclaration *a_this);
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;
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 ;
};
CRDeclaration * cr_declaration_new (CRStatement *a_statement,CRString *a_property,CRTerm *a_value);
|
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 a_property and a_value.
(E.g. cr_declaration_destroy on this CRDeclaration will also free
a_property and a_value.) |
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.
|
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. |
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.
|
the input buffer that contains the list of declaration to parse. |
|
the encoding of a_str |
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.
|
the current declaration list. |
|
the declaration to append. |
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.
|
the current declaration list. |
|
the property string of the declaration to append. |
|
the value of the declaration to append. |
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.
|
the current declaration list. |
|
the declaration to prepend. |
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.
|
the current instance of CRDeclaration. |
|
the destination file. |
|
the number of indentation white char. |
|
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.
|
the current instance of CRDeclaration. |
|
the destination file. |
|
the number of indentation white char. |
gint cr_declaration_nr_props (CRDeclaration const *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.
|
the current instance of CRDeclaration. |
|
the index into the declaration list. |
Returns : |
CRDeclaration at position itemnr, if itemnr > number of declarations - 1, it will return NULL. |
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.
|
the current instance of CRDeclaration. |
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
|
the current instance of CRDeclaration. |
|
the number of indentation white char to put before the actual serialisation. |
Returns : |
the serialized form the declaration. The caller must
free the string using g_free(). |
guchar * cr_declaration_list_to_string (CRDeclaration const *a_this,gulong a_indent);
Serializes the declaration list into a string
|
the current instance of CRDeclaration. |
|
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
|
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. |
Returns : |
the serialized form the declararation. |
void cr_declaration_ref (CRDeclaration *a_this);
Increases the ref count of the current instance of CRDeclaration.
|
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.
|
the current instance of CRDeclaration. |
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.
|
the current instance of CRDeclaration. |