]> git.sesse.net Git - vlc/blob - include/vlc_xml.h
* ALL: New XML module type.
[vlc] / include / vlc_xml.h
1 /*****************************************************************************
2  * xml.h
3  *****************************************************************************
4  * Copyright (C) 2004 VideoLAN
5  * $Id$
6  *
7  * Author: Gildas Bazin <gbazin@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #ifndef _VLC_XML_H
25 #define _VLC_XML_H
26
27 struct xml_t
28 {
29     VLC_COMMON_MEMBERS
30
31     /* Module properties */
32     module_t  *p_module;
33     xml_sys_t *p_sys;
34
35     xml_reader_t * (*pf_reader_create) ( xml_t *, const char * );
36     void (*pf_reader_delete) ( xml_reader_t * );
37
38     void (*pf_catalog_load) ( xml_t *, const char * );
39     void (*pf_catalog_add) ( xml_t *, const char *, const char *,
40                                const char * );
41 };
42
43 #define xml_Create( a ) __xml_Create( VLC_OBJECT(a) )
44 VLC_EXPORT( xml_t *, __xml_Create, ( vlc_object_t * ) );
45 VLC_EXPORT( void, xml_Delete, ( xml_t * ) );
46
47 #define xml_ReaderCreate( a, b ) a->pf_reader_create( a, b )
48 #define xml_ReaderDelete( a, b ) a->pf_reader_delete( b )
49 #define xml_CatalogLoad( a, b ) a->pf_catalog_load( a, b )
50 #define xml_CatalogAdd( a, b, c, d ) a->pf_catalog_add( a, b, c, d )
51
52 struct xml_reader_t
53 {
54     xml_t *p_xml;
55     xml_reader_sys_t *p_sys;
56
57     int (*pf_read) ( xml_reader_t * );
58     int (*pf_node_type) ( xml_reader_t * );
59     char * (*pf_name) ( xml_reader_t * );
60     char * (*pf_value) ( xml_reader_t * );
61     int (*pf_next_attr) ( xml_reader_t * );
62 };
63
64 #define xml_ReaderRead( a ) a->pf_read( a )
65 #define xml_ReaderNodeType( a ) a->pf_node_type( a )
66 #define xml_ReaderName( a ) a->pf_name( a )
67 #define xml_ReaderValue( a ) a->pf_value( a )
68 #define xml_ReaderNextAttr( a ) a->pf_next_attr( a )
69
70 #define XML_READER_NONE 0
71 #define XML_READER_STARTELEM 1
72 #define XML_READER_ENDELEM 2
73 #define XML_READER_TEXT 3
74
75 #endif