1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
4 * This file is part of The Croco Library
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 3 of the GNU General Public
8 * License as published by the Free Software Foundation.
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.
15 * You should have received a copy of the GNU 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
20 * Author: Dodji Seketeli
21 * See COPYRIGHTS file for copyright information.
29 #include "cr-string.h"
38 *Declaration of the #CRTem class.
71 typedef struct _CRTerm CRTerm ;
74 *An abstraction of a css2 term as
75 *defined in the CSS2 spec in appendix D.1:
77 *[ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S*
78 *| ANGLE S* | TIME S* | FREQ S* | function ]
79 * | STRING S* | IDENT S* | URI S* | RGB S*
80 *| UNICODERANGE S* | hexcolor
85 *The type of the term.
87 enum CRTermType type ;
90 *The unary operator associated to
93 enum UnaryOperator unary_op ;
96 *The operator associated to the current term.
98 enum Operator the_operator ;
102 *The content of the term.
103 *Depending of the type of the term,
104 *this holds either a number, a percentage ...
114 *If the term is of type UNICODERANGE,
115 *this field holds the upper bound of the range.
116 *if the term is of type FUNCTION, this holds
117 *an instance of CRTerm that represents
118 * the expression which is the argument of the function.
126 *A spare pointer, just in case.
127 *Can be used by the application.
134 *A pointer to the next term,
135 *just in case this term is part of
141 *A pointer to the previous
145 CRParsingLocation location ;
148 CRTerm * cr_term_parse_expression_from_buf (const guchar *a_buf,
149 enum CREncoding a_encoding) ;
150 CRTerm * cr_term_new (void) ;
152 enum CRStatus cr_term_set_number (CRTerm *a_this, CRNum *a_num) ;
154 enum CRStatus cr_term_set_function (CRTerm *a_this,
155 CRString *a_func_name,
156 CRTerm *a_func_param) ;
158 enum CRStatus cr_term_set_string (CRTerm *a_this, CRString *a_str) ;
160 enum CRStatus cr_term_set_ident (CRTerm *a_this, CRString *a_str) ;
162 enum CRStatus cr_term_set_uri (CRTerm *a_this, CRString *a_str) ;
164 enum CRStatus cr_term_set_rgb (CRTerm *a_this, CRRgb *a_rgb) ;
166 enum CRStatus cr_term_set_hash (CRTerm *a_this, CRString *a_str) ;
168 CRTerm * cr_term_append_term (CRTerm *a_this, CRTerm *a_new_term) ;
170 CRTerm * cr_term_prepend_term (CRTerm *a_this, CRTerm *a_new_term) ;
172 guchar * cr_term_to_string (CRTerm *a_this) ;
174 guchar * cr_term_one_to_string (CRTerm * a_this) ;
176 void cr_term_dump (CRTerm *a_this, FILE *a_fp) ;
178 int cr_term_nr_values (CRTerm *a_this) ;
180 CRTerm * cr_term_get_from_list (CRTerm *a_this, int itemnr) ;
182 void cr_term_ref (CRTerm *a_this) ;
184 gboolean cr_term_unref (CRTerm *a_this) ;
186 void cr_term_destroy (CRTerm * a_term) ;
190 #endif /*__CR_TERM_H__*/