Daniel Veillard | bca22f4 | 2012-07-11 16:48:47 +0800 | [diff] [blame] | 1 | /* |
| 2 | * buf.h: Internal Interfaces for memory buffers in libxml2 |
| 3 | * |
| 4 | * See Copyright for the status of this software. |
| 5 | * |
| 6 | * daniel@veillard.com |
| 7 | */ |
| 8 | |
| 9 | #ifndef __XML_BUF_H__ |
| 10 | #define __XML_BUF_H__ |
| 11 | |
| 12 | #include <libxml/tree.h> |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | xmlBufPtr xmlBufCreate(void); |
| 19 | xmlBufPtr xmlBufCreateSize(size_t size); |
| 20 | xmlBufPtr xmlBufCreateStatic(void *mem, size_t size); |
| 21 | |
| 22 | int xmlBufSetAllocationScheme(xmlBufPtr buf, |
| 23 | xmlBufferAllocationScheme scheme); |
| 24 | int xmlBufGetAllocationScheme(xmlBufPtr buf); |
| 25 | |
| 26 | void xmlBufFree(xmlBufPtr buf); |
| 27 | void xmlBufEmpty(xmlBufPtr buf); |
| 28 | |
| 29 | size_t xmlBufShrink(xmlBufPtr buf, size_t len); |
| 30 | int xmlBufGrow(xmlBufPtr buf, int len); |
| 31 | int xmlBufInflate(xmlBufPtr buf, size_t len); |
| 32 | int xmlBufResize(xmlBufPtr buf, size_t len); |
| 33 | |
| 34 | int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len); |
| 35 | int xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len); |
| 36 | int xmlBufCat(xmlBufPtr buf, const xmlChar *str); |
| 37 | int xmlBufCCat(xmlBufPtr buf, const char *str); |
| 38 | int xmlBufWriteCHAR(xmlBufPtr buf, const xmlChar *string); |
| 39 | int xmlBufWriteChar(xmlBufPtr buf, const char *string); |
| 40 | int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string); |
| 41 | |
| 42 | size_t xmlBufAvail(xmlBufPtr buf); |
| 43 | size_t xmlBufLength(xmlBufPtr buf); |
| 44 | size_t xmlBufUse(xmlBufPtr buf); |
| 45 | int xmlBufIsEmpty(xmlBufPtr buf); |
| 46 | int xmlBufAddLen(xmlBufPtr buf, size_t len); |
| 47 | int xmlBufErase(xmlBufPtr buf, size_t len); |
| 48 | |
| 49 | xmlChar * xmlBufContent(const xmlBufPtr buf); |
| 50 | xmlChar * xmlBufEnd(const xmlBufPtr buf); |
| 51 | |
| 52 | xmlChar * xmlBufDetach(xmlBufPtr buf); |
| 53 | |
| 54 | size_t xmlBufDump(FILE *file, xmlBufPtr buf); |
| 55 | |
| 56 | xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer); |
| 57 | xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf); |
| 58 | int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer); |
| 59 | |
| 60 | #ifdef __cplusplus |
| 61 | } |
| 62 | #endif |
| 63 | #endif /* __XML_BUF_H__ */ |
| 64 | |