copy/paste caused some issues here
[swfdec.git] / libswfdec / swfdec_xml_node.h
blob60094571e4c5fd408e11a1c6e7f03492bd3845c2
1 /* Swfdec
2 * Copyright (C) 2007 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 <libswfdec/swfdec_as_object.h>
25 #include <libswfdec/swfdec_types.h>
26 #include <libswfdec/swfdec_script.h>
27 #include <libswfdec/swfdec_player.h>
29 G_BEGIN_DECLS
31 typedef enum {
32 SWFDEC_XML_NODE_ELEMENT = 1,
33 SWFDEC_XML_NODE_ATTRIBUTE = 2,
34 SWFDEC_XML_NODE_TEXT = 3,
35 SWFDEC_XML_NODE_CDATA_SECTION = 4,
36 SWFDEC_XML_NODE_ENTITY_REFERENCE = 5,
37 SWFDEC_XML_NODE_ENTITY = 6,
38 SWFDEC_XML_NODE_PROCESSING_INSTRUCTION = 7,
39 SWFDEC_XML_NODE_COMMENT = 8,
40 SWFDEC_XML_NODE_DOCUMENT = 9,
41 SWFDEC_XML_NODE_DOCUMENT_TYPE = 10,
42 SWFDEC_XML_NODE_DOCUMENT_FRAGMENT = 11,
43 SWFDEC_XML_NODE_NOTATION = 12,
44 } SwfdecXmlNodeType;
46 typedef struct _SwfdecXmlNode SwfdecXmlNode;
47 typedef struct _SwfdecXmlNodeClass SwfdecXmlNodeClass;
49 #define SWFDEC_TYPE_XML_NODE (swfdec_xml_node_get_type())
50 #define SWFDEC_IS_XML_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_XML_NODE))
51 #define SWFDEC_IS_XML_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_XML_NODE))
52 #define SWFDEC_XML_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_XML_NODE, SwfdecXmlNode))
53 #define SWFDEC_XML_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_XML_NODE, SwfdecXmlNodeClass))
54 #define SWFDEC_XML_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_XML_NODE, SwfdecXmlNodeClass))
56 #define SWFDEC_IS_VALID_XML_NODE(obj) (SWFDEC_IS_XML_NODE (obj) && SWFDEC_XML_NODE (obj)->valid)
58 struct _SwfdecXmlNode {
59 SwfdecAsObject object;
61 gboolean valid;
63 guint type; // SwfdecXmlNodeType
64 const char *name; // for type == element
65 const char *value; // for type != element
67 SwfdecXmlNode *parent;
68 SwfdecAsArray *children;
69 SwfdecAsObject *attributes;
71 // visible trough childNodes property, if modified by the user directly, the
72 // changes are not visible in children and will get overwritten by next
73 // internal change
74 SwfdecAsArray *childNodes;
77 struct _SwfdecXmlNodeClass {
78 SwfdecAsObjectClass object_class;
81 GType swfdec_xml_node_get_type (void);
83 SwfdecXmlNode * swfdec_xml_node_new (SwfdecAsContext * context,
84 SwfdecXmlNodeType type,
85 const char * value);
86 void swfdec_xml_node_removeNode (SwfdecXmlNode * node);
87 void swfdec_xml_node_appendChild (SwfdecXmlNode * node,
88 SwfdecXmlNode * child);
89 void swfdec_xml_node_removeChildren (SwfdecXmlNode * node);
90 void swfdec_xml_node_init_properties (SwfdecXmlNode * node,
91 int type,
92 const char * value);
93 gint32 swfdec_xml_node_num_children (SwfdecXmlNode * node);
95 G_END_DECLS
96 #endif