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