1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2
3 /* libcroco - Library for parsing and applying CSS
4 * Copyright (C) 2006-2019 Free Software Foundation, Inc.
5 *
6 * This file is not part of the GNU gettext program, but is used with
7 * GNU gettext.
8 *
9 * The original copyright notice is as follows:
10 */
11
12 /*
13 * This file is part of The Croco Library
14 *
15 * Copyright (C) 2003-2004 Dodji Seketeli. All Rights Reserved.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of version 2.1 of the GNU Lesser General Public
19 * License as published by the Free Software Foundation.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
29 * USA
30 */
31
32
33 #ifndef __CR_STYLESHEET_H__
34 #define __CR_STYLESHEET_H__
35
36 #include "cr-utils.h"
37 #include "cr-statement.h"
38
39 G_BEGIN_DECLS
40
41 /**
42 *@file
43 *The declaration of the #CRStyleSheet class.
44 */
45
46
47 enum CRStyleOrigin
48 {
49 /*Please don't change the order of
50 *the values enumerated here ...
51 *New values should be added at the end,
52 *just before ORIGIN_END.
53 */
54 ORIGIN_UA = 0,
55 ORIGIN_USER,
56 ORIGIN_AUTHOR,
57
58 /*must always be the last one*/
59 NB_ORIGINS
60 } ;
61
62 /**
63 *An abstraction of a css stylesheet as defined
64 *by the css2 spec in chapter 4.
65 */
66 struct _CRStyleSheet
67 {
68 /**The css statements list*/
69 CRStatement *statements ;
70
71 enum CRStyleOrigin origin ;
72
73 /*the parent import rule, if any.*/
74 CRStatement *parent_import_rule ;
75
76 /**custom data used by libcroco*/
77 gpointer croco_data ;
78
79 /**
80 *custom application data pointer
81 *Can be used by applications.
82 */
83 gpointer app_data ;
84
85 /**
86 *the reference count of this insance
87 *Please, don't never ever modify it
88 *directly. Use cr_stylesheet_ref()
89 *and cr_stylesheet_unref() instead.
90 */
91 gulong ref_count ;
92 } ;
93
94 CRStyleSheet * cr_stylesheet_new (CRStatement *a_stmts) ;
95
96 gchar * cr_stylesheet_to_string (CRStyleSheet const *a_this) ;
97 void cr_stylesheet_dump (CRStyleSheet const *a_this, FILE *a_fp) ;
98
99 gint cr_stylesheet_nr_rules (CRStyleSheet const *a_this) ;
100
101 CRStatement * cr_stylesheet_statement_get_from_list (CRStyleSheet *a_this, int itemnr) ;
102
103 void cr_stylesheet_ref (CRStyleSheet *a_this) ;
104
105 gboolean cr_stylesheet_unref (CRStyleSheet *a_this) ;
106
107 void cr_stylesheet_destroy (CRStyleSheet *a_this) ;
108
109 G_END_DECLS
110
111 #endif /*__CR_STYLESHEET_H__*/