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