Libcroco
cr-simple-sel.h
Go to the documentation of this file.
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  * Author: Dodji Seketeli
21  * See COPYRIGHTS file for copyright information.
22  */
23 
24 
25 #ifndef __CR_SEL_H__
26 #define __CR_SEL_H__
27 
28 #include <stdio.h>
29 #include <glib.h>
30 #include "cr-additional-sel.h"
31 #include "cr-parsing-location.h"
32 
33 G_BEGIN_DECLS
34 
35 /**
36  *@file
37  *the declaration of the #CRSimpleSel class.
38  *
39  */
41 {
43  COMB_WS,/*whitespace: descendent*/
44  COMB_PLUS,/*'+': preceded by*/
45  COMB_GT/*greater than ('>'): child*/
46 } ;
47 
49 {
52  TYPE_SELECTOR = 1 << 1
53 } ;
54 
55 typedef struct _CRSimpleSel CRSimpleSel ;
56 
57 /**
58  *The abstraction of a css2 simple selection list
59  *as defined by the right part of the "selector" production in the
60  *appendix D.1 of the css2 spec.
61  *It is basically a list of simple selector, each
62  *simple selector being separated by a combinator.
63  *
64  *In the libcroco's implementation, each simple selector
65  *is made of at most two parts:
66  *
67  *1/An element name or 'type selector' (which can hold a '*' and
68  *then been called 'universal selector')
69  *
70  *2/An additional selector that "specializes" the preceding type or
71  *universal selector. The additionnal selector can be either
72  *an id selector, or a class selector, or an attribute selector.
73  */
75 {
77  gboolean is_case_sentive ;
79  /**
80  *The combinator that separates
81  *this simple selector from the previous
82  *one.
83  */
85 
86  /**
87  *The additional selector list of the
88  *current simple selector.
89  *An additional selector may
90  *be a class selector, an id selector,
91  *or an attribute selector.
92  *Note that this field is a linked list.
93  */
95 
96  /*
97  *the specificity as specified by
98  *chapter 6.4.3 of the spec.
99  */
100  gulong specificity ;
101 
105 } ;
106 
108 
110  CRSimpleSel *a_sel) ;
111 
113  CRSimpleSel *a_sel) ;
114 
115 guchar * cr_simple_sel_to_string (CRSimpleSel const *a_this) ;
116 
117 guchar * cr_simple_sel_one_to_string (CRSimpleSel const * a_this) ;
118 
119 enum CRStatus cr_simple_sel_dump (CRSimpleSel const *a_this, FILE *a_fp) ;
120 
122 
124 
125 void cr_simple_sel_destroy (CRSimpleSel *a_this) ;
126 
127 G_END_DECLS
128 
129 
130 #endif /*__CR_SIMPLE_SEL_H__*/
_CRSimpleSel::name
CRString * name
Definition: cr-simple-sel.h:78
TYPE_SELECTOR
@ TYPE_SELECTOR
Definition: cr-simple-sel.h:52
NO_COMBINATOR
@ NO_COMBINATOR
Definition: cr-simple-sel.h:42
_CRAdditionalSel
Definition: cr-additional-sel.h:56
_CRSimpleSel::specificity
gulong specificity
Definition: cr-simple-sel.h:100
_CRSimpleSel::combinator
enum Combinator combinator
The combinator that separates this simple selector from the previous one.
Definition: cr-simple-sel.h:84
Combinator
Combinator
Definition: cr-simple-sel.h:40
cr_simple_sel_prepend_simple_sel
CRSimpleSel * cr_simple_sel_prepend_simple_sel(CRSimpleSel *a_this, CRSimpleSel *a_sel)
cr_simple_sel_prepend_simple_sel:
Definition: cr-simple-sel.c:89
CRString
typedefG_BEGIN_DECLS struct _CRString CRString
Definition: cr-string.h:37
cr_simple_sel_compute_specificity
enum CRStatus cr_simple_sel_compute_specificity(CRSimpleSel *a_this)
cr_simple_sel_compute_specificity:
Definition: cr-simple-sel.c:246
_CRSimpleSel::location
CRParsingLocation location
Definition: cr-simple-sel.h:104
COMB_GT
@ COMB_GT
Definition: cr-simple-sel.h:45
SimpleSelectorType
SimpleSelectorType
Definition: cr-simple-sel.h:48
cr_simple_sel_append_simple_sel
CRSimpleSel * cr_simple_sel_append_simple_sel(CRSimpleSel *a_this, CRSimpleSel *a_sel)
cr_simple_sel_append_simple_sel:
Definition: cr-simple-sel.c:61
_CRSimpleSel::prev
CRSimpleSel * prev
Definition: cr-simple-sel.h:103
UNIVERSAL_SELECTOR
@ UNIVERSAL_SELECTOR
Definition: cr-simple-sel.h:51
cr_simple_sel_to_string
guchar * cr_simple_sel_to_string(CRSimpleSel const *a_this)
Definition: cr-simple-sel.c:103
cr_simple_sel_new
CRSimpleSel * cr_simple_sel_new(void)
cr_simple_sel_new:
Definition: cr-simple-sel.c:36
cr_simple_sel_dump_attr_sel_list
enum CRStatus cr_simple_sel_dump_attr_sel_list(CRSimpleSel const *a_this)
cr-additional-sel.h
_CRParsingLocation
Definition: cr-parsing-location.h:39
_CRSimpleSel::next
CRSimpleSel * next
Definition: cr-simple-sel.h:102
_CRSimpleSel::is_case_sentive
gboolean is_case_sentive
Definition: cr-simple-sel.h:77
NO_SELECTOR_TYPE
@ NO_SELECTOR_TYPE
Definition: cr-simple-sel.h:50
COMB_PLUS
@ COMB_PLUS
Definition: cr-simple-sel.h:44
_CRSimpleSel
The abstraction of a css2 simple selection list as defined by the right part of the "selector" produc...
Definition: cr-simple-sel.h:74
_CRSimpleSel::add_sel
CRAdditionalSel * add_sel
The additional selector list of the current simple selector.
Definition: cr-simple-sel.h:94
cr-parsing-location.h
cr_simple_sel_one_to_string
guchar * cr_simple_sel_one_to_string(CRSimpleSel const *a_this)
Definition: cr-simple-sel.c:165
cr_simple_sel_destroy
void cr_simple_sel_destroy(CRSimpleSel *a_this)
cr_simple_sel_destroy:
Definition: cr-simple-sel.c:304
CRStatus
CRStatus
The status type returned by the methods of the croco library.
Definition: cr-utils.h:43
_CRSimpleSel::type_mask
enum SimpleSelectorType type_mask
Definition: cr-simple-sel.h:76
cr_simple_sel_dump
enum CRStatus cr_simple_sel_dump(CRSimpleSel const *a_this, FILE *a_fp)
cr_simple_sel_dump: @a_this: the current instance of CRSimpleSel.
Definition: cr-simple-sel.c:217
COMB_WS
@ COMB_WS
Definition: cr-simple-sel.h:43