Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes16kdownloads
xmlIO.h370 linesDownload Raw Back to libxml
1/*2 * Summary: interface for the I/O interfaces used by the parser3 * Description: interface for the I/O interfaces used by the parser4 *5 * Copy: See Copyright for the status of this software.6 *7 * Author: Daniel Veillard8 */9 10#ifndef __XML_IO_H__11#define __XML_IO_H__12 13#include <stdio.h>14#include <libxml/xmlversion.h>15 16#ifdef __cplusplus17extern "C" {18#endif19 20/*21 * Those are the functions and datatypes for the parser input22 * I/O structures.23 */24 25/**26 * xmlInputMatchCallback:27 * @filename: the filename or URI28 *29 * Callback used in the I/O Input API to detect if the current handler30 * can provide input functionality for this resource.31 *32 * Returns 1 if yes and 0 if another Input module should be used33 */34typedef int (*xmlInputMatchCallback) (char const *filename);35/**36 * xmlInputOpenCallback:37 * @filename: the filename or URI38 *39 * Callback used in the I/O Input API to open the resource40 *41 * Returns an Input context or NULL in case or error42 */43typedef void * (*xmlInputOpenCallback) (char const *filename);44/**45 * xmlInputReadCallback:46 * @context:  an Input context47 * @buffer:  the buffer to store data read48 * @len:  the length of the buffer in bytes49 *50 * Callback used in the I/O Input API to read the resource51 *52 * Returns the number of bytes read or -1 in case of error53 */54typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);55/**56 * xmlInputCloseCallback:57 * @context:  an Input context58 *59 * Callback used in the I/O Input API to close the resource60 *61 * Returns 0 or -1 in case of error62 */63typedef int (*xmlInputCloseCallback) (void * context);64 65#ifdef LIBXML_OUTPUT_ENABLED66/*67 * Those are the functions and datatypes for the library output68 * I/O structures.69 */70 71/**72 * xmlOutputMatchCallback:73 * @filename: the filename or URI74 *75 * Callback used in the I/O Output API to detect if the current handler76 * can provide output functionality for this resource.77 *78 * Returns 1 if yes and 0 if another Output module should be used79 */80typedef int (*xmlOutputMatchCallback) (char const *filename);81/**82 * xmlOutputOpenCallback:83 * @filename: the filename or URI84 *85 * Callback used in the I/O Output API to open the resource86 *87 * Returns an Output context or NULL in case or error88 */89typedef void * (*xmlOutputOpenCallback) (char const *filename);90/**91 * xmlOutputWriteCallback:92 * @context:  an Output context93 * @buffer:  the buffer of data to write94 * @len:  the length of the buffer in bytes95 *96 * Callback used in the I/O Output API to write to the resource97 *98 * Returns the number of bytes written or -1 in case of error99 */100typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,101                                       int len);102/**103 * xmlOutputCloseCallback:104 * @context:  an Output context105 *106 * Callback used in the I/O Output API to close the resource107 *108 * Returns 0 or -1 in case of error109 */110typedef int (*xmlOutputCloseCallback) (void * context);111#endif /* LIBXML_OUTPUT_ENABLED */112 113#ifdef __cplusplus114}115#endif116 117#include <libxml/globals.h>118#include <libxml/tree.h>119#include <libxml/parser.h>120#include <libxml/encoding.h>121 122#ifdef __cplusplus123extern "C" {124#endif125struct _xmlParserInputBuffer {126    void*                  context;127    xmlInputReadCallback   readcallback;128    xmlInputCloseCallback  closecallback;129 130    xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */131 132    xmlBufPtr buffer;    /* Local buffer encoded in UTF-8 */133    xmlBufPtr raw;       /* if encoder != NULL buffer for raw input */134    int	compressed;	    /* -1=unknown, 0=not compressed, 1=compressed */135    int error;136    unsigned long rawconsumed;/* amount consumed from raw */137};138 139 140#ifdef LIBXML_OUTPUT_ENABLED141struct _xmlOutputBuffer {142    void*                   context;143    xmlOutputWriteCallback  writecallback;144    xmlOutputCloseCallback  closecallback;145 146    xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */147 148    xmlBufPtr buffer;    /* Local buffer encoded in UTF-8 or ISOLatin */149    xmlBufPtr conv;      /* if encoder != NULL buffer for output */150    int written;            /* total number of byte written */151    int error;152};153#endif /* LIBXML_OUTPUT_ENABLED */154 155/*156 * Interfaces for input157 */158XMLPUBFUN void159	xmlCleanupInputCallbacks		(void);160 161XMLPUBFUN int162	xmlPopInputCallbacks			(void);163 164XMLPUBFUN void165	xmlRegisterDefaultInputCallbacks	(void);166XMLPUBFUN xmlParserInputBufferPtr167	xmlAllocParserInputBuffer		(xmlCharEncoding enc);168 169XMLPUBFUN xmlParserInputBufferPtr170	xmlParserInputBufferCreateFilename	(const char *URI,171                                                 xmlCharEncoding enc);172XMLPUBFUN xmlParserInputBufferPtr173	xmlParserInputBufferCreateFile		(FILE *file,174                                                 xmlCharEncoding enc);175XMLPUBFUN xmlParserInputBufferPtr176	xmlParserInputBufferCreateFd		(int fd,177	                                         xmlCharEncoding enc);178XMLPUBFUN xmlParserInputBufferPtr179	xmlParserInputBufferCreateMem		(const char *mem, int size,180	                                         xmlCharEncoding enc);181XML_DEPRECATED182XMLPUBFUN xmlParserInputBufferPtr183	xmlParserInputBufferCreateStatic	(const char *mem, int size,184	                                         xmlCharEncoding enc);185XMLPUBFUN xmlParserInputBufferPtr186	xmlParserInputBufferCreateIO		(xmlInputReadCallback   ioread,187						 xmlInputCloseCallback  ioclose,188						 void *ioctx,189	                                         xmlCharEncoding enc);190XMLPUBFUN int191	xmlParserInputBufferRead		(xmlParserInputBufferPtr in,192						 int len);193XMLPUBFUN int194	xmlParserInputBufferGrow		(xmlParserInputBufferPtr in,195						 int len);196XMLPUBFUN int197	xmlParserInputBufferPush		(xmlParserInputBufferPtr in,198						 int len,199						 const char *buf);200XMLPUBFUN void201	xmlFreeParserInputBuffer		(xmlParserInputBufferPtr in);202XMLPUBFUN char *203	xmlParserGetDirectory			(const char *filename);204 205XMLPUBFUN int206	xmlRegisterInputCallbacks		(xmlInputMatchCallback matchFunc,207						 xmlInputOpenCallback openFunc,208						 xmlInputReadCallback readFunc,209						 xmlInputCloseCallback closeFunc);210 211xmlParserInputBufferPtr212	__xmlParserInputBufferCreateFilename(const char *URI,213						xmlCharEncoding enc);214 215#ifdef LIBXML_OUTPUT_ENABLED216/*217 * Interfaces for output218 */219XMLPUBFUN void220	xmlCleanupOutputCallbacks		(void);221XMLPUBFUN int222	xmlPopOutputCallbacks			(void);223XMLPUBFUN void224	xmlRegisterDefaultOutputCallbacks(void);225XMLPUBFUN xmlOutputBufferPtr226	xmlAllocOutputBuffer		(xmlCharEncodingHandlerPtr encoder);227 228XMLPUBFUN xmlOutputBufferPtr229	xmlOutputBufferCreateFilename	(const char *URI,230					 xmlCharEncodingHandlerPtr encoder,231					 int compression);232 233XMLPUBFUN xmlOutputBufferPtr234	xmlOutputBufferCreateFile	(FILE *file,235					 xmlCharEncodingHandlerPtr encoder);236 237XMLPUBFUN xmlOutputBufferPtr238	xmlOutputBufferCreateBuffer	(xmlBufferPtr buffer,239					 xmlCharEncodingHandlerPtr encoder);240 241XMLPUBFUN xmlOutputBufferPtr242	xmlOutputBufferCreateFd		(int fd,243					 xmlCharEncodingHandlerPtr encoder);244 245XMLPUBFUN xmlOutputBufferPtr246	xmlOutputBufferCreateIO		(xmlOutputWriteCallback   iowrite,247					 xmlOutputCloseCallback  ioclose,248					 void *ioctx,249					 xmlCharEncodingHandlerPtr encoder);250 251/* Couple of APIs to get the output without digging into the buffers */252XMLPUBFUN const xmlChar *253        xmlOutputBufferGetContent       (xmlOutputBufferPtr out);254XMLPUBFUN size_t255        xmlOutputBufferGetSize          (xmlOutputBufferPtr out);256 257XMLPUBFUN int258	xmlOutputBufferWrite		(xmlOutputBufferPtr out,259					 int len,260					 const char *buf);261XMLPUBFUN int262	xmlOutputBufferWriteString	(xmlOutputBufferPtr out,263					 const char *str);264XMLPUBFUN int265	xmlOutputBufferWriteEscape	(xmlOutputBufferPtr out,266					 const xmlChar *str,267					 xmlCharEncodingOutputFunc escaping);268 269XMLPUBFUN int270	xmlOutputBufferFlush		(xmlOutputBufferPtr out);271XMLPUBFUN int272	xmlOutputBufferClose		(xmlOutputBufferPtr out);273 274XMLPUBFUN int275	xmlRegisterOutputCallbacks	(xmlOutputMatchCallback matchFunc,276					 xmlOutputOpenCallback openFunc,277					 xmlOutputWriteCallback writeFunc,278					 xmlOutputCloseCallback closeFunc);279 280xmlOutputBufferPtr281	__xmlOutputBufferCreateFilename(const char *URI,282                              xmlCharEncodingHandlerPtr encoder,283                              int compression);284 285#ifdef LIBXML_HTTP_ENABLED286/*  This function only exists if HTTP support built into the library  */287XMLPUBFUN void288	xmlRegisterHTTPPostCallbacks	(void );289#endif /* LIBXML_HTTP_ENABLED */290 291#endif /* LIBXML_OUTPUT_ENABLED */292 293XMLPUBFUN xmlParserInputPtr294	xmlCheckHTTPInput		(xmlParserCtxtPtr ctxt,295					 xmlParserInputPtr ret);296 297/*298 * A predefined entity loader disabling network accesses299 */300XMLPUBFUN xmlParserInputPtr301	xmlNoNetExternalEntityLoader	(const char *URL,302					 const char *ID,303					 xmlParserCtxtPtr ctxt);304 305/*306 * xmlNormalizeWindowsPath is obsolete, don't use it.307 * Check xmlCanonicPath in uri.h for a better alternative.308 */309XMLPUBFUN xmlChar *310	xmlNormalizeWindowsPath		(const xmlChar *path);311 312XMLPUBFUN int313	xmlCheckFilename		(const char *path);314/**315 * Default 'file://' protocol callbacks316 */317XMLPUBFUN int318	xmlFileMatch			(const char *filename);319XMLPUBFUN void *320	xmlFileOpen			(const char *filename);321XMLPUBFUN int322	xmlFileRead			(void * context,323					 char * buffer,324					 int len);325XMLPUBFUN int326	xmlFileClose			(void * context);327 328/**329 * Default 'http://' protocol callbacks330 */331#ifdef LIBXML_HTTP_ENABLED332XMLPUBFUN int333	xmlIOHTTPMatch			(const char *filename);334XMLPUBFUN void *335	xmlIOHTTPOpen			(const char *filename);336#ifdef LIBXML_OUTPUT_ENABLED337XMLPUBFUN void *338	xmlIOHTTPOpenW			(const char * post_uri,339					 int   compression );340#endif /* LIBXML_OUTPUT_ENABLED */341XMLPUBFUN int342	xmlIOHTTPRead			(void * context,343					 char * buffer,344					 int len);345XMLPUBFUN int346	xmlIOHTTPClose			(void * context);347#endif /* LIBXML_HTTP_ENABLED */348 349/**350 * Default 'ftp://' protocol callbacks351 */352#ifdef LIBXML_FTP_ENABLED353XMLPUBFUN int354	xmlIOFTPMatch			(const char *filename);355XMLPUBFUN void *356	xmlIOFTPOpen			(const char *filename);357XMLPUBFUN int358	xmlIOFTPRead			(void * context,359					 char * buffer,360					 int len);361XMLPUBFUN int362	xmlIOFTPClose			(void * context);363#endif /* LIBXML_FTP_ENABLED */364 365#ifdef __cplusplus366}367#endif368 369#endif /* __XML_IO_H__ */370 
codekingpro/portable-devtools · Team Ai