comparison audacious/xml_document.h @ 0:cb178e5ad177 trunk

[svn] Import audacious source.
author nenolod
date Mon, 24 Oct 2005 03:06:47 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cb178e5ad177
1 /* BMP - Cross-platform multimedia player
2 * Copyright (C) 2003-2004 BMP development team.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 #ifndef XML_DOCUMENT_H
20 #define XML_DOCUMENT_H
21
22 #include <glib.h>
23
24 typedef enum {
25 BMP_XML_NODE_DOC = 0,
26 BMP_XML_NODE_ELEMENT,
27 BMP_XML_NODE_ATTRIB,
28 BMP_XML_NODE_TEXT
29 } BmpXmlNodeType;
30
31 #define BMP_XML_DOCUMENT(x) ((BmpXmlDocument *)(x))
32 typedef struct {
33 GNode *tree;
34 GNode *current_node;
35 guint current_depth;
36 GMarkupParseContext *parse_context;
37 } BmpXmlDocument;
38
39 #define BMP_XML_NODE_DATA(x) ((BmpXmlNodeData *)(x))
40 typedef struct {
41 BmpXmlNodeType type;
42 } BmpXmlNodeData;
43
44 #define BMP_XML_DOC_NODE_DATA(x) ((BmpXmlDocNodeData *)(x))
45 typedef struct {
46 BmpXmlNodeType type;
47 } BmpXmlDocNodeData;
48
49 #define BMP_XML_ELEMENT_NODE_DATA(x) ((BmpXmlElementNodeData *)(x))
50 typedef struct {
51 BmpXmlNodeType type;
52 gchar *name;
53 } BmpXmlElementNodeData;
54
55 #define BMP_XML_ATTRIB_NODE_DATA(x) ((BmpXmlAttribNodeData *)(x))
56 typedef struct {
57 BmpXmlNodeType type;
58 gchar *name;
59 gchar *value;
60 } BmpXmlAttribNodeData;
61
62 #define BMP_XML_TEXT_NODE_DATA(x) ((BmpXmlTextNodeData *)(x))
63 typedef struct {
64 BmpXmlNodeType type;
65 gchar *text;
66 gsize length;
67 } BmpXmlTextNodeData;
68
69
70 GNode *bmp_xml_doc_node_new(void);
71 void bmp_xml_doc_node_data_free(BmpXmlDocNodeData * data);
72
73 GNode *bmp_xml_element_node_new(const gchar * name);
74 void bmp_xml_element_node_data_free(BmpXmlElementNodeData * data);
75
76 GNode *bmp_xml_attrib_node_new(const gchar * name, const gchar * value);
77 void bmp_xml_attrib_node_data_free(BmpXmlAttribNodeData * data);
78
79 void bmp_xml_text_node_data_free(BmpXmlTextNodeData * data);
80 GNode *bmp_xml_text_node_new(const gchar * text, gsize length);
81
82
83 gboolean bmp_xml_document_load(BmpXmlDocument ** document,
84 const gchar * filename, GError ** error);
85
86 void bmp_xml_document_free(BmpXmlDocument * document);
87
88 GNode *bmp_xml_document_get_tree(BmpXmlDocument * document);
89
90 #endif