forked from AravisProject/aravis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharvdomnode.h
124 lines (100 loc) · 4.55 KB
/
arvdomnode.h
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
113
114
115
116
117
118
119
120
121
122
123
124
/* Aravis
*
* Copyright © 2007-2008 Emmanuel Pacaud
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Author:
* Emmanuel Pacaud <[email protected]>
*/
#ifndef ARV_DOM_NODE_H
#define ARV_DOM_NODE_H
#if !defined (ARV_H_INSIDE) && !defined (ARAVIS_COMPILATION)
#error "Only <arv.h> can be included directly."
#endif
#include <arvtypes.h>
#include <gio/gio.h>
G_BEGIN_DECLS
typedef enum {
ARV_DOM_NODE_TYPE_ELEMENT_NODE = 1,
ARV_DOM_NODE_TYPE_ATTRIBUTE_NODE,
ARV_DOM_NODE_TYPE_TEXT_NODE,
ARV_DOM_NODE_TYPE_CDATA_SECTION_NODE,
ARV_DOM_NODE_TYPE_ENTITY_REFERENCE_NODE,
ARV_DOM_NODE_TYPE_ENTITY_NODE,
ARV_DOM_NODE_TYPE_PROCESSING_INSTRUCTION_NODE,
ARV_DOM_NODE_TYPE_COMMENT_NODE,
ARV_DOM_NODE_TYPE_DOCUMENT_NODE,
ARV_DOM_NODE_TYPE_DOCUMENT_TYPE_NODE,
ARV_DOM_NODE_TYPE_DOCUMENT_FRAGMENT_NODE,
ARV_DOM_NODE_TYPE_NOTATION_NODE
} ArvDomNodeType;
#define ARV_TYPE_DOM_NODE (arv_dom_node_get_type ())
#define ARV_DOM_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ARV_TYPE_DOM_NODE, ArvDomNode))
#define ARV_DOM_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ARV_TYPE_DOM_NODE, ArvDomNodeClass))
#define ARV_IS_DOM_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ARV_TYPE_DOM_NODE))
#define ARV_IS_DOM_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ARV_TYPE_DOM_NODE))
#define ARV_DOM_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ARV_TYPE_DOM_NODE, ArvDomNodeClass))
typedef struct _ArvDomNodeClass ArvDomNodeClass;
struct _ArvDomNode {
GObject object;
ArvDomNode *next_sibling;
ArvDomNode *previous_sibling;
ArvDomNode *parent_node;
ArvDomNode *first_child;
ArvDomNode *last_child;
};
struct _ArvDomNodeClass {
GObjectClass parent_class;
/* DOM node virtuals */
const char* (*get_node_name) (ArvDomNode* self);
const char* (*get_node_value) (ArvDomNode* self);
void (*set_node_value) (ArvDomNode* self, const char* new_value);
ArvDomNodeType (*get_node_type) (ArvDomNode* self);
/* Validation virtuals */
gboolean (*can_append_child) (ArvDomNode *self, ArvDomNode *new_child);
/* Implementation virtuals */
void (*post_new_child) (ArvDomNode *parent, ArvDomNode *child);
void (*pre_remove_child) (ArvDomNode *parent, ArvDomNode *child);
void (*changed) (ArvDomNode *self);
gboolean (*child_changed) (ArvDomNode *self, ArvDomNode *child);
void (*write_to_stream) (ArvDomNode *self, GOutputStream *stream, GError **error);
};
GType arv_dom_node_get_type (void);
const char * arv_dom_node_get_node_name (ArvDomNode* self);
const char * arv_dom_node_get_node_value (ArvDomNode* self);
void arv_dom_node_set_node_value (ArvDomNode* self, const char* new_value);
ArvDomNodeType arv_dom_node_get_node_type (ArvDomNode* self);
ArvDomNode * arv_dom_node_get_parent_node (ArvDomNode* self);
ArvDomNodeList * arv_dom_node_get_child_nodes (ArvDomNode* self);
ArvDomNode * arv_dom_node_get_first_child (ArvDomNode* self);
ArvDomNode * arv_dom_node_get_last_child (ArvDomNode* self);
ArvDomNode * arv_dom_node_get_previous_sibling (ArvDomNode* self);
ArvDomNode * arv_dom_node_get_next_sibling (ArvDomNode* self);
#if 0
ArvDomNamedNodeMap * arv_dom_node_get_attributes (ArvDomNode* self);
#endif
ArvDomNode * arv_dom_node_insert_before (ArvDomNode* self, ArvDomNode* new_child, ArvDomNode* ref_child);
ArvDomNode * arv_dom_node_replace_child (ArvDomNode* self, ArvDomNode* new_child, ArvDomNode* old_child);
ArvDomNode * arv_dom_node_append_child (ArvDomNode* self, ArvDomNode* new_child);
ArvDomNode * arv_dom_node_remove_child (ArvDomNode* self, ArvDomNode* old_child);
gboolean arv_dom_node_has_child_nodes (ArvDomNode* self);
void arv_dom_node_changed (ArvDomNode *self);
ArvDomDocument * arv_dom_node_get_owner_document (ArvDomNode* self);
void arv_dom_node_write_to_stream (ArvDomNode *self, GOutputStream *stream,
GError **error);
G_END_DECLS
#endif