2 * Copyright (C) 2016 Thomas Voss <thomas.voss.bochum@gmail.com>
3 * Simon Fels <morphis@gravedo.de>
5 * This program is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 3, as published
7 * by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranties of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef ANBOX_COMMON_BINARY_WRITER_H_
20 #define ANBOX_COMMON_BINARY_WRITER_H_
35 explicit BinaryWriter(std::vector<std::uint8_t>::iterator begin_,
36 std::vector<std::uint8_t>::iterator end_);
38 void set_byte_order(Order order);
40 void write_uint16(std::uint16_t value);
41 void write_uint32(std::uint32_t value);
42 void write_string(const char *s, std::size_t size);
43 void write_string_with_size(const std::string &str);
44 void write_string_with_size(const char *s, std::size_t size);
46 std::size_t bytes_written() const;
49 std::vector<std::uint8_t>::iterator begin_;
50 std::vector<std::uint8_t>::iterator current_;
51 std::vector<std::uint8_t>::iterator end_;