2 /* Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved
3 * written by Walter Bright
4 * http://www.digitalmars.com
5 * Distributed under the Boost Software License, Version 1.0.
6 * http://www.boost.org/LICENSE_1_0.txt
7 * https://github.com/dlang/dmd/blob/master/src/dmd/root/outbuffer.h
20 // IMPORTANT: PLEASE KEEP STATE AND DESTRUCTOR IN SYNC WITH DEFINITION IN ./outbuffer.d.
22 DArray
<unsigned char> data
;
25 void* fileMapping
; // pointer to a file mapping object not used on the C++ side
33 data
= DArray
<unsigned char>();
45 d_size_t
length() const { return offset
; }
49 void reserve(d_size_t nbytes
);
50 void setsize(d_size_t size
);
52 void write(const void *data
, size_t nbytes
);
53 void writestring(const char *string
);
54 void prependstring(const char *string
);
55 void writenl(); // write newline
56 void writeByte(unsigned b
);
57 void writeUTF8(unsigned b
);
58 void prependbyte(unsigned b
);
59 void writewchar(unsigned w
);
60 void writeword(unsigned w
);
61 void writeUTF16(unsigned w
);
62 void write4(unsigned w
);
63 void write(const OutBuffer
*buf
);
64 void write(RootObject
*obj
);
65 void fill0(d_size_t nbytes
);
66 void vprintf(const char *format
, va_list args
);
67 void printf(const char *format
, ...);
68 void bracket(char left
, char right
);
69 d_size_t
bracket(d_size_t i
, const char *left
, d_size_t j
, const char *right
);
70 void spread(d_size_t offset
, d_size_t nbytes
);
71 d_size_t
insert(d_size_t offset
, const void *data
, d_size_t nbytes
);
72 void remove(d_size_t offset
, d_size_t nbytes
);
73 // Append terminating null if necessary and get view of internal buffer
75 // Append terminating null if necessary and take ownership of data