00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <stdio.h>
00025 #include "cr-utils.h"
00026 #include "cr-term.h"
00027 #include "cr-selector.h"
00028 #include "cr-declaration.h"
00029
00030 #ifndef __CR_STATEMENT_H__
00031 #define __CR_STATEMENT_H__
00032
00033 G_BEGIN_DECLS
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 struct _CRStatement ;
00046
00047
00048
00049
00050
00051
00052
00053 struct _CRAtMediaRule ;
00054 typedef struct _CRAtMediaRule CRAtMediaRule ;
00055
00056 typedef struct _CRRuleSet CRRuleSet ;
00057
00058
00059
00060
00061
00062
00063 struct _CRRuleSet
00064 {
00065
00066 CRSelector *sel_list ;
00067
00068
00069 CRDeclaration *decl_list ;
00070
00071
00072
00073
00074
00075 CRStatement *parent_media_rule ;
00076 } ;
00077
00078
00079
00080
00081
00082
00083 struct _CRStyleSheet ;
00084 typedef struct _CRStyleSheet CRStyleSheet;
00085
00086
00087
00088 typedef struct _CRAtImportRule CRAtImportRule ;
00089 struct _CRAtImportRule
00090 {
00091
00092 CRString *url ;
00093
00094 GList *media_list ;
00095
00096
00097
00098
00099
00100
00101 CRStyleSheet * sheet;
00102 };
00103
00104
00105
00106 struct _CRAtMediaRule
00107 {
00108 GList *media_list ;
00109 CRStatement *rulesets ;
00110 } ;
00111
00112
00113 typedef struct _CRAtPageRule CRAtPageRule ;
00114
00115 struct _CRAtPageRule
00116 {
00117
00118 CRDeclaration *decl_list ;
00119
00120
00121 CRString *name ;
00122 CRString *pseudo ;
00123 } ;
00124
00125
00126 typedef struct _CRAtCharsetRule CRAtCharsetRule ;
00127 struct _CRAtCharsetRule
00128 {
00129 CRString * charset ;
00130 };
00131
00132
00133 typedef struct _CRAtFontFaceRule CRAtFontFaceRule ;
00134 struct _CRAtFontFaceRule
00135 {
00136
00137 CRDeclaration *decl_list ;
00138 } ;
00139
00140
00141
00142
00143
00144 enum CRStatementType
00145 {
00146
00147
00148
00149
00150
00151
00152
00153 AT_RULE_STMT = 0,
00154
00155
00156 RULESET_STMT,
00157
00158
00159 AT_IMPORT_RULE_STMT,
00160
00161
00162 AT_MEDIA_RULE_STMT,
00163
00164
00165 AT_PAGE_RULE_STMT,
00166
00167
00168 AT_CHARSET_RULE_STMT,
00169
00170
00171 AT_FONT_FACE_RULE_STMT
00172 } ;
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 struct _CRStatement
00183 {
00184
00185
00186
00187 enum CRStatementType type ;
00188
00189 union
00190 {
00191 CRRuleSet *ruleset ;
00192 CRAtImportRule *import_rule ;
00193 CRAtMediaRule *media_rule ;
00194 CRAtPageRule *page_rule ;
00195 CRAtCharsetRule *charset_rule ;
00196 CRAtFontFaceRule *font_face_rule ;
00197 } kind ;
00198
00199
00200
00201
00202
00203
00204
00205 gulong specificity ;
00206
00207
00208
00209
00210
00211 CRStyleSheet *parent_sheet ;
00212 CRStatement *next ;
00213 CRStatement *prev ;
00214
00215 CRParsingLocation location ;
00216
00217
00218
00219
00220
00221
00222
00223 gpointer app_data ;
00224
00225
00226
00227
00228
00229
00230
00231 gpointer croco_data ;
00232
00233 } ;
00234
00235
00236 gboolean
00237 cr_statement_does_buf_parses_against_core (const guchar *a_buf,
00238 enum CREncoding a_encoding) ;
00239 CRStatement *
00240 cr_statement_parse_from_buf (const guchar *a_buf,
00241 enum CREncoding a_encoding) ;
00242 CRStatement*
00243 cr_statement_new_ruleset (CRStyleSheet *a_sheet,
00244 CRSelector *a_sel_list,
00245 CRDeclaration *a_decl_list,
00246 CRStatement *a_media_rule) ;
00247 CRStatement *
00248 cr_statement_ruleset_parse_from_buf (const guchar * a_buf,
00249 enum CREncoding a_enc) ;
00250
00251 CRStatement*
00252 cr_statement_new_at_import_rule (CRStyleSheet *a_container_sheet,
00253 CRString *a_url,
00254 GList *a_media_list,
00255 CRStyleSheet *a_imported_sheet) ;
00256
00257 CRStatement *
00258 cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf,
00259 enum CREncoding a_encoding) ;
00260
00261 CRStatement *
00262 cr_statement_new_at_media_rule (CRStyleSheet *a_sheet,
00263 CRStatement *a_ruleset,
00264 GList *a_media) ;
00265 CRStatement *
00266 cr_statement_at_media_rule_parse_from_buf (const guchar *a_buf,
00267 enum CREncoding a_enc) ;
00268
00269 CRStatement *
00270 cr_statement_new_at_charset_rule (CRStyleSheet *a_sheet,
00271 CRString *a_charset) ;
00272 CRStatement *
00273 cr_statement_at_charset_rule_parse_from_buf (const guchar *a_buf,
00274 enum CREncoding a_encoding);
00275
00276
00277 CRStatement *
00278 cr_statement_new_at_font_face_rule (CRStyleSheet *a_sheet,
00279 CRDeclaration *a_font_decls) ;
00280 CRStatement *
00281 cr_statement_font_face_rule_parse_from_buf (const guchar *a_buf,
00282 enum CREncoding a_encoding) ;
00283
00284 CRStatement *
00285 cr_statement_new_at_page_rule (CRStyleSheet *a_sheet,
00286 CRDeclaration *a_decl_list,
00287 CRString *a_name,
00288 CRString *a_pseudo) ;
00289 CRStatement *
00290 cr_statement_at_page_rule_parse_from_buf (const guchar *a_buf,
00291 enum CREncoding a_encoding) ;
00292
00293 enum CRStatus
00294 cr_statement_set_parent_sheet (CRStatement *a_this,
00295 CRStyleSheet *a_sheet) ;
00296
00297 enum CRStatus
00298 cr_statement_get_parent_sheet (CRStatement *a_this,
00299 CRStyleSheet **a_sheet) ;
00300
00301 CRStatement *
00302 cr_statement_append (CRStatement *a_this,
00303 CRStatement *a_new) ;
00304
00305 CRStatement*
00306 cr_statement_prepend (CRStatement *a_this,
00307 CRStatement *a_new) ;
00308
00309 CRStatement *
00310 cr_statement_unlink (CRStatement *a_stmt) ;
00311
00312 enum CRStatus
00313 cr_statement_ruleset_set_sel_list (CRStatement *a_this,
00314 CRSelector *a_sel_list) ;
00315
00316 enum CRStatus
00317 cr_statement_ruleset_get_sel_list (CRStatement const *a_this,
00318 CRSelector **a_list) ;
00319
00320 enum CRStatus
00321 cr_statement_ruleset_set_decl_list (CRStatement *a_this,
00322 CRDeclaration *a_list) ;
00323
00324 enum CRStatus
00325 cr_statement_ruleset_get_declarations (CRStatement *a_this,
00326 CRDeclaration **a_decl_list) ;
00327
00328 enum CRStatus
00329 cr_statement_ruleset_append_decl2 (CRStatement *a_this,
00330 CRString *a_prop, CRTerm *a_value) ;
00331
00332 enum CRStatus
00333 cr_statement_ruleset_append_decl (CRStatement *a_this,
00334 CRDeclaration *a_decl) ;
00335
00336 enum CRStatus
00337 cr_statement_at_import_rule_set_imported_sheet (CRStatement *a_this,
00338 CRStyleSheet *a_sheet) ;
00339
00340 enum CRStatus
00341 cr_statement_at_import_rule_get_imported_sheet (CRStatement *a_this,
00342 CRStyleSheet **a_sheet) ;
00343
00344 enum CRStatus
00345 cr_statement_at_import_rule_set_url (CRStatement *a_this,
00346 CRString *a_url) ;
00347
00348 enum CRStatus
00349 cr_statement_at_import_rule_get_url (CRStatement const *a_this,
00350 CRString **a_url) ;
00351
00352 gint
00353 cr_statement_at_media_nr_rules (CRStatement const *a_this) ;
00354
00355 CRStatement *
00356 cr_statement_at_media_get_from_list (CRStatement *a_this, int itemnr) ;
00357
00358 enum CRStatus
00359 cr_statement_at_page_rule_set_sel (CRStatement *a_this,
00360 CRSelector *a_sel) ;
00361
00362 enum CRStatus
00363 cr_statement_at_page_rule_get_sel (CRStatement const *a_this,
00364 CRSelector **a_sel) ;
00365
00366 enum CRStatus
00367 cr_statement_at_page_rule_set_declarations (CRStatement *a_this,
00368 CRDeclaration *a_decl_list) ;
00369
00370 enum CRStatus
00371 cr_statement_at_page_rule_get_declarations (CRStatement *a_this,
00372 CRDeclaration **a_decl_list) ;
00373
00374 enum CRStatus
00375 cr_statement_at_charset_rule_set_charset (CRStatement *a_this,
00376 CRString *a_charset) ;
00377
00378 enum CRStatus
00379 cr_statement_at_charset_rule_get_charset (CRStatement const *a_this,
00380 CRString **a_charset) ;
00381
00382 enum CRStatus
00383 cr_statement_at_font_face_rule_set_decls (CRStatement *a_this,
00384 CRDeclaration *a_decls) ;
00385
00386 enum CRStatus
00387 cr_statement_at_font_face_rule_get_decls (CRStatement *a_this,
00388 CRDeclaration **a_decls) ;
00389
00390 enum CRStatus
00391 cr_statement_at_font_face_rule_add_decl (CRStatement *a_this,
00392 CRString *a_prop,
00393 CRTerm *a_value) ;
00394
00395 gchar *
00396 cr_statement_to_string (CRStatement const * a_this, gulong a_indent) ;
00397
00398 gchar*
00399 cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent) ;
00400
00401 void
00402 cr_statement_dump (CRStatement const *a_this, FILE *a_fp, gulong a_indent) ;
00403
00404 void
00405 cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp,
00406 glong a_indent) ;
00407
00408 void
00409 cr_statement_dump_font_face_rule (CRStatement const * a_this,
00410 FILE * a_fp,
00411 glong a_indent) ;
00412
00413 void
00414 cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp,
00415 gulong a_indent) ;
00416
00417
00418 void
00419 cr_statement_dump_media_rule (CRStatement const * a_this,
00420 FILE * a_fp,
00421 gulong a_indent) ;
00422
00423 void
00424 cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp,
00425 gulong a_indent) ;
00426 void
00427 cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp,
00428 gulong a_indent) ;
00429 gint
00430 cr_statement_nr_rules (CRStatement const *a_this) ;
00431
00432 CRStatement *
00433 cr_statement_get_from_list (CRStatement *a_this, int itemnr) ;
00434
00435 void
00436 cr_statement_destroy (CRStatement *a_this) ;
00437
00438 G_END_DECLS
00439
00440 #endif