1 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2 
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  *
21  * Author: Dodji Seketeli
22  * See COPYRIGHTS file for copyright information.
23  */
24 
25 #ifndef __CR_SELECTOR_H__
26 #define __CR_SELECTOR_H__
27 
28 #include <stdio.h>
29 #include "cr-utils.h"
30 #include "cr-simple-sel.h"
31 #include "cr-parsing-location.h"
32 
33 /**
34  *@file
35  *The declaration file of the #CRSelector file.
36  */
37 
38 G_BEGIN_DECLS
39 
40 typedef struct _CRSelector CRSelector ;
41 
42 /**
43  *Abstracts a CSS2 selector as defined in the right part
44  *of the 'ruleset" production in the appendix D.1 of the
45  *css2 spec.
46  *It is actually the abstraction of a comma separated list
47  *of simple selectors list.
48  *In a css2 file, a selector is a list of simple selectors
49  *separated by a comma.
50  *e.g: sel0, sel1, sel2 ...
51  *Each seln is a simple selector
52  */
53 struct _CRSelector
54 {
55 	/**
56 	 *A Selection expression.
57 	 *It is a list of basic selectors.
58 	 *Each basic selector can be either an element
59 	 *selector, an id selector, a class selector, an
60 	 *attribute selector, an universal selector etc ...
61 	 */
62 	CRSimpleSel *simple_sel ;
63 
64 	/**The next selector list element*/
65 	CRSelector *next ;
66 	CRSelector *prev ;
67 	CRParsingLocation location ;
68 	glong ref_count ;
69 };
70 
71 CRSelector* cr_selector_new (CRSimpleSel *a_sel_expr) ;
72 
73 CRSelector * cr_selector_parse_from_buf (const guchar * a_char_buf,
74 					 enum CREncoding a_enc) ;
75 
76 CRSelector* cr_selector_append (CRSelector *a_this, CRSelector *a_new) ;
77 
78 CRSelector* cr_selector_append_simple_sel (CRSelector *a_this,
79 					   CRSimpleSel *a_simple_sel) ;
80 
81 CRSelector* cr_selector_prepend (CRSelector *a_this, CRSelector *a_new) ;
82 
83 guchar * cr_selector_to_string (CRSelector const *a_this) ;
84 
85 void cr_selector_dump (CRSelector const *a_this, FILE *a_fp) ;
86 
87 void cr_selector_ref (CRSelector *a_this) ;
88 
89 gboolean cr_selector_unref (CRSelector *a_this) ;
90 
91 void cr_selector_destroy (CRSelector *a_this) ;
92 
93 G_END_DECLS
94 
95 #endif /*__CR_SELECTOR_H__*/
96