|
|
@ -82,17 +82,23 @@ class ESMWriter
|
|
|
|
endRecord(name);
|
|
|
|
endRecord(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
template<typename T, std::size_t size>
|
|
|
|
|
|
|
|
void writeHNT(const std::string& name, const T (&data)[size])
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
startSubRecord(name);
|
|
|
|
|
|
|
|
writeT(data);
|
|
|
|
|
|
|
|
endRecord(name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Prevent using writeHNT with strings. This already happened by accident and results in
|
|
|
|
// Prevent using writeHNT with strings. This already happened by accident and results in
|
|
|
|
// state being discarded without any error on writing or reading it. :(
|
|
|
|
// state being discarded without any error on writing or reading it. :(
|
|
|
|
// writeHNString and friends must be used instead.
|
|
|
|
// writeHNString and friends must be used instead.
|
|
|
|
void writeHNT(const std::string& name, const std::string& data)
|
|
|
|
void writeHNT(const std::string& name, const std::string& data) = delete;
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
void writeT(const std::string& data) = delete;
|
|
|
|
void writeT(const std::string& data)
|
|
|
|
|
|
|
|
{
|
|
|
|
template<typename T, std::size_t size>
|
|
|
|
}
|
|
|
|
void writeHNT(const std::string& name, const T (&data)[size], int) = delete;
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
template<typename T>
|
|
|
|
void writeHNT(const std::string& name, const T& data, int size)
|
|
|
|
void writeHNT(const std::string& name, const T& data, int size)
|
|
|
@ -108,6 +114,12 @@ public:
|
|
|
|
write((char*)&data, sizeof(T));
|
|
|
|
write((char*)&data, sizeof(T));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T, std::size_t size>
|
|
|
|
|
|
|
|
void writeT(const T (&data)[size])
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
write(reinterpret_cast<const char*>(data), size * sizeof(T));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
template<typename T>
|
|
|
|
void writeT(const T& data, size_t size)
|
|
|
|
void writeT(const T& data, size_t size)
|
|
|
|
{
|
|
|
|
{
|
|
|
|