45 dump (
CRDeclaration const * a_this, FILE * a_fp, glong a_indent)
49 g_return_if_fail (a_this);
53 fprintf (a_fp,
"%s", str);
79 g_return_val_if_fail (a_property, NULL);
82 g_return_val_if_fail (a_statement
96 result->
value = a_value;
126 gboolean important = FALSE;
128 g_return_val_if_fail (a_str, NULL);
134 g_return_val_if_fail (parser, NULL);
142 if (status !=
CR_OK || !property)
193 gboolean important = FALSE;
195 g_return_val_if_fail (a_str, NULL);
198 g_return_val_if_fail (parser, NULL);
200 if (status !=
CR_OK || !tokenizer) {
211 if (status !=
CR_OK || !property) {
228 if (status !=
CR_OK) {
242 if (status !=
CR_OK || !property) {
250 cur_decl->important = important;
277 if (status !=
CR_OK && result) {
298 g_return_val_if_fail (a_new, NULL);
303 for (cur = a_this; cur && cur->
next; cur = cur->
next) ;
325 g_return_val_if_fail (result, NULL);
331 g_return_val_if_fail (a_decl->
prev->
next == a_decl, NULL);
335 g_return_val_if_fail (a_decl->
next->
prev == a_decl, NULL);
377 if (children_decl_ptr
378 && *children_decl_ptr && *children_decl_ptr == a_decl)
379 *children_decl_ptr = (*children_decl_ptr)->
next;
403 g_return_val_if_fail (a_new, NULL);
408 a_this->
prev = a_new;
409 a_new->
next = a_this;
411 for (cur = a_new; cur && cur->
prev; cur = cur->
prev) ;
439 g_return_val_if_fail (new_elem, NULL);
456 gboolean a_one_per_line)
460 g_return_if_fail (a_this);
462 for (cur = a_this; cur; cur = cur->
next) {
464 if (a_one_per_line == TRUE)
465 fprintf (a_fp,
";\n");
467 fprintf (a_fp,
"; ");
469 dump (cur, a_fp, a_indent);
484 g_return_if_fail (a_this);
486 dump (a_this, a_fp, a_indent);
502 GString *stringue = NULL;
507 g_return_val_if_fail (a_this, NULL);
509 stringue = g_string_new (NULL);
514 str = g_strndup (a_this->
property->stryng->str,
519 g_string_append (stringue, str);
526 guchar *value_str = NULL;
530 g_string_append_printf (stringue,
" : %s",
537 g_string_append_printf (stringue,
" %s",
541 if (stringue && stringue->str) {
542 result = stringue->str;
543 g_string_free (stringue, FALSE);
549 g_string_free (stringue, TRUE);
572 GString *stringue = NULL;
576 g_return_val_if_fail (a_this, NULL);
578 stringue = g_string_new (NULL);
580 for (cur = a_this; cur; cur = cur->
next) {
583 g_string_append_printf (stringue,
"%s;", str);
588 if (stringue && stringue->str) {
589 result = (guchar *) stringue->str;
590 g_string_free (stringue, FALSE);
608 gulong a_indent, gboolean a_one_decl_per_line)
611 GString *stringue = NULL;
615 g_return_val_if_fail (a_this, NULL);
617 stringue = g_string_new (NULL);
619 for (cur = a_this; cur; cur = cur->
next) {
622 if (a_one_decl_per_line == TRUE) {
624 g_string_append_printf (stringue,
627 g_string_append (stringue,
628 (
const gchar *) str);
631 g_string_append_printf (stringue,
634 g_string_append (stringue,
635 (
const gchar *) str);
641 if (stringue && stringue->str) {
642 result = (guchar *) stringue->str;
643 g_string_free (stringue, FALSE);
660 g_return_val_if_fail (a_this, -1);
662 for (cur = a_this; cur; cur = cur->
next)
684 g_return_val_if_fail (a_this, NULL);
686 for (cur = a_this; cur; cur = cur->
next)
702 const guchar * a_prop)
706 g_return_val_if_fail (a_this, NULL);
707 g_return_val_if_fail (a_prop, NULL);
709 for (cur = a_this; cur; cur = cur->
next) {
713 if (!strcmp (cur->
property->stryng->str,
714 (
const char *) a_prop)) {
731 g_return_if_fail (a_this);
749 g_return_val_if_fail (a_this, FALSE);
773 g_return_if_fail (a_this);
778 for (cur = a_this; cur->
next; cur = cur->
next)
785 for (; cur; cur = cur->
prev) {
CRDeclaration * cr_declaration_parse_list_from_buf(const guchar *a_str, enum CREncoding a_enc)
cr_declaration_parse_list_from_buf: @a_str: the input buffer that contains the list of declaration to...
CRDeclaration * decl_list
A list of instances of CRDeclaration.
union _CRStatement::@1 kind
CRAtFontFaceRule * font_face_rule
The implementation of the SAC parser.
Declaration of the CRStatement class.
guchar * cr_declaration_list_to_string(CRDeclaration const *a_this, gulong a_indent)
cr_declaration_list_to_string: @a_this: the current instance of CRDeclaration.
enum CRStatus cr_tknzr_peek_char(CRTknzr *a_this, guint32 *a_char)
Peeks a char from the parser input stream.
void cr_declaration_destroy(CRDeclaration *a_this)
cr_declaration_destroy: @a_this: the current instance of CRDeclaration.
void cr_declaration_dump_one(CRDeclaration const *a_this, FILE *a_fp, glong a_indent)
cr_declaration_dump_one: @a_this: the current instance of CRDeclaration.
CRTerm * value
The value of the property.
void cr_string_destroy(CRString *a_this)
CREncoding
Encoding values.
enum CRStatus cr_parser_try_to_skip_spaces_and_comments(CRParser *a_this)
cr_parser_try_to_skip_spaces_and_comments: @a_this: the current instance of CRParser.
CRDeclaration * decl_list
CRDeclaration * cr_declaration_get_by_prop_name(CRDeclaration *a_this, const guchar *a_prop)
cr_declaration_get_by_prop_name: @a_this: the current instance of CRDeclaration.
CRStatus
The status type returned by the methods of the croco library.
enum CRStatementType type
The type of the statement.
CRDeclaration * cr_declaration_append(CRDeclaration *a_this, CRDeclaration *a_new)
cr_declaration_append: @a_this: the current declaration list.
gchar * cr_declaration_to_string(CRDeclaration const *a_this, gulong a_indent)
cr_declaration_to_string: @a_this: the current instance of CRDeclaration.
The abstraction of css statement as defined in the chapter 4 and appendix D.1 of the css2 spec.
CRDeclaration * cr_declaration_unlink(CRDeclaration *a_decl)
cr_declaration_unlink: @a_decls: the declaration to unlink.
guchar * cr_declaration_list_to_string2(CRDeclaration const *a_this, gulong a_indent, gboolean a_one_decl_per_line)
cr_declaration_list_to_string2: @a_this: the current instance of CRDeclaration.
gboolean cr_declaration_unref(CRDeclaration *a_this)
cr_declaration_unref: @a_this: the current instance of CRDeclaration.
CRString * property
The property.
typedefG_BEGIN_DECLS struct _CRTknzr CRTknzr
gint cr_declaration_nr_props(CRDeclaration const *a_this)
cr_declaration_nr_props: @a_this: the current instance of CRDeclaration.
void cr_declaration_dump(CRDeclaration const *a_this, FILE *a_fp, glong a_indent, gboolean a_one_per_line)
cr_declaration_dump: @a_this: the current instance of CRDeclaration.
The declaration of the CRDeclaration class.
guchar * cr_term_to_string(CRTerm const *a_this)
Serializes the expression represented by the chained instances of #CRterm.
void cr_term_ref(CRTerm *a_this)
Increments the reference counter of the current instance of CRTerm.
CRParser * cr_parser_new_from_buf(guchar *a_buf, gulong a_len, enum CREncoding a_enc, gboolean a_free_buf)
cr_parser_new_from_buf: @a_buf: the buffer to parse.
CRStatement * parent_statement
typedefG_BEGIN_DECLS struct _CRString CRString
CRDeclaration * cr_declaration_append2(CRDeclaration *a_this, CRString *a_prop, CRTerm *a_value)
cr_declaration_append2: @a_this: the current declaration list.
CRDeclaration * cr_declaration_get_from_list(CRDeclaration *a_this, int itemnr)
cr_declaration_get_from_list: @a_this: the current instance of CRDeclaration.
CRDeclaration * cr_declaration_prepend(CRDeclaration *a_this, CRDeclaration *a_new)
cr_declaration_prepend: @a_this: the current declaration list.
CRDeclaration * cr_declaration_new(CRStatement *a_statement, CRString *a_property, CRTerm *a_value)
cr_declaration_new: @a_statement: the statement this declaration belongs to.
An abstraction of a css2 term as defined in the CSS2 spec in appendix D.1: term ::= [ NUMBER S* | PER...
void cr_utils_dump_n_chars2(guchar a_char, GString *a_string, glong a_nb)
The declaration file of the CRParser class.
void cr_parser_destroy(CRParser *a_this)
cr_parser_destroy: @a_this: the current instance of CRParser to destroy.
CRDeclaration * cr_declaration_parse_from_buf(CRStatement *a_statement, const guchar *a_str, enum CREncoding a_enc)
cr_declaration_parse_from_buf: @a_statement: the parent css2 statement of this this declaration.
enum CRStatus cr_tknzr_read_char(CRTknzr *a_this, guint32 *a_char)
Reads the next char from the parser input stream.
enum CRStatus cr_parser_get_tknzr(CRParser *a_this, CRTknzr **a_tknzr)
cr_parser_get_tknzr: @a_this: the current instance of CRParser @a_tknzr: out parameter.
enum CRStatus cr_parser_parse_declaration(CRParser *a_this, CRString **a_property, CRTerm **a_expr, gboolean *a_important)
cr_parser_parse_declaration: @a_this: the "this pointer" of the current instance of CRParser.
void cr_declaration_ref(CRDeclaration *a_this)
cr_declaration_ref: @a_this: the current instance of CRDeclaration.
void cr_term_destroy(CRTerm *a_this)
The destructor of the the CRTerm class.
#define cr_utils_trace_info(a_msg)
Traces an info message.