VLC 4.0.0-dev
Loading...
Searching...
No Matches
vlc_xml.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vlc_xml.h: XML abstraction layer
3 *****************************************************************************
4 * Copyright (C) 2004-2010 VLC authors and VideoLAN
5 *
6 * Author: Gildas Bazin <gbazin@videolan.org>
7 *
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.
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 Lesser General Public License for more details.
17 *
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 *****************************************************************************/
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
33extern "C" {
34# endif
35
36struct xml_t
38 struct vlc_object_t obj;
40 /* Module properties */
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 * );
47};
48
50#define xml_Create( a ) xml_Create( VLC_OBJECT(a) )
52
53static inline void xml_CatalogLoad( xml_t *xml, const char *catalog )
55 xml->pf_catalog_load( xml, catalog );
56}
57
58static inline void xml_CatalogAdd( xml_t *xml, const char *type,
59 const char *orig, const char *value )
60{
61 xml->pf_catalog_add( xml, type, orig, value );
62}
63
64
65struct xml_reader_t
67 struct vlc_object_t obj;
69 void *p_sys;
73 int (*pf_next_node) ( xml_reader_t *, const char **, const char ** );
74 const char *(*pf_next_attr) ( xml_reader_t *, const char **, const char ** );
76 int (*pf_use_dtd) ( xml_reader_t * );
78};
79
81#define xml_ReaderCreate( a, s ) xml_ReaderCreate(VLC_OBJECT(a), s)
83
84static inline int xml_ReaderNextNode( xml_reader_t *reader, const char **pval )
86 return reader->pf_next_node( reader, pval, NULL );
87}
88
89static inline int xml_ReaderNextNodeNS( xml_reader_t *reader,
90 const char **pval,
91 const char **pnamespace )
92{
93 return reader->pf_next_node( reader, pval, pnamespace );
94}
95
96static inline const char *xml_ReaderNextAttr( xml_reader_t *reader,
97 const char **pval )
98{
99 return reader->pf_next_attr( reader, pval, NULL );
100}
101
102static inline const char *xml_ReaderNextAttrNS( xml_reader_t *reader,
103 const char **pval,
104 const char **pnamespace )
105{
106 return reader->pf_next_attr( reader, pval, pnamespace );
107}
108
109static inline int xml_ReaderUseDTD( xml_reader_t *reader )
111 return reader->pf_use_dtd( reader );
112}
113
114static inline int xml_ReaderIsEmptyElement( xml_reader_t *reader )
116 if(reader->pf_is_empty == NULL)
117 return -2;
118
119 return reader->pf_is_empty( reader );
120}
121
122enum {
129
130# ifdef __cplusplus
131}
132# endif
133
134#endif
#define VLC_USED
Definition fourcc_gen.c:32
#define VLC_API
Definition fourcc_gen.c:31
Internal module descriptor.
Definition modules.h:76
stream_t definition
Definition vlc_stream.h:135
VLC object common members.
Definition vlc_objects.h:53
Definition vlc_xml.h:67
int(* pf_next_node)(xml_reader_t *, const char **, const char **)
Definition vlc_xml.h:74
int(* pf_use_dtd)(xml_reader_t *)
Definition vlc_xml.h:77
struct vlc_object_t obj
Definition vlc_xml.h:68
void * p_sys
Definition vlc_xml.h:70
stream_t * p_stream
Definition vlc_xml.h:71
const char *(* pf_next_attr)(xml_reader_t *, const char **, const char **)
Definition vlc_xml.h:75
int(* pf_is_empty)(xml_reader_t *)
Definition vlc_xml.h:78
module_t * p_module
Definition vlc_xml.h:72
Definition vlc_xml.h:38
module_t * p_module
Definition vlc_xml.h:42
void * p_sys
Definition vlc_xml.h:43
void(* pf_catalog_load)(xml_t *, const char *)
Definition vlc_xml.h:45
struct vlc_object_t obj
Definition vlc_xml.h:39
void(* pf_catalog_add)(xml_t *, const char *, const char *, const char *)
Definition vlc_xml.h:46
This file is a collection of common definitions and types.
static int xml_ReaderNextNode(xml_reader_t *reader, const char **pval)
Definition vlc_xml.h:85
@ XML_READER_STARTELEM
Definition vlc_xml.h:126
@ XML_READER_NONE
Definition vlc_xml.h:125
@ XML_READER_TEXT
Definition vlc_xml.h:128
@ XML_READER_ERROR
Definition vlc_xml.h:124
@ XML_READER_ENDELEM
Definition vlc_xml.h:127
void xml_ReaderDelete(xml_reader_t *)
Deletes an XML reader.
Definition xml.c:95
static int xml_ReaderIsEmptyElement(xml_reader_t *reader)
Definition vlc_xml.h:115
void xml_Delete(xml_t *)
Definition xml.c:59
#define xml_Create(a)
Definition vlc_xml.h:51
static int xml_ReaderUseDTD(xml_reader_t *reader)
Definition vlc_xml.h:110
static const char * xml_ReaderNextAttrNS(xml_reader_t *reader, const char **pval, const char **pnamespace)
Definition vlc_xml.h:103
static void xml_CatalogLoad(xml_t *xml, const char *catalog)
Definition vlc_xml.h:54
static const char * xml_ReaderNextAttr(xml_reader_t *reader, const char **pval)
Definition vlc_xml.h:97
static int xml_ReaderNextNodeNS(xml_reader_t *reader, const char **pval, const char **pnamespace)
Definition vlc_xml.h:90
static void xml_CatalogAdd(xml_t *xml, const char *type, const char *orig, const char *value)
Definition vlc_xml.h:59
#define xml_ReaderCreate(a, s)
Definition vlc_xml.h:82