X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_xml.h;h=e8b846de2b150dc049c6d7c2a4a621d9ec510f10;hb=dbcc7fad003192d2b589a4b6f32ae285e0767923;hp=3f35b05bc4219e96e1a1dc78dec344cddb60c7c5;hpb=953253dda844e8f9caebf3c640464c00fb6ab440;p=vlc diff --git a/include/vlc_xml.h b/include/vlc_xml.h index 3f35b05bc4..e8b846de2b 100644 --- a/include/vlc_xml.h +++ b/include/vlc_xml.h @@ -46,12 +46,21 @@ struct xml_t const char * ); }; -VLC_EXPORT( xml_t *, xml_Create, ( vlc_object_t * ) LIBVLC_USED ); +VLC_API xml_t * xml_Create( vlc_object_t * ) VLC_USED; #define xml_Create( a ) xml_Create( VLC_OBJECT(a) ) -VLC_EXPORT( void, xml_Delete, ( xml_t * ) ); +VLC_API void xml_Delete( xml_t * ); + +static inline void xml_CatalogLoad( xml_t *xml, const char *catalog ) +{ + xml->pf_catalog_load( xml, catalog ); +} + +static inline void xml_CatalogAdd( xml_t *xml, const char *type, + const char *orig, const char *value ) +{ + xml->pf_catalog_add( xml, type, orig, value ); +} -#define xml_CatalogLoad( a, b ) a->pf_catalog_load( a, b ) -#define xml_CatalogAdd( a, b, c, d ) a->pf_catalog_add( a, b, c, d ) struct xml_reader_t { @@ -61,31 +70,48 @@ struct xml_reader_t stream_t *p_stream; module_t *p_module; - int (*pf_read) ( xml_reader_t * ); - int (*pf_node_type) ( xml_reader_t * ); - char * (*pf_name) ( xml_reader_t * ); - char * (*pf_value) ( xml_reader_t * ); - int (*pf_next_attr) ( xml_reader_t * ); + int (*pf_next_node) ( xml_reader_t *, const char ** ); + const char *(*pf_next_attr) ( xml_reader_t *, const char ** ); - int (*pf_use_dtd) ( xml_reader_t *, bool ); + int (*pf_use_dtd) ( xml_reader_t * ); + int (*pf_is_empty) ( xml_reader_t * ); }; -VLC_EXPORT( xml_reader_t *, xml_ReaderCreate, (vlc_object_t *, stream_t *) LIBVLC_USED ); +VLC_API xml_reader_t * xml_ReaderCreate(vlc_object_t *, stream_t *) VLC_USED; #define xml_ReaderCreate( a, s ) xml_ReaderCreate(VLC_OBJECT(a), s) -VLC_EXPORT( void, xml_ReaderDelete, (xml_reader_t *) ); -VLC_EXPORT( xml_reader_t *, xml_ReaderReset, (xml_reader_t *, stream_t *) LIBVLC_USED ); - -#define xml_ReaderRead( a ) a->pf_read( a ) -#define xml_ReaderNodeType( a ) a->pf_node_type( a ) -#define xml_ReaderName( a ) a->pf_name( a ) -#define xml_ReaderValue( a ) a->pf_value( a ) -#define xml_ReaderNextAttr( a ) a->pf_next_attr( a ) -#define xml_ReaderUseDTD( a, b ) a->pf_use_dtd( a, b ) - -#define XML_READER_NONE 0 -#define XML_READER_STARTELEM 1 -#define XML_READER_ENDELEM 2 -#define XML_READER_TEXT 3 +VLC_API void xml_ReaderDelete(xml_reader_t *); +VLC_API xml_reader_t * xml_ReaderReset(xml_reader_t *, stream_t *) VLC_USED; + +static inline int xml_ReaderNextNode( xml_reader_t *reader, const char **pval ) +{ + return reader->pf_next_node( reader, pval ); +} + +static inline const char *xml_ReaderNextAttr( xml_reader_t *reader, + const char **pval ) +{ + return reader->pf_next_attr( reader, pval ); +} + +static inline int xml_ReaderUseDTD( xml_reader_t *reader ) +{ + return reader->pf_use_dtd( reader ); +} + +static inline int xml_ReaderIsEmptyElement( xml_reader_t *reader ) +{ + if(reader->pf_is_empty == NULL) + return -2; + + return reader->pf_is_empty( reader ); +} + +enum { + XML_READER_NONE=0, + XML_READER_STARTELEM, + XML_READER_ENDELEM, + XML_READER_TEXT, +}; # ifdef __cplusplus }