+
+ /// current_pos - Return the current position within the stream, not
+ /// counting the bytes currently in the buffer.
+ virtual uint64_t current_pos() const = 0;
+
+protected:
+ /// SetBuffer - Use the provided buffer as the raw_ostream buffer. This is
+ /// intended for use only by subclasses which can arrange for the output to go
+ /// directly into the desired output buffer, instead of being copied on each
+ /// flush.
+ void SetBuffer(char *BufferStart, size_t Size) {
+ SetBufferAndMode(BufferStart, Size, ExternalBuffer);
+ }
+
+ /// preferred_buffer_size - Return an efficient buffer size for the
+ /// underlying output mechanism.
+ virtual size_t preferred_buffer_size() const;
+
+ /// getBufferStart - Return the beginning of the current stream buffer, or 0
+ /// if the stream is unbuffered.
+ const char *getBufferStart() const { return OutBufStart; }
+
+ //===--------------------------------------------------------------------===//
+ // Private Interface
+ //===--------------------------------------------------------------------===//
+private:
+ /// SetBufferAndMode - Install the given buffer and mode.
+ void SetBufferAndMode(char *BufferStart, size_t Size, BufferKind Mode);
+
+ /// flush_nonempty - Flush the current buffer, which is known to be
+ /// non-empty. This outputs the currently buffered data and resets
+ /// the buffer to empty.
+ void flush_nonempty();
+
+ /// copy_to_buffer - Copy data into the buffer. Size must not be
+ /// greater than the number of unused bytes in the buffer.
+ void copy_to_buffer(const char *Ptr, size_t Size);