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 * 00021 * Author: Dodji Seketeli 00022 * See COPYRIGHTS file for copyright information. 00023 */ 00024 00025 #ifndef __CR_SELECTOR_H__ 00026 #define __CR_SELECTOR_H__ 00027 00028 #include <stdio.h> 00029 #include "cr-utils.h" 00030 #include "cr-simple-sel.h" 00031 #include "cr-parsing-location.h" 00032 00033 /** 00034 *@file 00035 *The declaration file of the #CRSelector file. 00036 */ 00037 00038 G_BEGIN_DECLS 00039 00040 typedef struct _CRSelector CRSelector ; 00041 00042 /** 00043 *Abstracts a CSS2 selector as defined in the right part 00044 *of the 'ruleset" production in the appendix D.1 of the 00045 *css2 spec. 00046 *It is actually the abstraction of a comma separated list 00047 *of simple selectors list. 00048 *In a css2 file, a selector is a list of simple selectors 00049 *separated by a comma. 00050 *e.g: sel0, sel1, sel2 ... 00051 *Each seln is a simple selector 00052 */ 00053 struct _CRSelector 00054 { 00055 /** 00056 *A Selection expression. 00057 *It is a list of basic selectors. 00058 *Each basic selector can be either an element 00059 *selector, an id selector, a class selector, an 00060 *attribute selector, an universal selector etc ... 00061 */ 00062 CRSimpleSel *simple_sel ; 00063 00064 /**The next selector list element*/ 00065 CRSelector *next ; 00066 CRSelector *prev ; 00067 CRParsingLocation location ; 00068 glong ref_count ; 00069 }; 00070 00071 CRSelector* cr_selector_new (CRSimpleSel *a_sel_expr) ; 00072 00073 CRSelector * cr_selector_parse_from_buf (const guchar * a_char_buf, 00074 enum CREncoding a_enc) ; 00075 00076 CRSelector* cr_selector_append (CRSelector *a_this, CRSelector *a_new) ; 00077 00078 CRSelector* cr_selector_append_simple_sel (CRSelector *a_this, 00079 CRSimpleSel *a_simple_sel) ; 00080 00081 CRSelector* cr_selector_prepend (CRSelector *a_this, CRSelector *a_new) ; 00082 00083 guchar * cr_selector_to_string (CRSelector const *a_this) ; 00084 00085 void cr_selector_dump (CRSelector const *a_this, FILE *a_fp) ; 00086 00087 void cr_selector_ref (CRSelector *a_this) ; 00088 00089 gboolean cr_selector_unref (CRSelector *a_this) ; 00090 00091 void cr_selector_destroy (CRSelector *a_this) ; 00092 00093 G_END_DECLS 00094 00095 #endif /*__CR_SELECTOR_H__*/