2022-03-21 21:54:48 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2022-07-27 17:50:56 -04:00
|
|
|
#include "BitConverter.h"
|
2022-03-21 21:54:48 -04:00
|
|
|
#include "Stream.h"
|
|
|
|
|
|
|
|
class BinaryWriter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
BinaryWriter(Stream* nStream);
|
|
|
|
BinaryWriter(std::shared_ptr<Stream> nStream);
|
|
|
|
|
2022-07-27 17:50:56 -04:00
|
|
|
void SetEndianness(Endianness endianness);
|
|
|
|
|
2022-03-21 21:54:48 -04:00
|
|
|
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);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::shared_ptr<Stream> stream;
|
2022-07-27 17:50:56 -04:00
|
|
|
Endianness endianness = Endianness::Native;
|
2022-03-21 21:54:48 -04:00
|
|
|
};
|