class BinaryStreamRef

Declaration

class BinaryStreamRef : public BinaryStreamRefBase { /* full declaration omitted */ };

Description

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.

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:155

Inherits from: BinaryStreamRefBase

Method Overview

Methods

BinaryStreamRef(
    std::shared_ptr<BinaryStream> Impl,
    uint64_t ViewOffset,
    Optional<uint64_t> Length)

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:159

Parameters

std::shared_ptr<BinaryStream> Impl
uint64_t ViewOffset
Optional<uint64_t> Length

BinaryStreamRef()

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:164

BinaryStreamRef(llvm::BinaryStream& Stream)

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:165

Parameters

llvm::BinaryStream& Stream

BinaryStreamRef(llvm::BinaryStream& Stream,
                uint64_t Offset,
                Optional<uint64_t> Length)

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:166

Parameters

llvm::BinaryStream& Stream
uint64_t Offset
Optional<uint64_t> Length

BinaryStreamRef(ArrayRef<uint8_t> Data,
                llvm::support::endianness Endian)

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:168

Parameters

ArrayRef<uint8_t> Data
llvm::support::endianness Endian

BinaryStreamRef(llvm::StringRef Data,
                llvm::support::endianness Endian)

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:170

Parameters

llvm::StringRef Data
llvm::support::endianness Endian

BinaryStreamRef(
    const llvm::BinaryStreamRef& Other)

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:172

Parameters

const llvm::BinaryStreamRef& Other

BinaryStreamRef(llvm::BinaryStreamRef&& Other)

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:174

Parameters

llvm::BinaryStreamRef&& Other

BinaryStreamRef(llvm::BinaryStreamRef& S,
                uint64_t Offset,
                uint64_t Length)

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:178

Parameters

llvm::BinaryStreamRef& S
uint64_t Offset
uint64_t Length

llvm::Error readBytes(
    uint64_t Offset,
    uint64_t Size,
    ArrayRef<uint8_t>& Buffer) const

Description

Given an Offset into this StreamRef and a Size, return a reference to a buffer owned by the stream.

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:187

Parameters

uint64_t Offset
uint64_t Size
ArrayRef<uint8_t>& Buffer

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.

llvm::Error readLongestContiguousChunk(
    uint64_t Offset,
    ArrayRef<uint8_t>& Buffer) const

Description

Given an Offset into this BinaryStreamRef, return a reference to the largest buffer the stream could support without necessitating a copy.

Declared at: llvm/include/llvm/Support/BinaryStreamRef.h:195

Parameters

uint64_t Offset
ArrayRef<uint8_t>& Buffer

Returns

a success error code if implementation could read the data, and an appropriate error code otherwise.