• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/timemachine/gettext-0.17/gnulib-local/lib/libcroco/
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
33G_BEGIN_DECLS
34
35/**
36 *@file
37 *the declaration of the #CRSimpleSel class.
38 *
39 */
40enum Combinator
41{
42        NO_COMBINATOR,
43        COMB_WS,/*whitespace: descendent*/
44        COMB_PLUS,/*'+': preceded by*/
45        COMB_GT/*greater than ('>'): child*/
46} ;
47
48enum SimpleSelectorType
49{
50        NO_SELECTOR_TYPE = 0,
51        UNIVERSAL_SELECTOR = 1,
52        TYPE_SELECTOR = 1 << 1
53} ;
54
55typedef 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 */
74struct _CRSimpleSel
75{
76        enum SimpleSelectorType type_mask ;
77        gboolean is_case_sentive ;
78        CRString * name ;
79        /**
80         *The combinator that separates
81         *this simple selector from the previous
82         *one.
83         */
84        enum Combinator combinator ;
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         */
94        CRAdditionalSel *add_sel ;
95
96        /*
97         *the specificity as specified by
98         *chapter 6.4.3 of the spec.
99         */
100        gulong specificity ;
101
102        CRSimpleSel *next ;
103        CRSimpleSel *prev ;
104        CRParsingLocation location ;
105} ;
106
107CRSimpleSel * cr_simple_sel_new (void) ;
108
109CRSimpleSel * cr_simple_sel_append_simple_sel (CRSimpleSel *a_this,
110                                               CRSimpleSel *a_sel) ;
111
112CRSimpleSel * cr_simple_sel_prepend_simple_sel (CRSimpleSel *a_this,
113                                                CRSimpleSel *a_sel) ;
114
115guchar * cr_simple_sel_to_string (CRSimpleSel *a_this) ;
116
117guchar * cr_simple_sel_one_to_string (CRSimpleSel * a_this) ;
118
119enum CRStatus cr_simple_sel_dump (CRSimpleSel *a_this, FILE *a_fp) ;
120
121enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel *a_this) ;
122
123enum CRStatus cr_simple_sel_compute_specificity (CRSimpleSel *a_this) ;
124
125void cr_simple_sel_destroy (CRSimpleSel *a_this) ;
126
127G_END_DECLS
128
129
130#endif /*__CR_SIMPLE_SEL_H__*/
131