SIEdit/lib/interleaf.h

65 lines
1.4 KiB
C
Raw Normal View History

2022-07-11 00:16:20 -04:00
#ifndef INTERLEAF_H
#define INTERLEAF_H
2022-07-17 21:51:16 -04:00
#include <fstream>
2022-07-11 00:16:20 -04:00
#include "core.h"
2022-07-18 03:27:00 -04:00
#include "info.h"
#include "object.h"
2022-07-11 00:16:20 -04:00
namespace si {
class Interleaf : public Core
{
public:
2022-07-18 03:27:00 -04:00
enum Error
{
ERROR_SUCCESS,
ERROR_IO,
ERROR_INVALID_INPUT,
ERROR_INVALID_BUFFER_SIZE
};
2022-07-11 00:16:20 -04:00
LIBWEAVER_EXPORT Interleaf();
2022-07-17 21:51:16 -04:00
LIBWEAVER_EXPORT void Clear();
2022-07-18 03:27:00 -04:00
LIBWEAVER_EXPORT Error Read(const char *f);
LIBWEAVER_EXPORT Error Write(const char *f) const;
#ifdef _WIN32
LIBWEAVER_EXPORT Error Read(const wchar_t *f);
LIBWEAVER_EXPORT Error Write(const wchar_t *f) const;
#endif
Error Read(std::istream &is);
Error Write(std::ostream &os) const;
2022-07-17 21:51:16 -04:00
2022-07-18 03:27:00 -04:00
Info *GetInformation() { return &m_Info; }
2022-07-11 00:16:20 -04:00
private:
2022-07-17 21:51:16 -04:00
2022-07-18 03:27:00 -04:00
Error ReadChunk(Core *parent, std::istream &is, Info *info);
2022-07-17 21:51:16 -04:00
2022-07-18 03:27:00 -04:00
Object *ReadObject(std::istream &is, Object *o, std::stringstream &desc);
void WriteObject(std::ostream &os, const Object *o) const;
void InterleaveObjects(std::ostream &os, const std::vector<Object*> &objects) const;
void WriteSubChunk(std::ostream &os, uint16_t flags, uint32_t object, uint32_t time, const bytearray &data = bytearray()) const;
void WritePadding(std::ostream &os, uint32_t size) const;
Info m_Info;
2022-07-17 21:51:16 -04:00
uint32_t m_Version;
uint32_t m_BufferSize;
uint32_t m_BufferCount;
2022-07-18 03:27:00 -04:00
std::vector<uint32_t> m_ObjectList;
std::map<uint32_t, Object*> m_ObjectIDTable;
2022-07-11 00:16:20 -04:00
};
}
#endif // INTERLEAF_H