16#ifndef VECTOR_BINARY_STREAM_H
17#define VECTOR_BINARY_STREAM_H
35 binary_(std::move(data)),
48 uint64_t
size()
const override {
52 const std::vector<uint8_t>&
content()
const {
58 return std::move(binary_);
61 const uint8_t*
p()
const override {
62 return this->binary_.data() + this->
pos();
65 const uint8_t*
start()
const override {
66 return this->binary_.data();
69 const uint8_t*
end()
const override {
71 return this->binary_.data() + this->binary_.size();
80 const uint64_t stream_size = this->
size();
81 if (offset > stream_size || (offset +
size) > stream_size) {
84 return binary_.data() + offset;
86 std::vector<uint8_t> binary_;
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:34
STREAM_TYPE
Definition BinaryStream.hpp:38
virtual const uint8_t * p() const
Definition BinaryStream.hpp:199
size_t pos() const
Definition BinaryStream.hpp:125
virtual uint8_t * start()
Definition BinaryStream.hpp:203
STREAM_TYPE type() const
Definition BinaryStream.hpp:54
virtual uint8_t * end()
Definition BinaryStream.hpp:211
Definition VectorStream.hpp:26
VectorStream(VectorStream &&other) noexcept=default
std::vector< uint8_t > && move_content()
Definition VectorStream.hpp:56
static bool classof(const BinaryStream &stream)
Definition VectorStream.hpp:74
static result< VectorStream > from_file(const std::string &file)
VectorStream(const VectorStream &)=delete
const uint8_t * p() const override
Definition VectorStream.hpp:61
VectorStream & operator=(const VectorStream &)=delete
uint64_t size() const override
Definition VectorStream.hpp:48
const std::vector< uint8_t > & content() const
Definition VectorStream.hpp:52
VectorStream & operator=(VectorStream &&other) noexcept=default
const uint8_t * start() const override
Definition VectorStream.hpp:65
const uint8_t * end() const override
Definition VectorStream.hpp:69
VectorStream(std::vector< uint8_t > data)
Definition VectorStream.hpp:33
tl::unexpected< lief_errors > make_error_code(lief_errors e)
Create an standard error code from lief_errors.
Definition errors.hpp:51
LIEF namespace.
Definition Abstract/Binary.hpp:32
tl::expected< T, lief_errors > result
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:74