16#ifndef LIEF_FILE_STREAM_H
17#define LIEF_FILE_STREAM_H
46 uint64_t
size()
const override {
58 ok_error_t peek_in(
void* dst, uint64_t offset, uint64_t
size)
const override {
59 if (offset > size_ || offset +
size > size_) {
62 const auto pos = ifs_.tellg();
64 ifs_.read(
static_cast<char*
>(dst),
size);
71 mutable std::ifstream ifs_;
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:34
STREAM_TYPE
Definition BinaryStream.hpp:38
size_t pos() const
Definition BinaryStream.hpp:125
STREAM_TYPE type() const
Definition BinaryStream.hpp:54
Stream interface over a std::ifstream.
Definition FileStream.hpp:28
static result< FileStream > from_file(const std::string &file)
FileStream(FileStream &&other) noexcept=default
FileStream(std::ifstream fs, uint64_t size)
Definition FileStream.hpp:31
std::vector< uint8_t > content() const
FileStream & operator=(FileStream &&other) noexcept=default
FileStream(const FileStream &)=delete
~FileStream() override=default
static bool classof(const BinaryStream &stream)
Definition FileStream.hpp:53
uint64_t size() const override
Definition FileStream.hpp:46
FileStream & operator=(const FileStream &)=delete
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
result< ok_t > ok_error_t
Opaque structure that is used by LIEF to avoid writing result<void> f(...). Instead,...
Definition errors.hpp:108
ok_t ok()
Return success for function with return type ok_error_t.
Definition errors.hpp:92
tl::expected< T, lief_errors > result
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:74