Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

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

Generated on Wed Oct 1 01:36:47 2003 for Libcroco by doxygen 1.3.3