LLVM
8.0.1
|
An interface for accessing data in a stream-like format, but which discourages copying. More...
#include "llvm/Support/BinaryStream.h"
Public Member Functions | |
virtual | ~BinaryStream ()=default |
virtual llvm::support::endianness | getEndian () const =0 |
virtual Error | readBytes (uint32_t Offset, uint32_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. More... | |
virtual Error | readLongestContiguousChunk (uint32_t Offset, ArrayRef< uint8_t > &Buffer)=0 |
Given an offset into the stream, read as much as possible without copying any data. More... | |
virtual uint32_t | getLength ()=0 |
Return the number of bytes of data in this stream. More... | |
virtual BinaryStreamFlags | getFlags () const |
Return the properties of this stream. More... | |
Protected Member Functions | |
Error | checkOffsetForRead (uint32_t Offset, uint32_t DataSize) |
An interface for accessing data in a stream-like format, but which discourages copying.
Instead of specifying a buffer in which to copy data on a read, the API returns an ArrayRef to data owned by the stream's implementation. Since implementations may not necessarily store data in a single contiguous buffer (or even in memory at all), in such cases a it may be necessary for an implementation to cache such a buffer so that it can return it.
Definition at line 36 of file BinaryStream.h.
|
virtualdefault |
Definition at line 60 of file BinaryStream.h.
References getLength(), llvm::invalid_offset, llvm::stream_too_short, and llvm::Error::success().
Referenced by llvm::WritableBinaryStream::checkOffsetForWrite(), llvm::msf::MappedBlockStream::getLength(), llvm::BinaryByteStream::readBytes(), llvm::msf::MappedBlockStream::readBytes(), llvm::BinaryByteStream::readLongestContiguousChunk(), and llvm::msf::MappedBlockStream::readLongestContiguousChunk().
|
pure virtual |
Implemented in llvm::FileBufferByteStream, llvm::AppendingBinaryByteStream, llvm::msf::WritableMappedBlockStream, llvm::MutableBinaryByteStream, llvm::msf::MappedBlockStream, llvm::BinaryByteStream, and llvm::BinaryItemStream< T, Traits >.
Referenced by llvm::BinaryStreamReader::readInteger(), and llvm::BinaryStreamWriter::writeInteger().
|
inlinevirtual |
Return the properties of this stream.
Reimplemented in llvm::AppendingBinaryByteStream, and llvm::WritableBinaryStream.
Definition at line 57 of file BinaryStream.h.
References llvm::BSF_None.
Referenced by llvm::WritableBinaryStream::checkOffsetForWrite().
|
pure virtual |
Return the number of bytes of data in this stream.
Implemented in llvm::FileBufferByteStream, llvm::AppendingBinaryByteStream, llvm::msf::WritableMappedBlockStream, llvm::MutableBinaryByteStream, llvm::BinaryItemStream< T, Traits >, llvm::msf::MappedBlockStream, and llvm::BinaryByteStream.
Referenced by checkOffsetForRead(), llvm::WritableBinaryStream::checkOffsetForWrite(), and llvm::BinaryStreamWriter::getLength().
|
pure virtual |
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.
Implemented in llvm::FileBufferByteStream, llvm::AppendingBinaryByteStream, llvm::msf::WritableMappedBlockStream, llvm::MutableBinaryByteStream, llvm::msf::MappedBlockStream, llvm::BinaryByteStream, and llvm::BinaryItemStream< T, Traits >.
Referenced by llvm::BinaryStreamRef::readBytes().
|
pure virtual |
Given an offset into the stream, read as much as possible without copying any data.
Implemented in llvm::FileBufferByteStream, llvm::AppendingBinaryByteStream, llvm::msf::WritableMappedBlockStream, llvm::MutableBinaryByteStream, llvm::msf::MappedBlockStream, llvm::BinaryItemStream< T, Traits >, and llvm::BinaryByteStream.
Referenced by llvm::BinaryStreamRef::readLongestContiguousChunk().