1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
2 
3 /* libcroco - Library for parsing and applying CSS
4  * Copyright (C) 2006-2019 Free Software Foundation, Inc.
5  *
6  * This file is not part of the GNU gettext program, but is used with
7  * GNU gettext.
8  *
9  * The original copyright notice is as follows:
10  */
11 
12 /*
13  * This file is part of The Croco Library
14  *
15  * Copyright (C) 2003-2004 Dodji Seketeli.  All Rights Reserved.
16  *
17  * This program is free software; you can redistribute it and/or
18  * modify it under the terms of version 2.1 of the GNU Lesser General Public
19  * License as published by the Free Software Foundation.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
29  * USA
30  *
31  * Author: Dodji Seketeli
32  */
33 
34 
35 #ifndef __CR_ADD_SEL_H__
36 #define __CR_ADD_SEL_H__
37 
38 #include <stdio.h>
39 #include <glib.h>
40 #include "cr-utils.h"
41 #include "cr-attr-sel.h"
42 #include "cr-pseudo.h"
43 #include "cr-additional-sel.h"
44 
45 G_BEGIN_DECLS
46 
47 enum AddSelectorType
48 {
49         NO_ADD_SELECTOR = 0 ,
50         CLASS_ADD_SELECTOR = 1 ,
51         PSEUDO_CLASS_ADD_SELECTOR = 1 << 1,
52         ID_ADD_SELECTOR = 1 << 3,
53         ATTRIBUTE_ADD_SELECTOR = 1 << 4
54 } ;
55 
56 union CRAdditionalSelectorContent
57 {
58         CRString *class_name ;
59         CRString *id_name ;
60         CRPseudo *pseudo ;
61         CRAttrSel *attr_sel ;
62 } ;
63 
64 typedef struct _CRAdditionalSel CRAdditionalSel ;
65 
66 struct _CRAdditionalSel
67 {
68         enum AddSelectorType type ;
69         union CRAdditionalSelectorContent content ;
70 
71         CRAdditionalSel * next ;
72         CRAdditionalSel * prev ;
73         CRParsingLocation location ;
74 } ;
75 
76 CRAdditionalSel * cr_additional_sel_new (void) ;
77 
78 CRAdditionalSel * cr_additional_sel_new_with_type  (enum AddSelectorType a_sel_type) ;
79 
80 CRAdditionalSel * cr_additional_sel_append (CRAdditionalSel *a_this,
81                                             CRAdditionalSel *a_sel) ;
82 
83 void cr_additional_sel_set_class_name (CRAdditionalSel *a_this,
84                                        CRString *a_class_name) ;
85 
86 void cr_additional_sel_set_id_name (CRAdditionalSel *a_this,
87                                     CRString *a_id) ;
88 
89 void cr_additional_sel_set_pseudo (CRAdditionalSel *a_this,
90                                    CRPseudo *a_pseudo) ;
91 
92 void cr_additional_sel_set_attr_sel (CRAdditionalSel *a_this,
93                                      CRAttrSel *a_sel) ;
94 
95 CRAdditionalSel * cr_additional_sel_prepend (CRAdditionalSel *a_this,
96                                              CRAdditionalSel *a_sel) ;
97 
98 guchar * cr_additional_sel_to_string (CRAdditionalSel const *a_this) ;
99 
100 guchar * cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) ;
101 
102 void cr_additional_sel_dump (CRAdditionalSel const *a_this, FILE *a_fp) ;
103 
104 void cr_additional_sel_destroy (CRAdditionalSel *a_this) ;
105 
106 G_END_DECLS
107 
108 #endif /*__CR_ADD_SEL_H*/
109