1 /* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
3 /*
4 * This file is part of The Croco Library
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2.1 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 * USA
19 *
20 * See the COPYRIGHTS file for copyright information.
21 */
23 #ifndef __CR_DECLARATION_H__
24 #define __CR_DECLARATION_H__
26 #include <stdio.h>
27 #include "cr-utils.h"
28 #include "cr-term.h"
29 #include "cr-parsing-location.h"
31 G_BEGIN_DECLS
33 /**
34 *@file
35 *The declaration of the #CRDeclaration class.
36 */
38 /*forward declaration of what is defined in cr-statement.h*/
39 typedef struct _CRStatement CRStatement ;
41 /**
42 *The abstraction of a css declaration defined by the
43 *css2 spec in chapter 4.
44 *It is actually a chained list of property/value pairs.
45 */
46 typedef struct _CRDeclaration CRDeclaration ;
47 struct _CRDeclaration
48 {
49 /**The property.*/
50 CRString *property ;
52 /**The value of the property.*/
53 CRTerm *value ;
55 /*the ruleset that contains this declaration*/
56 CRStatement *parent_statement ;
58 /*the next declaration*/
59 CRDeclaration *next ;
61 /*the previous one declaration*/
62 CRDeclaration *prev ;
64 /*does the declaration have the important keyword ?*/
65 gboolean important ;
67 glong ref_count ;
69 CRParsingLocation location ;
70 /*reserved for future usage*/
71 gpointer rfu0 ;
72 gpointer rfu1 ;
73 gpointer rfu2 ;
74 gpointer rfu3 ;
75 } ;
78 CRDeclaration * cr_declaration_new (CRStatement *a_statement,
79 CRString *a_property,
80 CRTerm *a_value) ;
83 CRDeclaration * cr_declaration_parse_from_buf (CRStatement *a_statement,
84 const guchar *a_str,
85 enum CREncoding a_enc) ;
87 CRDeclaration * cr_declaration_parse_list_from_buf (const guchar *a_str,
88 enum CREncoding a_enc) ;
90 CRDeclaration * cr_declaration_append (CRDeclaration *a_this,
91 CRDeclaration *a_new) ;
93 CRDeclaration * cr_declaration_append2 (CRDeclaration *a_this,
94 CRString *a_prop,
95 CRTerm *a_value) ;
97 CRDeclaration * cr_declaration_prepend (CRDeclaration *a_this,
98 CRDeclaration *a_new) ;
100 CRDeclaration * cr_declaration_unlink (CRDeclaration * a_decl) ;
102 void
103 cr_declaration_dump (CRDeclaration *a_this,
104 FILE *a_fp, glong a_indent,
105 gboolean a_one_per_line) ;
107 void cr_declaration_dump_one (CRDeclaration *a_this,
108 FILE *a_fp, glong a_indent) ;
110 gint cr_declaration_nr_props (CRDeclaration *a_this) ;
112 CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this,
113 int itemnr) ;
115 CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration *a_this,
116 const guchar *a_str) ;
118 gchar * cr_declaration_to_string (CRDeclaration *a_this,
119 gulong a_indent) ;
121 guchar * cr_declaration_list_to_string (CRDeclaration *a_this,
122 gulong a_indent) ;
124 guchar * cr_declaration_list_to_string2 (CRDeclaration *a_this,
125 gulong a_indent,
126 gboolean a_one_decl_per_line) ;
128 void cr_declaration_ref (CRDeclaration *a_this) ;
130 gboolean cr_declaration_unref (CRDeclaration *a_this) ;
132 void cr_declaration_destroy (CRDeclaration *a_this) ;
134 G_END_DECLS
136 #endif /*__CR_DECLARATION_H__*/