1 | /** |
---|
2 | * |
---|
3 | * @file xattribute.h |
---|
4 | * @author Aleix Conchillo Flaque <aleix@member.fsf.org> |
---|
5 | * @date Mon Nov 25, 2002 00:54 |
---|
6 | * @brief SCEW private attribute type declaration |
---|
7 | * |
---|
8 | * $Id: xattribute.h,v 1.1 2004/01/28 00:43:21 aleix Exp $ |
---|
9 | * |
---|
10 | * @if copyright |
---|
11 | * |
---|
12 | * Copyright (C) 2002, 2003 Aleix Conchillo Flaque |
---|
13 | * |
---|
14 | * SCEW is free software; you can redistribute it and/or |
---|
15 | * modify it under the terms of the GNU Lesser General Public |
---|
16 | * License as published by the Free Software Foundation; either |
---|
17 | * version 2.1 of the License, or (at your option) any later version. |
---|
18 | * |
---|
19 | * SCEW is distributed in the hope that it will be useful, |
---|
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
22 | * Lesser General Public License for more details. |
---|
23 | * |
---|
24 | * You should have received a copy of the GNU Lesser General Public |
---|
25 | * License along with this library; if not, write to the Free Software |
---|
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
---|
27 | * |
---|
28 | * @endif |
---|
29 | */ |
---|
30 | |
---|
31 | |
---|
32 | #ifndef XATTRIBUTE_H_ALEIX0211250054 |
---|
33 | #define XATTRIBUTE_H_ALEIX0211250054 |
---|
34 | |
---|
35 | #include "attribute.h" |
---|
36 | |
---|
37 | #include <expat.h> |
---|
38 | |
---|
39 | |
---|
40 | struct _scew_attribute |
---|
41 | { |
---|
42 | XML_Char* name; |
---|
43 | XML_Char* value; |
---|
44 | scew_element const* element; |
---|
45 | |
---|
46 | scew_attribute* prev; |
---|
47 | scew_attribute* next; |
---|
48 | }; |
---|
49 | |
---|
50 | /* Doubly linked list */ |
---|
51 | typedef struct |
---|
52 | { |
---|
53 | unsigned int size; |
---|
54 | scew_attribute* first; |
---|
55 | scew_attribute* last; |
---|
56 | } attribute_list; |
---|
57 | |
---|
58 | |
---|
59 | /* Creates a new attribute from the given pair (name, value). */ |
---|
60 | scew_attribute* |
---|
61 | attribute_create(XML_Char const* name, XML_Char const* value); |
---|
62 | |
---|
63 | /* Frees an attribute structure. */ |
---|
64 | void |
---|
65 | attribute_free(scew_attribute* attribute); |
---|
66 | |
---|
67 | /* Creates a new attribute list. */ |
---|
68 | attribute_list* |
---|
69 | attribute_list_create(); |
---|
70 | |
---|
71 | /* Frees an attribute list. */ |
---|
72 | void |
---|
73 | attribute_list_free(attribute_list* list); |
---|
74 | |
---|
75 | /* Adds a new element to the attribute list. */ |
---|
76 | scew_attribute* |
---|
77 | attribute_list_add(attribute_list* list, scew_attribute* attribute); |
---|
78 | |
---|
79 | /* Deletes an attribute from an attribute list. */ |
---|
80 | void |
---|
81 | attribute_list_del(attribute_list* list, XML_Char const* name); |
---|
82 | |
---|
83 | /* Return the attribute in position idx. */ |
---|
84 | scew_attribute* |
---|
85 | attribute_by_index(attribute_list* list, unsigned int idx); |
---|
86 | |
---|
87 | /* Return the attribute that matches name. */ |
---|
88 | scew_attribute* |
---|
89 | attribute_by_name(attribute_list* list, XML_Char const* name); |
---|
90 | |
---|
91 | #endif /* XATTRIBUTE_H_ALEIX0211250054 */ |
---|