1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
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 the COPYRIGHTS file for copyright information.
22 */
25 /**
26 *@file
27 *This file holds the declaration of the
28 *#CRAddSel class.
29 */
30 #ifndef __CR_ADD_SEL_H__
31 #define __CR_ADD_SEL_H__
33 #include <stdio.h>
34 #include <glib.h>
35 #include "cr-utils.h"
36 #include "cr-attr-sel.h"
37 #include "cr-pseudo.h"
38 #include "cr-additional-sel.h"
40 G_BEGIN_DECLS
42 enum AddSelectorType
43 {
44 NO_ADD_SELECTOR = 0 ,
45 CLASS_ADD_SELECTOR = 1 ,
46 PSEUDO_CLASS_ADD_SELECTOR = 1 << 1,
47 ID_ADD_SELECTOR = 1 << 3,
48 ATTRIBUTE_ADD_SELECTOR = 1 << 4
49 } ;
51 union CRAdditionalSelectorContent
52 {
53 CRString *class_name ;
54 CRString *id_name ;
55 CRPseudo *pseudo ;
56 CRAttrSel *attr_sel ;
57 } ;
59 typedef struct _CRAdditionalSel CRAdditionalSel ;
61 /**
62 *#CRAdditionalSel abstracts
63 *an additionnal selector.
64 *An additional selector is the selector part
65 *that comes after the combination of type selectors.
66 *It can be either "a class selector (the .class part),
67 *a pseudo class selector, an attribute selector
68 *or an id selector.
69 */
70 struct _CRAdditionalSel
71 {
72 enum AddSelectorType type ;
73 union CRAdditionalSelectorContent content ;
75 CRAdditionalSel * next ;
76 CRAdditionalSel * prev ;
77 CRParsingLocation location ;
78 } ;
80 CRAdditionalSel * cr_additional_sel_new (void) ;
82 CRAdditionalSel * cr_additional_sel_new_with_type (enum AddSelectorType a_sel_type) ;
84 CRAdditionalSel * cr_additional_sel_append (CRAdditionalSel *a_this,
85 CRAdditionalSel *a_sel) ;
87 void cr_additional_sel_set_class_name (CRAdditionalSel *a_this,
88 CRString *a_class_name) ;
90 void cr_additional_sel_set_id_name (CRAdditionalSel *a_this,
91 CRString *a_id) ;
93 void cr_additional_sel_set_pseudo (CRAdditionalSel *a_this,
94 CRPseudo *a_pseudo) ;
96 void cr_additional_sel_set_attr_sel (CRAdditionalSel *a_this,
97 CRAttrSel *a_sel) ;
99 CRAdditionalSel * cr_additional_sel_prepend (CRAdditionalSel *a_this,
100 CRAdditionalSel *a_sel) ;
102 guchar * cr_additional_sel_to_string (CRAdditionalSel *a_this) ;
104 guchar * cr_additional_sel_one_to_string (CRAdditionalSel *a_this) ;
106 void cr_additional_sel_dump (CRAdditionalSel *a_this, FILE *a_fp) ;
108 void cr_additional_sel_destroy (CRAdditionalSel *a_this) ;
110 G_END_DECLS
112 #endif /*__CR_ADD_SEL_H*/