LLVM  7.0.0svn
Public Member Functions | List of all members
llvm::AppendingBinaryByteStream Class Reference

An implementation of WritableBinaryStream which can write at its end causing the underlying data to grow. More...

#include "llvm/Support/BinaryByteStream.h"

Inheritance diagram for llvm::AppendingBinaryByteStream:
Inheritance graph
[legend]
Collaboration diagram for llvm::AppendingBinaryByteStream:
Collaboration graph
[legend]

Public Member Functions

 AppendingBinaryByteStream ()=default
 
 AppendingBinaryByteStream (llvm::support::endianness Endian)
 
void clear ()
 
llvm::support::endianness getEndian () const override
 
Error readBytes (uint32_t Offset, uint32_t Size, ArrayRef< uint8_t > &Buffer) override
 Given an offset into the stream and a number of bytes, attempt to read the bytes and set the output ArrayRef to point to data owned by the stream. More...
 
void insert (uint32_t Offset, ArrayRef< uint8_t > Bytes)
 
Error readLongestContiguousChunk (uint32_t Offset, ArrayRef< uint8_t > &Buffer) override
 Given an offset into the stream, read as much as possible without copying any data. More...
 
uint32_t getLength () override
 Return the number of bytes of data in this stream. More...
 
Error writeBytes (uint32_t Offset, ArrayRef< uint8_t > Buffer) override
 Attempt to write the given bytes into the stream at the desired offset. More...
 
Error commit () override
 For buffered streams, commits changes to the backing store. More...
 
virtual BinaryStreamFlags getFlags () const override
 Return the properties of this stream. More...
 
MutableArrayRef< uint8_t > data ()
 
- Public Member Functions inherited from llvm::WritableBinaryStream
 ~WritableBinaryStream () override=default
 
BinaryStreamFlags getFlags () const override
 Return the properties of this stream. More...
 
- Public Member Functions inherited from llvm::BinaryStream
virtual ~BinaryStream ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from llvm::WritableBinaryStream
Error checkOffsetForWrite (uint32_t Offset, uint32_t DataSize)
 
- Protected Member Functions inherited from llvm::BinaryStream
Error checkOffsetForRead (uint32_t Offset, uint32_t DataSize)
 

Detailed Description

An implementation of WritableBinaryStream which can write at its end causing the underlying data to grow.

This class owns the underlying data.

Definition at line 136 of file BinaryByteStream.h.

Constructor & Destructor Documentation

◆ AppendingBinaryByteStream() [1/2]

llvm::AppendingBinaryByteStream::AppendingBinaryByteStream ( )
default

◆ AppendingBinaryByteStream() [2/2]

llvm::AppendingBinaryByteStream::AppendingBinaryByteStream ( llvm::support::endianness  Endian)
inline

Definition at line 142 of file BinaryByteStream.h.

Member Function Documentation

◆ clear()

void llvm::AppendingBinaryByteStream::clear ( )
inline

◆ commit()

Error llvm::AppendingBinaryByteStream::commit ( )
inlineoverridevirtual

For buffered streams, commits changes to the backing store.

Implements llvm::WritableBinaryStream.

Definition at line 194 of file BinaryByteStream.h.

References llvm::Error::success().

◆ data()

MutableArrayRef<uint8_t> llvm::AppendingBinaryByteStream::data ( )
inline

◆ getEndian()

llvm::support::endianness llvm::AppendingBinaryByteStream::getEndian ( ) const
inlineoverridevirtual

Implements llvm::BinaryStream.

Definition at line 147 of file BinaryByteStream.h.

References llvm::BinaryByteStream::Endian.

◆ getFlags()

virtual BinaryStreamFlags llvm::AppendingBinaryByteStream::getFlags ( ) const
inlineoverridevirtual

Return the properties of this stream.

Reimplemented from llvm::BinaryStream.

Definition at line 197 of file BinaryByteStream.h.

References llvm::BSF_Append, and llvm::BSF_Write.

◆ getLength()

uint32_t llvm::AppendingBinaryByteStream::getLength ( )
inlineoverridevirtual

Return the number of bytes of data in this stream.

Implements llvm::BinaryStream.

Definition at line 171 of file BinaryByteStream.h.

◆ insert()

void llvm::AppendingBinaryByteStream::insert ( uint32_t  Offset,
ArrayRef< uint8_t >  Bytes 
)
inline

◆ readBytes()

Error llvm::AppendingBinaryByteStream::readBytes ( uint32_t  Offset,
uint32_t  Size,
ArrayRef< uint8_t > &  Buffer 
)
inlineoverridevirtual

Given an offset into the stream and a number of bytes, attempt to read the bytes and set the output ArrayRef to point to data owned by the stream.

Implements llvm::BinaryStream.

Definition at line 149 of file BinaryByteStream.h.

References llvm::makeArrayRef(), llvm::ArrayRef< T >::size(), and llvm::Error::success().

◆ readLongestContiguousChunk()

Error llvm::AppendingBinaryByteStream::readLongestContiguousChunk ( uint32_t  Offset,
ArrayRef< uint8_t > &  Buffer 
)
inlineoverridevirtual

Given an offset into the stream, read as much as possible without copying any data.

Implements llvm::BinaryStream.

Definition at line 162 of file BinaryByteStream.h.

References llvm::makeArrayRef(), and llvm::Error::success().

◆ writeBytes()

Error llvm::AppendingBinaryByteStream::writeBytes ( uint32_t  Offset,
ArrayRef< uint8_t >  Data 
)
inlineoverridevirtual

Attempt to write the given bytes into the stream at the desired offset.

This will always necessitate a copy. Cannot shrink or grow the stream, only writes into existing allocated space.

Implements llvm::WritableBinaryStream.

Definition at line 173 of file BinaryByteStream.h.

References llvm::ArrayRef< T >::data(), llvm::ArrayRef< T >::empty(), llvm::BinaryByteStream::getLength(), llvm::invalid_offset, llvm::ArrayRef< T >::size(), and llvm::Error::success().


The documentation for this class was generated from the following file: