summaryrefslogtreecommitdiff
path: root/lib/binarytools/BinaryWriter.h
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2023-08-17 00:35:58 -0600
committerKiritoDv <kiritodev01@gmail.com>2023-08-17 00:35:58 -0600
commit6fd8e5ee43dd0f87eb4e57b86e84770fcd95db25 (patch)
tree6a22e06c6105b63a0ae560f571f6d4e2522ba364 /lib/binarytools/BinaryWriter.h
Added StormLib, nlohmann, BinaryTools and CLI11
Diffstat (limited to 'lib/binarytools/BinaryWriter.h')
-rw-r--r--lib/binarytools/BinaryWriter.h45
1 files changed, 45 insertions, 0 deletions
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 <array>
+#include <memory>
+#include <string>
+#include <vector>
+#include "endianness.h"
+#include "Stream.h"
+
+namespace LUS {
+class BinaryWriter {
+ public:
+ BinaryWriter();
+ BinaryWriter(Stream* nStream);
+ BinaryWriter(std::shared_ptr<Stream> nStream);
+
+ void SetEndianness(Endianness endianness);
+
+ std::shared_ptr<Stream> 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<char> ToVector();
+
+ protected:
+ std::shared_ptr<Stream> mStream;
+ Endianness mEndianness = Endianness::Native;
+};
+} // namespace LUS