LLVM 17.0.0git
|
An implementation of WritableBinaryStream which can write at its end causing the underlying data to grow. More...
#include "llvm/Support/BinaryByteStream.h"
Public Member Functions | |
AppendingBinaryByteStream ()=default | |
AppendingBinaryByteStream (llvm::support::endianness Endian) | |
void | clear () |
llvm::support::endianness | getEndian () const override |
Error | readBytes (uint64_t Offset, uint64_t Size, ArrayRef< uint8_t > &Buffer) override |
Given an offset into the stream and a number of bytes, attempt to read the bytes and set the output ArrayRef to point to data owned by the stream. | |
void | insert (uint64_t Offset, ArrayRef< uint8_t > Bytes) |
Error | readLongestContiguousChunk (uint64_t Offset, ArrayRef< uint8_t > &Buffer) override |
Given an offset into the stream, read as much as possible without copying any data. | |
uint64_t | getLength () override |
Return the number of bytes of data in this stream. | |
Error | writeBytes (uint64_t Offset, ArrayRef< uint8_t > Buffer) override |
Attempt to write the given bytes into the stream at the desired offset. | |
Error | commit () override |
For buffered streams, commits changes to the backing store. | |
BinaryStreamFlags | getFlags () const override |
Return the properties of this stream. | |
MutableArrayRef< uint8_t > | data () |
![]() | |
~WritableBinaryStream () override=default | |
virtual Error | writeBytes (uint64_t Offset, ArrayRef< uint8_t > Data)=0 |
Attempt to write the given bytes into the stream at the desired offset. | |
virtual Error | commit ()=0 |
For buffered streams, commits changes to the backing store. | |
BinaryStreamFlags | getFlags () const override |
Return the properties of this stream. | |
![]() | |
virtual | ~BinaryStream ()=default |
virtual llvm::support::endianness | getEndian () const =0 |
virtual Error | readBytes (uint64_t Offset, uint64_t Size, ArrayRef< uint8_t > &Buffer)=0 |
Given an offset into the stream and a number of bytes, attempt to read the bytes and set the output ArrayRef to point to data owned by the stream. | |
virtual Error | readLongestContiguousChunk (uint64_t Offset, ArrayRef< uint8_t > &Buffer)=0 |
Given an offset into the stream, read as much as possible without copying any data. | |
virtual uint64_t | getLength ()=0 |
Return the number of bytes of data in this stream. | |
virtual BinaryStreamFlags | getFlags () const |
Return the properties of this stream. | |
Additional Inherited Members | |
![]() | |
Error | checkOffsetForWrite (uint64_t Offset, uint64_t DataSize) |
![]() | |
Error | checkOffsetForRead (uint64_t Offset, uint64_t DataSize) |
An implementation of WritableBinaryStream which can write at its end causing the underlying data to grow.
This class owns the underlying data.
Definition at line 134 of file BinaryByteStream.h.
|
default |
|
inline |
Definition at line 140 of file BinaryByteStream.h.
References Endian.
|
inline |
Definition at line 143 of file BinaryByteStream.h.
References llvm::Data.
Referenced by llvm::codeview::ContinuationRecordBuilder::begin().
|
inlineoverridevirtual |
For buffered streams, commits changes to the backing store.
Implements llvm::WritableBinaryStream.
Definition at line 192 of file BinaryByteStream.h.
References llvm::Error::success().
|
inline |
Definition at line 197 of file BinaryByteStream.h.
References llvm::Data.
|
inlineoverridevirtual |
Implements llvm::BinaryStream.
Definition at line 145 of file BinaryByteStream.h.
References Endian.
|
inlineoverridevirtual |
Return the properties of this stream.
Reimplemented from llvm::BinaryStream.
Definition at line 195 of file BinaryByteStream.h.
References llvm::BSF_Append, and llvm::BSF_Write.
|
inlineoverridevirtual |
Return the number of bytes of data in this stream.
Implements llvm::BinaryStream.
Definition at line 169 of file BinaryByteStream.h.
References llvm::Data.
Referenced by writeBytes().
Definition at line 156 of file BinaryByteStream.h.
References llvm::ArrayRef< T >::begin(), llvm::Data, llvm::ArrayRef< T >::end(), and llvm::Offset.
|
inlineoverridevirtual |
Given an offset into the stream and a number of bytes, attempt to read the bytes and set the output ArrayRef to point to data owned by the stream.
Implements llvm::BinaryStream.
Definition at line 147 of file BinaryByteStream.h.
References llvm::WritableBinaryStream::checkOffsetForWrite(), llvm::Data, llvm::Offset, llvm::ArrayRef< T >::size(), Size, llvm::ArrayRef< T >::slice(), and llvm::Error::success().
|
inlineoverridevirtual |
Given an offset into the stream, read as much as possible without copying any data.
Implements llvm::BinaryStream.
Definition at line 160 of file BinaryByteStream.h.
References llvm::WritableBinaryStream::checkOffsetForWrite(), llvm::Data, llvm::Offset, llvm::ArrayRef< T >::slice(), and llvm::Error::success().
|
inlineoverridevirtual |
Attempt to write the given bytes into the stream at the desired offset.
This will always necessitate a copy. Cannot shrink or grow the stream, only writes into existing allocated space.
Implements llvm::WritableBinaryStream.
Definition at line 171 of file BinaryByteStream.h.
References llvm::ArrayRef< T >::data(), llvm::Data, llvm::ArrayRef< T >::empty(), getLength(), llvm::invalid_offset, llvm::Offset, llvm::ArrayRef< T >::size(), and llvm::Error::success().