From 6fd8e5ee43dd0f87eb4e57b86e84770fcd95db25 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Thu, 17 Aug 2023 00:35:58 -0600 Subject: Added StormLib, nlohmann, BinaryTools and CLI11 --- lib/binarytools/BinaryWriter.h | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 lib/binarytools/BinaryWriter.h (limited to 'lib/binarytools/BinaryWriter.h') diff --git a/lib/binarytools/BinaryWriter.h b/lib/binarytools/BinaryWriter.h new file mode 100644 index 0000000..fbd4f65 --- /dev/null +++ b/lib/binarytools/BinaryWriter.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#include +#include +#include +#include "endianness.h" +#include "Stream.h" + +namespace LUS { +class BinaryWriter { + public: + BinaryWriter(); + BinaryWriter(Stream* nStream); + BinaryWriter(std::shared_ptr nStream); + + void SetEndianness(Endianness endianness); + + std::shared_ptr GetStream(); + uint64_t GetBaseAddress(); + uint64_t GetLength(); + void Seek(int32_t offset, SeekOffsetType seekType); + void Close(); + + void Write(int8_t value); + void Write(uint8_t value); + void Write(int16_t value); + void Write(uint16_t value); + void Write(int32_t value); + void Write(int32_t valueA, int32_t valueB); + void Write(uint32_t value); + void Write(int64_t value); + void Write(uint64_t value); + void Write(float value); + void Write(double value); + void Write(const std::string& str); + void Write(char* srcBuffer, size_t length); + + std::vector ToVector(); + + protected: + std::shared_ptr mStream; + Endianness mEndianness = Endianness::Native; +}; +} // namespace LUS -- cgit v1.2.3