LLVM 20.0.0git
|
BinaryItemStream represents a sequence of objects stored in some kind of external container but for which it is useful to view as a stream of contiguous bytes. More...
#include "llvm/Support/BinaryItemStream.h"
Public Member Functions | |
BinaryItemStream (llvm::endianness Endian) | |
llvm::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. | |
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. | |
void | setItems (ArrayRef< T > ItemArray) |
uint64_t | getLength () override |
Return the number of bytes of data in this stream. | |
Public Member Functions inherited from llvm::BinaryStream | |
virtual | ~BinaryStream ()=default |
virtual llvm::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 | |
Protected Member Functions inherited from llvm::BinaryStream | |
Error | checkOffsetForRead (uint64_t Offset, uint64_t DataSize) |
BinaryItemStream represents a sequence of objects stored in some kind of external container but for which it is useful to view as a stream of contiguous bytes.
An example of this might be if you have a collection of records and you serialize each one into a buffer, and store these serialized records in a container. The pointers themselves are not laid out contiguously in memory, but we may wish to read from or write to these records as if they were.
Definition at line 34 of file BinaryItemStream.h.
|
inlineexplicit |
Definition at line 36 of file BinaryItemStream.h.
References Endian.
|
inlineoverridevirtual |
Implements llvm::BinaryStream.
Definition at line 38 of file BinaryItemStream.h.
|
inlineoverridevirtual |
Return the number of bytes of data in this stream.
Implements llvm::BinaryStream.
Definition at line 68 of file BinaryItemStream.h.
|
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 40 of file BinaryItemStream.h.
References llvm::BinaryStream::checkOffsetForRead(), llvm::Offset, Size, llvm::stream_too_short, llvm::Error::success(), and llvm::ArrayRef< T >::take_front().
|
inlineoverridevirtual |
Given an offset into the stream, read as much as possible without copying any data.
Implements llvm::BinaryStream.
Definition at line 54 of file BinaryItemStream.h.
References llvm::Offset, and llvm::Error::success().
|
inline |
Definition at line 63 of file BinaryItemStream.h.
Referenced by writeRecords().