blob: 4d3afd025efc97ab169c43019f6637a857329bd5 [file] [log] [blame]
Daniel Veillardbca22f42012-07-11 16:48:47 +08001/*
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
15extern "C" {
16#endif
17
18xmlBufPtr xmlBufCreate(void);
19xmlBufPtr xmlBufCreateSize(size_t size);
20xmlBufPtr xmlBufCreateStatic(void *mem, size_t size);
21
22int xmlBufSetAllocationScheme(xmlBufPtr buf,
23 xmlBufferAllocationScheme scheme);
24int xmlBufGetAllocationScheme(xmlBufPtr buf);
25
26void xmlBufFree(xmlBufPtr buf);
27void xmlBufEmpty(xmlBufPtr buf);
28
29size_t xmlBufShrink(xmlBufPtr buf, size_t len);
30int xmlBufGrow(xmlBufPtr buf, int len);
31int xmlBufInflate(xmlBufPtr buf, size_t len);
32int xmlBufResize(xmlBufPtr buf, size_t len);
33
34int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
35int xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len);
36int xmlBufCat(xmlBufPtr buf, const xmlChar *str);
37int xmlBufCCat(xmlBufPtr buf, const char *str);
38int xmlBufWriteCHAR(xmlBufPtr buf, const xmlChar *string);
39int xmlBufWriteChar(xmlBufPtr buf, const char *string);
40int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
41
42size_t xmlBufAvail(xmlBufPtr buf);
43size_t xmlBufLength(xmlBufPtr buf);
44size_t xmlBufUse(xmlBufPtr buf);
45int xmlBufIsEmpty(xmlBufPtr buf);
46int xmlBufAddLen(xmlBufPtr buf, size_t len);
47int xmlBufErase(xmlBufPtr buf, size_t len);
48
49xmlChar * xmlBufContent(const xmlBufPtr buf);
50xmlChar * xmlBufEnd(const xmlBufPtr buf);
51
52xmlChar * xmlBufDetach(xmlBufPtr buf);
53
54size_t xmlBufDump(FILE *file, xmlBufPtr buf);
55
56xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer);
57xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf);
58int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
59
60#ifdef __cplusplus
61}
62#endif
63#endif /* __XML_BUF_H__ */
64