1/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */ 2 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 * See the COPYRIGHTS file for copyright information. 21 */ 22 23#ifndef __CR_DECLARATION_H__ 24#define __CR_DECLARATION_H__ 25 26#include <stdio.h> 27#include "cr-utils.h" 28#include "cr-term.h" 29#include "cr-parsing-location.h" 30 31G_BEGIN_DECLS 32 33/** 34 *@file 35 *The declaration of the #CRDeclaration class. 36 */ 37 38/*forward declaration of what is defined in cr-statement.h*/ 39typedef struct _CRStatement CRStatement ; 40 41/** 42 *The abstraction of a css declaration defined by the 43 *css2 spec in chapter 4. 44 *It is actually a chained list of property/value pairs. 45 */ 46typedef struct _CRDeclaration CRDeclaration ; 47struct _CRDeclaration 48{ 49 /**The property.*/ 50 CRString *property ; 51 52 /**The value of the property.*/ 53 CRTerm *value ; 54 55 /*the ruleset that contains this declaration*/ 56 CRStatement *parent_statement ; 57 58 /*the next declaration*/ 59 CRDeclaration *next ; 60 61 /*the previous one declaration*/ 62 CRDeclaration *prev ; 63 64 /*does the declaration have the important keyword ?*/ 65 gboolean important ; 66 67 glong ref_count ; 68 69 CRParsingLocation location ; 70 /*reserved for future usage*/ 71 gpointer rfu0 ; 72 gpointer rfu1 ; 73 gpointer rfu2 ; 74 gpointer rfu3 ; 75} ; 76 77 78CRDeclaration * cr_declaration_new (CRStatement *a_statement, 79 CRString *a_property, 80 CRTerm *a_value) ; 81 82 83CRDeclaration * cr_declaration_parse_from_buf (CRStatement *a_statement, 84 const guchar *a_str, 85 enum CREncoding a_enc) ; 86 87CRDeclaration * cr_declaration_parse_list_from_buf (const guchar *a_str, 88 enum CREncoding a_enc) ; 89 90CRDeclaration * cr_declaration_append (CRDeclaration *a_this, 91 CRDeclaration *a_new) ; 92 93CRDeclaration * cr_declaration_append2 (CRDeclaration *a_this, 94 CRString *a_prop, 95 CRTerm *a_value) ; 96 97CRDeclaration * cr_declaration_prepend (CRDeclaration *a_this, 98 CRDeclaration *a_new) ; 99 100CRDeclaration * cr_declaration_unlink (CRDeclaration * a_decl) ; 101 102void 103cr_declaration_dump (CRDeclaration *a_this, 104 FILE *a_fp, glong a_indent, 105 gboolean a_one_per_line) ; 106 107void cr_declaration_dump_one (CRDeclaration *a_this, 108 FILE *a_fp, glong a_indent) ; 109 110gint cr_declaration_nr_props (CRDeclaration *a_this) ; 111 112CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this, 113 int itemnr) ; 114 115CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration *a_this, 116 const guchar *a_str) ; 117 118gchar * cr_declaration_to_string (CRDeclaration *a_this, 119 gulong a_indent) ; 120 121guchar * cr_declaration_list_to_string (CRDeclaration *a_this, 122 gulong a_indent) ; 123 124guchar * cr_declaration_list_to_string2 (CRDeclaration *a_this, 125 gulong a_indent, 126 gboolean a_one_decl_per_line) ; 127 128void cr_declaration_ref (CRDeclaration *a_this) ; 129 130gboolean cr_declaration_unref (CRDeclaration *a_this) ; 131 132void cr_declaration_destroy (CRDeclaration *a_this) ; 133 134G_END_DECLS 135 136#endif /*__CR_DECLARATION_H__*/ 137