cr-simple-sel.h

Go to the documentation of this file.
00001 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
00002 
00003 /*
00004  * This file is part of The Croco Library
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of version 2.1 of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00018  * USA
00019  *
00020  * Author: Dodji Seketeli
00021  * See COPYRIGHTS file for copyright information.
00022  */
00023 
00024 
00025 #ifndef __CR_SEL_H__
00026 #define __CR_SEL_H__
00027 
00028 #include <stdio.h>
00029 #include <glib.h>
00030 #include "cr-additional-sel.h"
00031 #include "cr-parsing-location.h"
00032 
00033 G_BEGIN_DECLS
00034 
00035 /**
00036  *@file
00037  *the declaration of the #CRSimpleSel class.
00038  *
00039  */
00040 enum Combinator
00041 {
00042         NO_COMBINATOR,
00043         COMB_WS,/*whitespace: descendent*/
00044         COMB_PLUS,/*'+': preceded by*/
00045         COMB_GT/*greater than ('>'): child*/
00046 } ;
00047 
00048 enum SimpleSelectorType
00049 {
00050         NO_SELECTOR_TYPE = 0,
00051         UNIVERSAL_SELECTOR = 1,
00052         TYPE_SELECTOR = 1 << 1
00053 } ;
00054 
00055 typedef struct _CRSimpleSel CRSimpleSel ;
00056 
00057 /**
00058  *The abstraction of a css2 simple selection list
00059  *as defined by the right part of the "selector" production in the 
00060  *appendix D.1 of the css2 spec.
00061  *It is basically a list of simple selector, each
00062  *simple selector being separated by a combinator.
00063  *
00064  *In the libcroco's implementation, each simple selector 
00065  *is made of at most two parts:
00066  *
00067  *1/An element name or 'type selector' (which can hold a '*' and
00068  *then been called 'universal selector')
00069  *
00070  *2/An additional selector that "specializes" the preceding type or
00071  *universal selector. The additionnal selector can be either
00072  *an id selector, or a class selector, or an attribute selector.
00073  */
00074 struct _CRSimpleSel
00075 {
00076         enum SimpleSelectorType type_mask ;
00077         gboolean is_case_sentive ;
00078         CRString * name ;
00079         /**
00080          *The combinator that separates
00081          *this simple selector from the previous
00082          *one.
00083          */
00084         enum Combinator combinator ;
00085 
00086         /**
00087          *The additional selector list of the
00088          *current simple selector.
00089          *An additional selector may
00090          *be a class selector, an id selector,
00091          *or an attribute selector.
00092          *Note that this field is a linked list.
00093          */
00094         CRAdditionalSel *add_sel ;
00095 
00096         /*
00097          *the specificity as specified by
00098          *chapter 6.4.3 of the spec.
00099          */
00100         gulong specificity ;
00101 
00102         CRSimpleSel *next ;
00103         CRSimpleSel *prev ;
00104         CRParsingLocation location ;
00105 } ;
00106 
00107 CRSimpleSel * cr_simple_sel_new (void) ;
00108 
00109 CRSimpleSel * cr_simple_sel_append_simple_sel (CRSimpleSel *a_this, 
00110                                                CRSimpleSel *a_sel) ;
00111 
00112 CRSimpleSel * cr_simple_sel_prepend_simple_sel (CRSimpleSel *a_this, 
00113                                                 CRSimpleSel *a_sel) ;
00114 
00115 guchar * cr_simple_sel_to_string (CRSimpleSel *a_this) ;
00116 
00117 guchar * cr_simple_sel_one_to_string (CRSimpleSel * a_this) ;
00118 
00119 enum CRStatus cr_simple_sel_dump (CRSimpleSel *a_this, FILE *a_fp) ;
00120 
00121 enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel *a_this) ;
00122 
00123 enum CRStatus cr_simple_sel_compute_specificity (CRSimpleSel *a_this) ;
00124 
00125 void cr_simple_sel_destroy (CRSimpleSel *a_this) ;
00126 
00127 G_END_DECLS
00128 
00129 
00130 #endif /*__CR_SIMPLE_SEL_H__*/

Generated on Thu Mar 9 19:18:50 2006 for Libcroco by  doxygen 1.4.6