A copyable, read‐only window into a BinaryStream.

Synopsis

Declared in <llvm/Support/BinaryStreamRef.h>

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.

Base Classes

Name

Description

BinaryStreamRefBase<BinaryStreamRef, BinaryStream>

Common stuff for mutable and immutable StreamRefs.

Member Functions

Name

Description

BinaryStreamRef [constructor]

Constructors

operator=

Assignment operators

drop_back

Return a new BinaryStreamRef with the last N elements removed.

drop_front

Return a new BinaryStreamRef with the first N elements removed. If this BinaryStreamRef is length‐tracking, then the resulting one will be too.

drop_symmetric

Return a new BinaryStreamRef with the first and last N elements removed.

getEndian

Return the endianness of multi‐byte values in the underlying stream.

getLength

Return the length in bytes of this stream reference's view.

keep_back

Return a new BinaryStreamRef with only the last N elements remaining.

keep_front

Return a new BinaryStreamRef with only the first N elements remaining.

readBytes

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

readLongestContiguousChunk

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

slice

Return a new BinaryStreamRef with the first Offset elements removed, and retaining exactly Len elements.

valid

Return true if this reference refers to a valid underlying stream.

Protected Member Functions

Name

Description

operator=

Assignment operators

checkOffsetForRead

Validate that Offset and DataSize fall within this view for reading.

Protected Data Members

Name

Description

BorrowedImpl

Non‐owning pointer to the underlying stream implementation.

Length

Explicit length of this view, or unset when length‐tracking.

SharedImpl

Shared ownership of the underlying stream, if any.

ViewOffset

Byte offset into the underlying stream where this view begins.

Friends

Name

Description

llvm::WritableBinaryStreamRef

A copyable, writable window into a WritableBinaryStream.

llvm::BinaryStreamRefBase

Common stuff for mutable and immutable StreamRefs.

Non-Member Functions

Name

Description

operator==

Compare two stream references for equality of impl, offset, and length.

codeview::readCVRecordFromStream

Read a complete record from a stream at a random offset.

codeview::readSymbolFromStream

Read one CodeView symbol record from Stream at Offset.

Created with MrDocs