37 endian_swap_(endian_swap)
46 return write(sp.data(), sp.size());
52 raw_.insert(std::end(raw_), count, value);
53 current_pos_ += count;
57 const uint64_t stack_val = value;
58 return write(
reinterpret_cast<const uint8_t*
>(&stack_val),
size);
64 template<class T, typename = typename std::enable_if<std::is_standard_layout<T>::value && std::is_trivial<T>::value>::type>
66 const auto pos =
static_cast<size_t>(
tellp());
67 if (raw_.size() < (pos +
sizeof(T))) {
68 raw_.resize(pos +
sizeof(T));
70 memcpy(raw_.data() + pos, &t,
sizeof(T));
71 current_pos_ +=
sizeof(T);
83 template<
typename T,
size_t size>
85 static_assert(std::numeric_limits<T>::is_integer,
"Requires integer type");
95 for (
const T& e : elements) {
133 const std::vector<uint8_t>&
raw()
const {
137 std::vector<uint8_t>&
raw() {
147 std::vector<uint8_t> raw_;
148 bool endian_swap_ =
false;
154 const uint8_t *ptr =
nullptr;
158 ptr =
reinterpret_cast<const uint8_t*
>(&tmp);
160 ptr =
reinterpret_cast<const uint8_t*
>(&t);
162 write(ptr,
sizeof(T));
168 for (
const T& i: v) {
169 const uint8_t* ptr =
nullptr;
173 ptr =
reinterpret_cast<const uint8_t*
>(&tmp);
175 ptr =
reinterpret_cast<const uint8_t*
>(&i);
177 write(ptr,
sizeof(T));
Definition iostream.hpp:29
std::vector< uint8_t > & raw()
Definition iostream.hpp:137
static size_t sleb128_size(int64_t value)
vector_iostream & flush()
Definition iostream.hpp:113
vector_iostream & seekp(vector_iostream::off_type p, std::ios_base::seekdir dir)
const std::vector< uint8_t > & raw() const
Definition iostream.hpp:133
vector_iostream & write(const std::array< T, size > &t)
Definition iostream.hpp:84
vector_iostream & write_conv(const T &t)
Definition iostream.hpp:153
size_t size() const
Definition iostream.hpp:117
vector_iostream & put(uint8_t c)
vector_iostream & write_uleb128(uint64_t value)
vector_iostream & write(const uint8_t *s, std::streamsize n)
vector_iostream & seekp(pos_type p)
Definition iostream.hpp:126
void reserve(size_t size)
Definition iostream.hpp:39
vector_iostream & move(std::vector< uint8_t > &c)
Definition iostream.hpp:108
vector_iostream & write_sized_int(uint64_t value, size_t size)
Definition iostream.hpp:56
vector_iostream & write(const std::string &s)
std::streampos pos_type
Definition iostream.hpp:33
vector_iostream & write_conv_array(const std::vector< T > &v)
Definition iostream.hpp:167
vector_iostream()=default
pos_type tellp() const
Definition iostream.hpp:122
vector_iostream & write(const vector_iostream &other)
Definition iostream.hpp:60
vector_iostream & write(span< const uint8_t > sp)
Definition iostream.hpp:45
vector_iostream & align(size_t alignment, uint8_t fill=0)
void set_endian_swap(bool swap)
Definition iostream.hpp:141
vector_iostream & write(std::vector< uint8_t > s)
vector_iostream & write(const T &t)
Definition iostream.hpp:65
static size_t uleb128_size(uint64_t value)
std::streamoff off_type
Definition iostream.hpp:34
vector_iostream & write(const std::vector< T > &elements)
Definition iostream.hpp:94
vector_iostream & write_sleb128(int64_t value)
vector_iostream & write(size_t count, uint8_t value)
Definition iostream.hpp:51
vector_iostream(bool endian_swap)
Definition iostream.hpp:36
vector_iostream & get(std::vector< uint8_t > &c)
Definition iostream.hpp:104
LIEF namespace.
Definition Abstract/Binary.hpp:32
tcb::span< ElementType, Extent > span
Definition span.hpp:22