16#ifndef LIEF_MEMORY_STREAM_H
17#define LIEF_MEMORY_STREAM_H
29 using BinaryStream::p;
30 using BinaryStream::end;
31 using BinaryStream::start;
36 BinaryStream(BinaryStream::STREAM_TYPE::MEMORY),
37 baseaddr_(base_address),
42 MemoryStream&
operator=(
const MemoryStream&) =
delete;
45 MemoryStream& operator=(MemoryStream&&) noexcept = default;
47 uintptr_t base_address()
const {
48 return this->baseaddr_;
51 const uint8_t*
p()
const override {
52 return start() + pos();
55 const uint8_t*
start()
const override {
56 return reinterpret_cast<const uint8_t*
>(baseaddr_);
59 const uint8_t*
end()
const override {
60 return start() + size_;
71 uint64_t
size()
const override {
77 static bool classof(
const BinaryStream& stream) {
78 return stream.
type() == BinaryStream::STREAM_TYPE::MEMORY;
82 result<const void*> read_at(uint64_t offset, uint64_t size, uint64_t va)
const override;
83 uintptr_t baseaddr_ = 0;
85 Binary* binary_ =
nullptr;
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:33
STREAM_TYPE type() const
Definition BinaryStream.hpp:53
Abstract binary that exposes an uniform API for the different executable file formats.
Definition Abstract/Binary.hpp:49
Definition MemoryStream.hpp:27
const uint8_t * end() const override
Definition MemoryStream.hpp:59
MemoryStream(uintptr_t base_address)
static bool classof(const BinaryStream &stream)
Definition MemoryStream.hpp:77
MemoryStream(const MemoryStream &)=delete
Binary * binary()
Definition MemoryStream.hpp:67
MemoryStream & operator=(const MemoryStream &)=delete
void binary(Binary &bin)
Definition MemoryStream.hpp:63
uint64_t size() const override
Definition MemoryStream.hpp:71
~MemoryStream() override=default
MemoryStream(MemoryStream &&) noexcept=default
const uint8_t * start() const override
Definition MemoryStream.hpp:55
const uint8_t * p() const override
Definition MemoryStream.hpp:51
MemoryStream(uintptr_t base_address, uint64_t size)
Definition MemoryStream.hpp:35
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41