1 /* libxml2 - Library for parsing XML documents
2 * Copyright (C) 2006-2019 Free Software Foundation, Inc.
3 *
4 * This file is not part of the GNU gettext program, but is used with
5 * GNU gettext.
6 *
7 * The original copyright notice is as follows:
8 */
9
10 /*
11 * Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved.
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a copy
14 * of this software and associated documentation files (the "Software"), to deal
15 * in the Software without restriction, including without limitation the rights
16 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 * copies of the Software, and to permit persons to whom the Software is fur-
18 * nished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included in
21 * all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
25 * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 * THE SOFTWARE.
30 *
31 * Author: Daniel Veillard
32 */
33
34 /*
35 * Summary: Internal Interfaces for memory buffers in libxml2
36 * Description: this module describes most of the new xmlBuf buffer
37 * entry points, those are private routines, with a
38 * few exceptions exported in tree.h. This was added
39 * in 2.9.0.
40 */
41
42 #ifndef __XML_BUF_H__
43 #define __XML_BUF_H__
44
45 #include <libxml/tree.h>
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50
51 xmlBufPtr xmlBufCreate(void);
52 xmlBufPtr xmlBufCreateSize(size_t size);
53 xmlBufPtr xmlBufCreateStatic(void *mem, size_t size);
54
55 int xmlBufSetAllocationScheme(xmlBufPtr buf,
56 xmlBufferAllocationScheme scheme);
57 int xmlBufGetAllocationScheme(xmlBufPtr buf);
58
59 void xmlBufFree(xmlBufPtr buf);
60 void xmlBufEmpty(xmlBufPtr buf);
61
62 /* size_t xmlBufShrink(xmlBufPtr buf, size_t len); */
63 int xmlBufGrow(xmlBufPtr buf, int len);
64 int xmlBufInflate(xmlBufPtr buf, size_t len);
65 int xmlBufResize(xmlBufPtr buf, size_t len);
66
67 int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
68 int xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len);
69 int xmlBufCat(xmlBufPtr buf, const xmlChar *str);
70 int xmlBufCCat(xmlBufPtr buf, const char *str);
71 int xmlBufWriteCHAR(xmlBufPtr buf, const xmlChar *string);
72 int xmlBufWriteChar(xmlBufPtr buf, const char *string);
73 int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
74
75 size_t xmlBufAvail(const xmlBufPtr buf);
76 size_t xmlBufLength(const xmlBufPtr buf);
77 /* size_t xmlBufUse(const xmlBufPtr buf); */
78 int xmlBufIsEmpty(const xmlBufPtr buf);
79 int xmlBufAddLen(xmlBufPtr buf, size_t len);
80 int xmlBufErase(xmlBufPtr buf, size_t len);
81
82 /* const xmlChar * xmlBufContent(const xmlBuf *buf); */
83 /* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
84
85 xmlChar * xmlBufDetach(xmlBufPtr buf);
86
87 size_t xmlBufDump(FILE *file, xmlBufPtr buf);
88
89 xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer);
90 xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf);
91 int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
92
93 int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input);
94 size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input);
95 int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
96 size_t base, size_t cur);
97 #ifdef __cplusplus
98 }
99 #endif
100 #endif /* __XML_BUF_H__ */
101