LLVM
8.0.1
|
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array. More...
#include "llvm/Support/BinaryStreamRef.h"
Public Member Functions | |
BinaryStreamRef ()=default | |
BinaryStreamRef (BinaryStream &Stream) | |
BinaryStreamRef (BinaryStream &Stream, uint32_t Offset, Optional< uint32_t > Length) | |
BinaryStreamRef (ArrayRef< uint8_t > Data, llvm::support::endianness Endian) | |
BinaryStreamRef (StringRef Data, llvm::support::endianness Endian) | |
BinaryStreamRef (const BinaryStreamRef &Other)=default | |
BinaryStreamRef & | operator= (const BinaryStreamRef &Other)=default |
BinaryStreamRef (BinaryStreamRef &&Other)=default | |
BinaryStreamRef & | operator= (BinaryStreamRef &&Other)=default |
BinaryStreamRef (BinaryStreamRef &S, uint32_t Offset, uint32_t Length)=delete | |
Error | readBytes (uint32_t Offset, uint32_t Size, ArrayRef< uint8_t > &Buffer) const |
Given an Offset into this StreamRef and a Size, return a reference to a buffer owned by the stream. More... | |
Error | readLongestContiguousChunk (uint32_t Offset, ArrayRef< uint8_t > &Buffer) const |
Given an Offset into this BinaryStreamRef, return a reference to the largest buffer the stream could support without necessitating a copy. More... | |
Public Member Functions inherited from llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream > | |
llvm::support::endianness | getEndian () const |
uint32_t | getLength () const |
BinaryStreamRef | drop_front (uint32_t N) const |
Return a new BinaryStreamRef with the first N elements removed. More... | |
BinaryStreamRef | drop_back (uint32_t N) const |
Return a new BinaryStreamRef with the last N elements removed. More... | |
BinaryStreamRef | keep_front (uint32_t N) const |
Return a new BinaryStreamRef with only the first N elements remaining. More... | |
BinaryStreamRef | keep_back (uint32_t N) const |
Return a new BinaryStreamRef with only the last N elements remaining. More... | |
BinaryStreamRef | drop_symmetric (uint32_t N) const |
Return a new BinaryStreamRef with the first and last N elements removed. More... | |
BinaryStreamRef | slice (uint32_t Offset, uint32_t Len) const |
Return a new BinaryStreamRef with the first Offset elements removed, and retaining exactly Len elements. More... | |
bool | valid () const |
bool | operator== (const BinaryStreamRef &Other) const |
Friends | |
class | WritableBinaryStreamRef |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream > | |
BinaryStreamRefBase ()=default | |
BinaryStreamRefBase (BinaryStream &BorrowedImpl) | |
BinaryStreamRefBase (std::shared_ptr< BinaryStream > SharedImpl, uint32_t Offset, Optional< uint32_t > Length) | |
BinaryStreamRefBase (BinaryStream &BorrowedImpl, uint32_t Offset, Optional< uint32_t > Length) | |
BinaryStreamRefBase (const BinaryStreamRefBase &Other)=default | |
BinaryStreamRefBase (BinaryStreamRefBase &&Other)=default | |
BinaryStreamRefBase & | operator= (const BinaryStreamRefBase &Other)=default |
BinaryStreamRefBase & | operator= (BinaryStreamRefBase &&Other)=default |
Error | checkOffsetForRead (uint32_t Offset, uint32_t DataSize) const |
Protected Attributes inherited from llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream > | |
std::shared_ptr< BinaryStream > | SharedImpl |
BinaryStream * | BorrowedImpl |
uint32_t | ViewOffset |
Optional< uint32_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 157 of file BinaryStreamRef.h.
|
default |
BinaryStreamRef::BinaryStreamRef | ( | BinaryStream & | Stream | ) |
Definition at line 68 of file BinaryStreamRef.cpp.
BinaryStreamRef::BinaryStreamRef | ( | BinaryStream & | Stream, |
uint32_t | Offset, | ||
Optional< uint32_t > | Length | ||
) |
Definition at line 70 of file BinaryStreamRef.cpp.
|
explicit |
Definition at line 73 of file BinaryStreamRef.cpp.
|
explicit |
Definition at line 76 of file BinaryStreamRef.cpp.
|
default |
|
default |
|
delete |
|
default |
|
default |
Error BinaryStreamRef::readBytes | ( | uint32_t | Offset, |
uint32_t | Size, | ||
ArrayRef< uint8_t > & | Buffer | ||
) | const |
Given an Offset into this StreamRef and a Size, return a reference to a buffer owned by the stream.
Definition at line 80 of file BinaryStreamRef.cpp.
References llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::BorrowedImpl, llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::checkOffsetForRead(), llvm::BinaryStream::readBytes(), and llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::ViewOffset.
Referenced by llvm::msf::MappedBlockStream::getLength(), llvm::BinaryStreamReader::peek(), llvm::BinaryStreamReader::readBytes(), and llvm::msf::MappedBlockStream::readLongestContiguousChunk().
Error BinaryStreamRef::readLongestContiguousChunk | ( | uint32_t | Offset, |
ArrayRef< uint8_t > & | Buffer | ||
) | const |
Given an Offset into this BinaryStreamRef, return a reference to the largest buffer the stream could support without necessitating a copy.
Definition at line 87 of file BinaryStreamRef.cpp.
References llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::BorrowedImpl, llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::checkOffsetForRead(), llvm::BinaryStreamRefBase< BinaryStreamRef, BinaryStream >::getLength(), 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().
|
friend |
Definition at line 160 of file BinaryStreamRef.h.