1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Reorganized types registration code

This commit is contained in:
Ivan Savenko
2023-11-11 00:39:08 +02:00
parent 4a7fa9bf8c
commit 5c810df36f
32 changed files with 681 additions and 881 deletions

View File

@@ -115,11 +115,7 @@ public:
bool smartPointerSerialization;
bool saving;
BinarySerializer(IBinaryWriter * w): CSaverBase(w)
{
saving=true;
smartPointerSerialization = true;
}
BinarySerializer(IBinaryWriter * w);
template<typename Base, typename Derived>
void registerType(const Base * b = nullptr, const Derived * d = nullptr)
@@ -404,30 +400,4 @@ public:
}
};
class DLL_LINKAGE CSaveFile : public IBinaryWriter
{
public:
BinarySerializer serializer;
boost::filesystem::path fName;
std::unique_ptr<std::fstream> sfile;
CSaveFile(const boost::filesystem::path &fname); //throws!
~CSaveFile();
int write(const void * data, unsigned size) override;
void openNextFile(const boost::filesystem::path &fname); //throws!
void clear();
void reportState(vstd::CLoggerBase * out) override;
void putMagicBytes(const std::string &text);
template<class T>
CSaveFile & operator<<(const T &t)
{
serializer & t;
return * this;
}
};
VCMI_LIB_NAMESPACE_END