access: bluray: unify behaviour of all random access
[vlc.git] / include / vlc_xml.h
blob61abc74cf8e1967966b802e9e075901cd271497c
1 /*****************************************************************************
2 * vlc_xml.h: XML abstraction layer
3 *****************************************************************************
4 * Copyright (C) 2004-2010 VLC authors and VideoLAN
6 * Author: Gildas Bazin <gbazin@videolan.org>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
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 Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #ifndef VLC_XML_H
24 #define VLC_XML_H
26 /**
27 * \file
28 * This file defines functions and structures to handle xml tags in vlc
32 # ifdef __cplusplus
33 extern "C" {
34 # endif
36 struct xml_t
38 struct vlc_common_members obj;
40 /* Module properties */
41 module_t *p_module;
42 void *p_sys;
44 void (*pf_catalog_load) ( xml_t *, const char * );
45 void (*pf_catalog_add) ( xml_t *, const char *, const char *,
46 const char * );
49 VLC_API xml_t * xml_Create( vlc_object_t * ) VLC_USED;
50 #define xml_Create( a ) xml_Create( VLC_OBJECT(a) )
51 VLC_API void xml_Delete( xml_t * );
53 static inline void xml_CatalogLoad( xml_t *xml, const char *catalog )
55 xml->pf_catalog_load( xml, catalog );
58 static inline void xml_CatalogAdd( xml_t *xml, const char *type,
59 const char *orig, const char *value )
61 xml->pf_catalog_add( xml, type, orig, value );
65 struct xml_reader_t
67 struct vlc_common_members obj;
69 void *p_sys;
70 stream_t *p_stream;
71 module_t *p_module;
73 int (*pf_next_node) ( xml_reader_t *, const char ** );
74 const char *(*pf_next_attr) ( xml_reader_t *, const char ** );
76 int (*pf_use_dtd) ( xml_reader_t * );
77 int (*pf_is_empty) ( xml_reader_t * );
80 VLC_API xml_reader_t * xml_ReaderCreate(vlc_object_t *, stream_t *) VLC_USED;
81 #define xml_ReaderCreate( a, s ) xml_ReaderCreate(VLC_OBJECT(a), s)
82 VLC_API void xml_ReaderDelete(xml_reader_t *);
84 static inline int xml_ReaderNextNode( xml_reader_t *reader, const char **pval )
86 return reader->pf_next_node( reader, pval );
89 static inline const char *xml_ReaderNextAttr( xml_reader_t *reader,
90 const char **pval )
92 return reader->pf_next_attr( reader, pval );
95 static inline int xml_ReaderUseDTD( xml_reader_t *reader )
97 return reader->pf_use_dtd( reader );
100 static inline int xml_ReaderIsEmptyElement( xml_reader_t *reader )
102 if(reader->pf_is_empty == NULL)
103 return -2;
105 return reader->pf_is_empty( reader );
108 enum {
109 XML_READER_ERROR=-1,
110 XML_READER_NONE=0,
111 XML_READER_STARTELEM,
112 XML_READER_ENDELEM,
113 XML_READER_TEXT,
116 # ifdef __cplusplus
118 # endif
120 #endif