vlc_xml.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 * xml.h: XML abstraction layer
00003 *****************************************************************************
00004 * Copyright (C) 2004-2010 the VideoLAN team
00005 *
00006 * Author: Gildas Bazin <gbazin@videolan.org>
00007 *
00008 * This program is free software; you can redistribute it and/or modify
00009 * it under the terms of the GNU General Public License as published by
00010 * the Free Software Foundation; either version 2 of the License, or
00011 * (at your option) any later version.
00012 *
00013 * This program is distributed in the hope that it will be useful,
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 * GNU General Public License for more details.
00017 *
00018 * You should have received a copy of the GNU General Public License
00019 * along with this program; if not, write to the Free Software
00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00021 *****************************************************************************/
00022 
00023 #ifndef VLC_XML_H
00024 #define VLC_XML_H
00025 
00026 /**
00027 * \file
00028 * This file defines functions and structures to handle xml tags in vlc
00029 *
00030 */
00031 
00032 # ifdef __cplusplus
00033 extern "C" {
00034 # endif
00035 
00036 struct xml_t
00037 {
00038     VLC_COMMON_MEMBERS
00039 
00040     /* Module properties */
00041     module_t  *p_module;
00042     xml_sys_t *p_sys;
00043 
00044     void (*pf_catalog_load) ( xml_t *, const char * );
00045     void (*pf_catalog_add) ( xml_t *, const char *, const char *,
00046                             const char * );
00047 };
00048 
00049 VLC_EXPORT( xml_t *, xml_Create, ( vlc_object_t * ) LIBVLC_USED );
00050 #define xml_Create( a ) xml_Create( VLC_OBJECT(a) )
00051 VLC_EXPORT( void, xml_Delete, ( xml_t * ) );
00052 
00053 static inline void xml_CatalogLoad( xml_t *xml, const char *catalog )
00054 {
00055     xml->pf_catalog_load( xml, catalog );
00056 }
00057 
00058 static inline void xml_CatalogAdd( xml_t *xml, const char *type,
00059                                    const char *orig, const char *value )
00060 {
00061     xml->pf_catalog_add( xml, type, orig, value );
00062 }
00063 
00064 
00065 struct xml_reader_t
00066 {
00067     VLC_COMMON_MEMBERS
00068 
00069     xml_reader_sys_t *p_sys;
00070     stream_t *p_stream;
00071     module_t *p_module;
00072 
00073     int (*pf_read) ( xml_reader_t * );
00074     int (*pf_node_type) ( xml_reader_t * );
00075     char * (*pf_name) ( xml_reader_t * );
00076     char * (*pf_value) ( xml_reader_t * );
00077     int (*pf_next_attr) ( xml_reader_t * );
00078 
00079     int (*pf_use_dtd) ( xml_reader_t * );
00080 };
00081 
00082 VLC_EXPORT( xml_reader_t *, xml_ReaderCreate, (vlc_object_t *, stream_t *) LIBVLC_USED );
00083 #define xml_ReaderCreate( a, s ) xml_ReaderCreate(VLC_OBJECT(a), s)
00084 VLC_EXPORT( void, xml_ReaderDelete, (xml_reader_t *) );
00085 VLC_EXPORT( xml_reader_t *, xml_ReaderReset, (xml_reader_t *, stream_t *) LIBVLC_USED );
00086 
00087 static inline int xml_ReaderRead( xml_reader_t *reader )
00088 {
00089   return reader->pf_read( reader );
00090 }
00091 
00092 static inline int xml_ReaderNodeType( xml_reader_t *reader )
00093 {
00094   return reader->pf_node_type( reader );
00095 }
00096 
00097 static inline char *xml_ReaderName( xml_reader_t *reader )
00098 {
00099   return reader->pf_name( reader );
00100 }
00101 
00102 static inline char *xml_ReaderValue( xml_reader_t *reader )
00103 {
00104   return reader->pf_value( reader );
00105 }
00106 
00107 static inline int xml_ReaderNextAttr( xml_reader_t *reader )
00108 {
00109   return reader->pf_next_attr( reader );
00110 }
00111 
00112 static inline int xml_ReaderUseDTD( xml_reader_t *reader )
00113 {
00114   return reader->pf_use_dtd( reader );
00115 }
00116 
00117 enum {
00118     XML_READER_NONE=0,
00119     XML_READER_STARTELEM,
00120     XML_READER_ENDELEM,
00121     XML_READER_TEXT,
00122 };
00123 
00124 # ifdef __cplusplus
00125 }
00126 # endif
00127 
00128 #endif

Generated on Mon Nov 22 07:55:20 2010 for VLC by  doxygen 1.5.6