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