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:156

Inherits from: BinaryStreamRefBase

Method Overview

Methods

BinaryStreamRef()

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

BinaryStreamRef(llvm::BinaryStream& Stream)

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

Parameters

llvm::BinaryStream& Stream

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

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

Parameters

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

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

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

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:171

Parameters

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

BinaryStreamRef(
    const llvm::BinaryStreamRef& Other)

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

Parameters

const llvm::BinaryStreamRef& Other

BinaryStreamRef(llvm::BinaryStreamRef&& Other)

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

Parameters

llvm::BinaryStreamRef&& Other

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

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

Parameters

llvm::BinaryStreamRef& S
uint32_t Offset
uint32_t Length

llvm::Error readBytes(
    uint32_t Offset,
    uint32_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:188

Parameters

uint32_t Offset
uint32_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(
    uint32_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:196

Parameters

uint32_t Offset
ArrayRef<uint8_t>& Buffer

Returns

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