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 AT_RULE_STMT = 0,
00155
00156
00157 RULESET_STMT,
00158
00159
00160 AT_IMPORT_RULE_STMT,
00161
00162
00163 AT_MEDIA_RULE_STMT,
00164
00165
00166 AT_PAGE_RULE_STMT,
00167
00168
00169 AT_CHARSET_RULE_STMT,
00170
00171
00172 AT_FONT_FACE_RULE_STMT
00173 } ;
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 struct _CRStatement
00184 {
00185
00186
00187
00188 enum CRStatementType type ;
00189
00190 union
00191 {
00192 CRRuleSet *ruleset ;
00193 CRAtImportRule *import_rule ;
00194 CRAtMediaRule *media_rule ;
00195 CRAtPageRule *page_rule ;
00196 CRAtCharsetRule *charset_rule ;
00197 CRAtFontFaceRule *font_face_rule ;
00198 } kind ;
00199
00200
00201
00202
00203
00204
00205
00206 gulong specificity ;
00207
00208
00209
00210
00211
00212 CRStyleSheet *parent_sheet ;
00213 CRStatement *next ;
00214 CRStatement *prev ;
00215
00216
00217
00218
00219
00220
00221
00222 gpointer app_data ;
00223
00224
00225
00226
00227
00228
00229
00230 gpointer croco_data ;
00231
00232 } ;
00233
00234
00235 gboolean
00236 cr_statement_does_buf_parses_against_core (const guchar *a_buf,
00237 enum CREncoding a_encoding) ;
00238 CRStatement *
00239 cr_statement_parse_from_buf (const guchar *a_buf,
00240 enum CREncoding a_encoding) ;
00241 CRStatement*
00242 cr_statement_new_ruleset (CRStyleSheet *a_sheet,
00243 CRSelector *a_sel_list,
00244 CRDeclaration *a_decl_list,
00245 CRStatement *a_media_rule) ;
00246 CRStatement *
00247 cr_statement_ruleset_parse_from_buf (const guchar * a_buf,
00248 enum CREncoding a_enc) ;
00249
00250 CRStatement*
00251 cr_statement_new_at_import_rule (CRStyleSheet *a_container_sheet,
00252 GString *a_url,
00253 GList *a_media_list,
00254 CRStyleSheet *a_imported_sheet) ;
00255
00256 CRStatement *
00257 cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf,
00258 enum CREncoding a_encoding) ;
00259
00260 CRStatement *
00261 cr_statement_new_at_media_rule (CRStyleSheet *a_sheet,
00262 CRStatement *a_ruleset,
00263 GList *a_media) ;
00264 CRStatement *
00265 cr_statement_at_media_rule_parse_from_buf (const guchar *a_buf,
00266 enum CREncoding a_enc) ;
00267
00268 CRStatement *
00269 cr_statement_new_at_charset_rule (CRStyleSheet *a_sheet,
00270 GString *a_charset) ;
00271 CRStatement *
00272 cr_statement_at_charset_rule_parse_from_buf (const guchar *a_buf,
00273 enum CREncoding a_encoding);
00274
00275
00276 CRStatement *
00277 cr_statement_new_at_font_face_rule (CRStyleSheet *a_sheet,
00278 CRDeclaration *a_font_decls) ;
00279 CRStatement *
00280 cr_statement_font_face_rule_parse_from_buf (const guchar *a_buf,
00281 enum CREncoding a_encoding) ;
00282
00283 CRStatement *
00284 cr_statement_new_at_page_rule (CRStyleSheet *a_sheet,
00285 CRDeclaration *a_decl_list,
00286 GString *a_name,
00287 GString *a_pseudo) ;
00288 CRStatement *
00289 cr_statement_at_page_rule_parse_from_buf (const guchar *a_buf,
00290 enum CREncoding a_encoding) ;
00291
00292 enum CRStatus
00293 cr_statement_set_parent_sheet (CRStatement *a_this,
00294 CRStyleSheet *a_sheet) ;
00295
00296 enum CRStatus
00297 cr_statement_get_parent_sheet (CRStatement *a_this,
00298 CRStyleSheet **a_sheet) ;
00299
00300 CRStatement *
00301 cr_statement_append (CRStatement *a_this,
00302 CRStatement *a_new) ;
00303
00304 CRStatement*
00305 cr_statement_prepend (CRStatement *a_this,
00306 CRStatement *a_new) ;
00307
00308 CRStatement *
00309 cr_statement_unlink (CRStatement *a_stmt) ;
00310
00311 enum CRStatus
00312 cr_statement_ruleset_set_sel_list (CRStatement *a_this,
00313 CRSelector *a_sel_list) ;
00314
00315 enum CRStatus
00316 cr_statement_ruleset_get_sel_list (CRStatement *a_this,
00317 CRSelector **a_list) ;
00318
00319 enum CRStatus
00320 cr_statement_ruleset_set_decl_list (CRStatement *a_this,
00321 CRDeclaration *a_list) ;
00322
00323 enum CRStatus
00324 cr_statement_ruleset_get_declarations (CRStatement *a_this,
00325 CRDeclaration **a_decl_list) ;
00326
00327 enum CRStatus
00328 cr_statement_ruleset_append_decl2 (CRStatement *a_this,
00329 GString *a_prop, CRTerm *a_value) ;
00330
00331 enum CRStatus
00332 cr_statement_ruleset_append_decl (CRStatement *a_this,
00333 CRDeclaration *a_decl) ;
00334
00335 enum CRStatus
00336 cr_statement_at_import_rule_set_imported_sheet (CRStatement *a_this,
00337 CRStyleSheet *a_sheet) ;
00338
00339 enum CRStatus
00340 cr_statement_at_import_rule_get_imported_sheet (CRStatement *a_this,
00341 CRStyleSheet **a_sheet) ;
00342
00343 enum CRStatus
00344 cr_statement_at_import_rule_set_url (CRStatement *a_this,
00345 GString *a_url) ;
00346
00347 enum CRStatus
00348 cr_statement_at_import_rule_get_url (CRStatement *a_this,
00349 GString **a_url) ;
00350
00351 enum CRStatus
00352 cr_statement_at_page_rule_set_sel (CRStatement *a_this,
00353 CRSelector *a_sel) ;
00354
00355 enum CRStatus
00356 cr_statement_at_page_rule_get_sel (CRStatement *a_this,
00357 CRSelector **a_sel) ;
00358
00359 enum CRStatus
00360 cr_statement_at_page_rule_set_declarations (CRStatement *a_this,
00361 CRDeclaration *a_decl_list) ;
00362
00363 enum CRStatus
00364 cr_statement_at_page_rule_get_declarations (CRStatement *a_this,
00365 CRDeclaration **a_decl_list) ;
00366
00367 enum CRStatus
00368 cr_statement_at_charset_rule_set_charset (CRStatement *a_this,
00369 GString *a_charset) ;
00370
00371 enum CRStatus
00372 cr_statement_at_charset_rule_get_charset (CRStatement *a_this,
00373 GString **a_charset) ;
00374
00375 enum CRStatus
00376 cr_statement_at_font_face_rule_set_decls (CRStatement *a_this,
00377 CRDeclaration *a_decls) ;
00378
00379 enum CRStatus
00380 cr_statement_at_font_face_rule_get_decls (CRStatement *a_this,
00381 CRDeclaration **a_decls) ;
00382
00383 enum CRStatus
00384 cr_statement_at_font_face_rule_add_decl (CRStatement *a_this,
00385 GString *a_prop,
00386 CRTerm *a_value) ;
00387
00388 void
00389 cr_statement_dump (CRStatement *a_this, FILE *a_fp, gulong a_indent) ;
00390
00391 void
00392 cr_statement_destroy (CRStatement *a_this) ;
00393
00394 G_END_DECLS
00395
00396 #endif