.
This commit is contained in:
@@ -10,17 +10,23 @@ namespace tyche {
|
||||
|
||||
class ByteArray {
|
||||
public:
|
||||
ByteArray() = default;
|
||||
explicit ByteArray(std::vector<uint8_t> data) : data_(std::move(data)) {}
|
||||
|
||||
void add_byte(uint32_t addr, uint8_t byte);
|
||||
void add_uint32(uint32_t addr, uint32_t value);
|
||||
void add_int(uint32_t addr, int32_t value);
|
||||
void add_float(uint32_t addr, float value);
|
||||
void add_string(uint32_t addr, std::string const& str);
|
||||
|
||||
void append_byte(uint32_t addr, uint8_t byte) { add_byte(data_.size(), byte); }
|
||||
void append_uint32(uint32_t addr, uint32_t value) { add_uint32(data_.size(), value); }
|
||||
void append_int(uint32_t addr, int32_t value) { add_int(data_.size(), value); }
|
||||
void append_float(uint32_t addr, float value) { add_float(data_.size(), value); }
|
||||
void append_string(uint32_t addr, std::string const& str) { add_string(data_.size(), str); }
|
||||
|
||||
[[nodiscard]] uint8_t get_byte(uint32_t addr) const;
|
||||
[[nodiscard]] uint32_t get_uint32(uint32_t addr) const;
|
||||
[[nodiscard]] std::pair<int32_t, size_t> get_int(uint32_t addr) const;
|
||||
[[nodiscard]] std::pair<float, size_t> get_float(uint32_t addr) const;
|
||||
[[nodiscard]] std::pair<std::string, size_t> get_string(uint32_t addr) const;
|
||||
|
||||
Reference in New Issue
Block a user