Libcroco
|
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 * See the COPYRIGHTS file for copyright information. 00021 */ 00022 00023 #ifndef __CR_DECLARATION_H__ 00024 #define __CR_DECLARATION_H__ 00025 00026 #include <stdio.h> 00027 #include "cr-utils.h" 00028 #include "cr-term.h" 00029 #include "cr-parsing-location.h" 00030 00031 G_BEGIN_DECLS 00032 00033 /** 00034 *@file 00035 *The declaration of the #CRDeclaration class. 00036 */ 00037 00038 /*forward declaration of what is defined in cr-statement.h*/ 00039 typedef struct _CRStatement CRStatement ; 00040 00041 /** 00042 *The abstraction of a css declaration defined by the 00043 *css2 spec in chapter 4. 00044 *It is actually a chained list of property/value pairs. 00045 */ 00046 typedef struct _CRDeclaration CRDeclaration ; 00047 struct _CRDeclaration 00048 { 00049 /**The property.*/ 00050 CRString *property ; 00051 00052 /**The value of the property.*/ 00053 CRTerm *value ; 00054 00055 /*the ruleset that contains this declaration*/ 00056 CRStatement *parent_statement ; 00057 00058 /*the next declaration*/ 00059 CRDeclaration *next ; 00060 00061 /*the previous one declaration*/ 00062 CRDeclaration *prev ; 00063 00064 /*does the declaration have the important keyword ?*/ 00065 gboolean important ; 00066 00067 glong ref_count ; 00068 00069 CRParsingLocation location ; 00070 /*reserved for future usage*/ 00071 gpointer rfu0 ; 00072 gpointer rfu1 ; 00073 gpointer rfu2 ; 00074 gpointer rfu3 ; 00075 } ; 00076 00077 00078 CRDeclaration * cr_declaration_new (CRStatement *a_statement, 00079 CRString *a_property, 00080 CRTerm *a_value) ; 00081 00082 00083 CRDeclaration * cr_declaration_parse_from_buf (CRStatement *a_statement, 00084 const guchar *a_str, 00085 enum CREncoding a_enc) ; 00086 00087 CRDeclaration * cr_declaration_parse_list_from_buf (const guchar *a_str, 00088 enum CREncoding a_enc) ; 00089 00090 CRDeclaration * cr_declaration_append (CRDeclaration *a_this, 00091 CRDeclaration *a_new) ; 00092 00093 CRDeclaration * cr_declaration_append2 (CRDeclaration *a_this, 00094 CRString *a_prop, 00095 CRTerm *a_value) ; 00096 00097 CRDeclaration * cr_declaration_prepend (CRDeclaration *a_this, 00098 CRDeclaration *a_new) ; 00099 00100 CRDeclaration * cr_declaration_unlink (CRDeclaration * a_decl) ; 00101 00102 void 00103 cr_declaration_dump (CRDeclaration const *a_this, 00104 FILE *a_fp, glong a_indent, 00105 gboolean a_one_per_line) ; 00106 00107 void cr_declaration_dump_one (CRDeclaration const *a_this, 00108 FILE *a_fp, glong a_indent) ; 00109 00110 gint cr_declaration_nr_props (CRDeclaration const *a_this) ; 00111 00112 CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this, 00113 int itemnr) ; 00114 00115 CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration *a_this, 00116 const guchar *a_str) ; 00117 00118 gchar * cr_declaration_to_string (CRDeclaration const *a_this, 00119 gulong a_indent) ; 00120 00121 guchar * cr_declaration_list_to_string (CRDeclaration const *a_this, 00122 gulong a_indent) ; 00123 00124 guchar * cr_declaration_list_to_string2 (CRDeclaration const *a_this, 00125 gulong a_indent, 00126 gboolean a_one_decl_per_line) ; 00127 00128 void cr_declaration_ref (CRDeclaration *a_this) ; 00129 00130 gboolean cr_declaration_unref (CRDeclaration *a_this) ; 00131 00132 void cr_declaration_destroy (CRDeclaration *a_this) ; 00133 00134 G_END_DECLS 00135 00136 #endif /*__CR_DECLARATION_H__*/