View source code
Display the source code in dmd/root/outbuffer.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Struct dmd.root.outbuffer.OutBuffer

OutBuffer is a write-only output stream of untyped data. It is backed up by a contiguous array or a memory-mapped file.

struct OutBuffer ;

Constructors

NameDescription
this (filename) Construct from filename. Will map the file into memory (or create it anew if necessary) and start writing at the beginning of it.

Fields

NameTypeDescription
doindent boolWhether to indent
level intCurrent indent level
spaces boolWhether to indent by 4 spaces or by tabs;

Methods

NameDescription
allocate (nbytes) Allocate space, but leave it uninitialized.
bracket (i, left, j, right) Insert left at i, and right at j. Return index just past right.
destroy () Releases all resources associated with this and resets it as an empty memory buffer. The config variables notlinehead, doindent etc. are not changed.
extractData () Transfer ownership of the allocated data to the caller.
extractSlice (nullTerminate) Extract the data as a slice and take ownership of it.
insert (offset, p, nbytes)
moveToFile (filename) Destructively saves the contents of this to filename. As an optimization, if the file already has identical contents with the buffer, no copying is done. This is because on SSD drives reading is often much faster than writing and because there's a high likelihood an identical file is written during the build process.
opSlice ()
print (u) Convert u to a string and append it to the buffer.
reserve (nbytes) Reserves nbytes bytes of additional memory (or file space) in advance. The resulting capacity is at least the previous length plus nbytes.
setsize (size) Shrink the size of the data to size.
writenl () write newline

Authors

Walter Bright, http://www.digitalmars.com

License

Boost License 1.0