LLVM: llvm::BinaryStreamRef Class Reference (original) (raw)
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array. More...
#include "[llvm/Support/BinaryStreamRef.h](BinaryStreamRef%5F8h%5Fsource.html)"
Additional Inherited Members | |
---|---|
![]() |
|
BinaryStreamRefBase ()=default | |
BinaryStreamRefBase (BinaryStream &BorrowedImpl) | |
BinaryStreamRefBase (std::shared_ptr< BinaryStream > SharedImpl, uint64_t Offset, std::optional< uint64_t > Length) | |
BinaryStreamRefBase (BinaryStream &BorrowedImpl, uint64_t Offset, std::optional< uint64_t > Length) | |
BinaryStreamRefBase (const BinaryStreamRefBase &Other)=default | |
BinaryStreamRefBase (BinaryStreamRefBase &&Other)=default | |
BinaryStreamRefBase & | operator= (const BinaryStreamRefBase &Other)=default |
BinaryStreamRefBase & | operator= (BinaryStreamRefBase &&Other)=default |
Error | checkOffsetForRead (uint64_t Offset, uint64_t DataSize) const |
![]() |
|
std::shared_ptr< BinaryStream > | SharedImpl |
BinaryStream * | BorrowedImpl |
uint64_t | ViewOffset |
std::optional< uint64_t > | Length |
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
It provides copy-semantics and read only access to a "window" of the underlying BinaryStream. Note that BinaryStreamRef is not a BinaryStream. That is to say, it does not inherit and override the methods of BinaryStream. In general, you should not pass around pointers or references to BinaryStreams and use inheritance to achieve polymorphism. Instead, you should pass around BinaryStreamRefs by value and achieve polymorphism that way.
Definition at line 153 of file BinaryStreamRef.h.
llvm::BinaryStreamRef::BinaryStreamRef ( ) | default |
---|
◆ BinaryStreamRef() [2/8]
◆ BinaryStreamRef() [3/8]
◆ BinaryStreamRef() [4/8]
◆ BinaryStreamRef() [5/8]
◆ BinaryStreamRef() [6/8]
◆ BinaryStreamRef() [7/8]
◆ BinaryStreamRef() [8/8]
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ readBytes()
Given an Offset into this StreamRef and a Size, return a reference to a buffer owned by the stream.
Returns
a success error code if the entire range of data is within the bounds of this BinaryStreamRef's view and the implementation could read the data, and an appropriate error code otherwise.
Definition at line 73 of file BinaryStreamRef.cpp.
References llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::BorrowedImpl, llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::checkOffsetForRead(), llvm::Offset, llvm::BinaryStream::readBytes(), Size, and llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::ViewOffset.
Referenced by llvm::FixedStreamArray< T >::operator, llvm::BinaryStreamReader::peek(), llvm::BinaryStreamReader::readBytes(), and llvm::msf::MappedBlockStream::readLongestContiguousChunk().
◆ readLongestContiguousChunk()
Given an Offset into this BinaryStreamRef, return a reference to the largest buffer the stream could support without necessitating a copy.
Returns
a success error code if implementation could read the data, and an appropriate error code otherwise.
Definition at line 80 of file BinaryStreamRef.cpp.
References llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::BorrowedImpl, llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::checkOffsetForRead(), llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::getLength(), llvm::Offset, llvm::BinaryStream::readLongestContiguousChunk(), llvm::ArrayRef< T >::size(), llvm::ArrayRef< T >::slice(), llvm::Error::success(), and llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::ViewOffset.
Referenced by llvm::BinaryStreamReader::readLongestContiguousChunk().
◆ WritableBinaryStreamRef
The documentation for this class was generated from the following files:
- include/llvm/Support/BinaryStreamRef.h
- lib/Support/BinaryStreamRef.cpp