1 /*****************************************************************************
2 * xml.h: XML abstraction layer
3 *****************************************************************************
4 * Copyright (C) 2004-2010 the VideoLAN team
6 * Author: Gildas Bazin <gbazin@videolan.org>
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.
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.
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 *****************************************************************************/
28 * This file defines functions and structures to handle xml tags in vlc
40 /* Module properties */
44 void (*pf_catalog_load
) ( xml_t
*, const char * );
45 void (*pf_catalog_add
) ( xml_t
*, const char *, const char *,
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
* ) );
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
);
69 xml_reader_sys_t
*p_sys
;
73 int (*pf_read
) ( xml_reader_t
* );
74 int (*pf_node_type
) ( xml_reader_t
* );
75 char * (*pf_name
) ( xml_reader_t
* );
76 char * (*pf_value
) ( xml_reader_t
* );
77 int (*pf_next_attr
) ( xml_reader_t
* );
79 int (*pf_use_dtd
) ( xml_reader_t
* );
82 VLC_EXPORT( xml_reader_t
*, xml_ReaderCreate
, (vlc_object_t
*, stream_t
*) LIBVLC_USED
);
83 #define xml_ReaderCreate( a, s ) xml_ReaderCreate(VLC_OBJECT(a), s)
84 VLC_EXPORT( void, xml_ReaderDelete
, (xml_reader_t
*) );
85 VLC_EXPORT( xml_reader_t
*, xml_ReaderReset
, (xml_reader_t
*, stream_t
*) LIBVLC_USED
);
87 static inline int xml_ReaderRead( xml_reader_t
*reader
)
89 return reader
->pf_read( reader
);
92 static inline int xml_ReaderNodeType( xml_reader_t
*reader
)
94 return reader
->pf_node_type( reader
);
97 static inline char *xml_ReaderName( xml_reader_t
*reader
)
99 return reader
->pf_name( reader
);
102 static inline char *xml_ReaderValue( xml_reader_t
*reader
)
104 return reader
->pf_value( reader
);
107 static inline int xml_ReaderNextAttr( xml_reader_t
*reader
)
109 return reader
->pf_next_attr( reader
);
112 static inline int xml_ReaderUseDTD( xml_reader_t
*reader
)
114 return reader
->pf_use_dtd( reader
);
119 XML_READER_STARTELEM
,