actually set the variable here
[swfdec.git] / swfdec / swfdec_xml_node.h
blobad5b35c593e95fc3c8b82234291eb65f6500d397
1 /* Swfdec
2 * Copyright (C) 2007-2008 Benjamin Otte <otte@gnome.org>
3 * 2007 Pekka Lampila <pekka.lampila@iki.fi>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
21 #ifndef _SWFDEC_XML_NODE_H_
22 #define _SWFDEC_XML_NODE_H_
24 #include <swfdec/swfdec_as_object.h>
25 #include <swfdec/swfdec_as_relay.h>
26 #include <swfdec/swfdec_types.h>
27 #include <swfdec/swfdec_script.h>
28 #include <swfdec/swfdec_player.h>
30 G_BEGIN_DECLS
32 typedef enum {
33 SWFDEC_XML_NODE_ELEMENT = 1,
34 SWFDEC_XML_NODE_ATTRIBUTE = 2,
35 SWFDEC_XML_NODE_TEXT = 3,
36 SWFDEC_XML_NODE_CDATA_SECTION = 4,
37 SWFDEC_XML_NODE_ENTITY_REFERENCE = 5,
38 SWFDEC_XML_NODE_ENTITY = 6,
39 SWFDEC_XML_NODE_PROCESSING_INSTRUCTION = 7,
40 SWFDEC_XML_NODE_COMMENT = 8,
41 SWFDEC_XML_NODE_DOCUMENT = 9,
42 SWFDEC_XML_NODE_DOCUMENT_TYPE = 10,
43 SWFDEC_XML_NODE_DOCUMENT_FRAGMENT = 11,
44 SWFDEC_XML_NODE_NOTATION = 12,
45 } SwfdecXmlNodeType;
47 typedef struct _SwfdecXmlNode SwfdecXmlNode;
48 typedef struct _SwfdecXmlNodeClass SwfdecXmlNodeClass;
50 #define SWFDEC_TYPE_XML_NODE (swfdec_xml_node_get_type())
51 #define SWFDEC_IS_XML_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_XML_NODE))
52 #define SWFDEC_IS_XML_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_XML_NODE))
53 #define SWFDEC_XML_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_XML_NODE, SwfdecXmlNode))
54 #define SWFDEC_XML_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_XML_NODE, SwfdecXmlNodeClass))
55 #define SWFDEC_XML_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_XML_NODE, SwfdecXmlNodeClass))
57 #define SWFDEC_IS_VALID_XML_NODE(obj) (SWFDEC_IS_XML_NODE (obj) && SWFDEC_XML_NODE (obj)->valid)
58 #define SWFDEC_VALID_XML_NODE_FROM_AS_OBJECT(obj) (SWFDEC_IS_VALID_XML_NODE (SWFDEC_XML_NODE ((obj)->relay) ? SWFDEC_XML_NODE ((obj)->relay) : NULL)
60 struct _SwfdecXmlNode {
61 SwfdecAsRelay relay;
63 gboolean valid;
65 guint type; // SwfdecXmlNodeType
66 const char *name; // for type == element
67 const char *value; // for type != element
69 SwfdecXmlNode *parent;
70 SwfdecAsObject *children;
71 SwfdecAsObject *attributes;
73 // visible trough childNodes property, if modified by the user directly, the
74 // changes are not visible in children and will get overwritten by next
75 // internal change
76 SwfdecAsObject *child_nodes;
79 struct _SwfdecXmlNodeClass {
80 SwfdecAsObjectClass object_class;
83 GType swfdec_xml_node_get_type (void);
85 SwfdecXmlNode * swfdec_xml_node_new (SwfdecAsContext * context,
86 SwfdecXmlNodeType type,
87 const char * value);
88 SwfdecXmlNode * swfdec_xml_node_new_no_properties (SwfdecAsContext * context,
89 SwfdecXmlNodeType type,
90 const char * value);
91 void swfdec_xml_node_removeNode (SwfdecXmlNode * node);
92 void swfdec_xml_node_appendChild (SwfdecXmlNode * node,
93 SwfdecXmlNode * child);
94 void swfdec_xml_node_removeChildren (SwfdecXmlNode * node);
95 void swfdec_xml_node_init_values (SwfdecXmlNode * node,
96 int type,
97 const char * value);
98 gint32 swfdec_xml_node_num_children (SwfdecXmlNode * node);
99 SwfdecXmlNode * swfdec_xml_node_get_child (SwfdecXmlNode * node,
100 gint32 index_);
101 const char * swfdec_xml_node_get_attribute (SwfdecXmlNode * node,
102 const char * name);
104 G_END_DECLS
105 #endif