]> git.sesse.net Git - vlc/blob - include/vlc_xml.h
add xml_ReaderReset()
[vlc] / include / vlc_xml.h
1 /*****************************************************************************
2 * xml.h: XML abstraction layer
3 *****************************************************************************
4 * Copyright (C) 2004-2010 the VideoLAN team
5 *
6 * Author: Gildas Bazin <gbazin@videolan.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
22
23 #ifndef VLC_XML_H
24 #define VLC_XML_H
25
26 /**
27 * \file
28 * This file defines functions and structures to handle xml tags in vlc
29 *
30 */
31
32 # ifdef __cplusplus
33 extern "C" {
34 # endif
35
36 struct xml_t
37 {
38 VLC_COMMON_MEMBERS
39
40 /* Module properties */
41 module_t  *p_module;
42 xml_sys_t *p_sys;
43
44 void (*pf_catalog_load) ( xml_t *, const char * );
45 void (*pf_catalog_add) ( xml_t *, const char *, const char *,
46                        const char * );
47 };
48
49 VLC_EXPORT( xml_t *, xml_Create, ( vlc_object_t * ) LIBVLC_USED );
50 #define xml_Create( a ) xml_Create( VLC_OBJECT(a) )
51 VLC_EXPORT( void, xml_Delete, ( xml_t * ) );
52
53 #define xml_CatalogLoad( a, b ) a->pf_catalog_load( a, b )
54 #define xml_CatalogAdd( a, b, c, d ) a->pf_catalog_add( a, b, c, d )
55
56 struct xml_reader_t
57 {
58     VLC_COMMON_MEMBERS
59
60     xml_reader_sys_t *p_sys;
61     stream_t *p_stream;
62     module_t *p_module;
63
64     int (*pf_read) ( xml_reader_t * );
65     int (*pf_node_type) ( xml_reader_t * );
66     char * (*pf_name) ( xml_reader_t * );
67     char * (*pf_value) ( xml_reader_t * );
68     int (*pf_next_attr) ( xml_reader_t * );
69
70     int (*pf_use_dtd) ( xml_reader_t *, bool );
71 };
72
73 VLC_EXPORT( xml_reader_t *, xml_ReaderCreate, (vlc_object_t *, stream_t *) LIBVLC_USED );
74 #define xml_ReaderCreate( a, s ) xml_ReaderCreate(VLC_OBJECT(a), s)
75 VLC_EXPORT( void, xml_ReaderDelete, (xml_reader_t *) );
76 VLC_EXPORT( xml_reader_t *, xml_ReaderReset, (xml_reader_t *, stream_t *) LIBVLC_USED );
77
78 #define xml_ReaderRead( a ) a->pf_read( a )
79 #define xml_ReaderNodeType( a ) a->pf_node_type( a )
80 #define xml_ReaderName( a ) a->pf_name( a )
81 #define xml_ReaderValue( a ) a->pf_value( a )
82 #define xml_ReaderNextAttr( a ) a->pf_next_attr( a )
83 #define xml_ReaderUseDTD( a, b ) a->pf_use_dtd( a, b )
84
85 #define XML_READER_NONE 0
86 #define XML_READER_STARTELEM 1
87 #define XML_READER_ENDELEM 2
88 #define XML_READER_TEXT 3
89
90 # ifdef __cplusplus
91 }
92 # endif
93
94 #endif