summaryrefslogtreecommitdiff
path: root/src/parser/cr-declaration.h
blob: acc7c8a1ca60c3c4701432c9b5c3c1e861481e7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */

/*
 * This file is part of The Croco Library
 *
 * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */

/*
 *$Id$
 */

#ifndef __CR_DECLARATION_H__
#define __CR_DECLARATION_H__

#include <stdio.h>
#include "cr-utils.h"
#include "cr-term.h"

G_BEGIN_DECLS

/**
 *@file
 *The declaration of the #CRDeclaration class.
 */

/*forward declaration of what is defined in cr-statement.h*/
typedef struct _CRStatement CRStatement ;

/**
 *The abstraction of a css declaration defined by the
 *css2 spec in chapter 4.
 *It is actually a chained list of property/value pairs.
 */
typedef struct _CRDeclaration CRDeclaration ;
struct _CRDeclaration
{
	/**The property.*/
	GString *property ;

	/**The value of the property.*/
	CRTerm *value ;
	
	/*the ruleset that contains this declaration*/
	CRStatement *parent_statement ;

	/*the next declaration*/
	CRDeclaration *next ;

	/*the previous one declaration*/
	CRDeclaration *prev ;

	glong ref_count ;
} ;


CRDeclaration *
cr_declaration_new (CRStatement *a_statement,
		    GString *a_property, 
		    CRTerm *a_value) ;


CRDeclaration *
cr_declaration_parse_from_buf (CRStatement *a_statement,
			       const guchar *a_str,
			       enum CREncoding a_enc) ;
CRDeclaration *
cr_declaration_append (CRDeclaration *a_this, CRDeclaration *a_new) ;

CRDeclaration *
cr_declaration_append2 (CRDeclaration *a_this, GString *a_prop,
			CRTerm *a_value) ;

CRDeclaration *
cr_declaration_prepend (CRDeclaration *a_this, CRDeclaration *a_new) ;

CRDeclaration *
cr_declaration_unlink (CRDeclaration * a_decl) ;

void
cr_declaration_dump (CRDeclaration *a_this, FILE *a_fp, glong a_indent,
		     gboolean a_one_per_line) ;

guchar *
cr_declaration_to_string (CRDeclaration *a_this,
			  gulong a_indent) ;
void 
cr_declaration_ref (CRDeclaration *a_this) ;

gboolean
cr_declaration_unref (CRDeclaration *a_this) ;

void
cr_declaration_destroy (CRDeclaration *a_this) ;

G_END_DECLS

#endif /*__CR_DECLARATION_H__*/