diff --git a/libsrc/core/CMakeLists.txt b/libsrc/core/CMakeLists.txt index 9de7701f..e7fe7240 100644 --- a/libsrc/core/CMakeLists.txt +++ b/libsrc/core/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(ngcore SHARED archive.cpp version.cpp) +add_library(ngcore SHARED archive.cpp) target_compile_definitions(ngcore PRIVATE -DNGCORE_EXPORTS) diff --git a/libsrc/core/archive.hpp b/libsrc/core/archive.hpp index 620941c9..1d3809b7 100644 --- a/libsrc/core/archive.hpp +++ b/libsrc/core/archive.hpp @@ -142,6 +142,18 @@ namespace ngcore virtual Archive & operator & (std::string & str) = 0; virtual Archive & operator & (char *& str) = 0; + virtual Archive & operator & (VersionInfo & version) + { + if(Output()) + (*this) << version.to_string(); + else + { + std::string s; + (*this) & s; + version = VersionInfo(s); + } + return *this; + } // Archive std classes ================================================ template @@ -182,7 +194,7 @@ namespace ngcore } else { - size_t size; + size_t size = 0; (*this) & size; T1 key; T2 val; for(size_t i = 0; i < size; i++) diff --git a/libsrc/core/version.cpp b/libsrc/core/version.cpp deleted file mode 100644 index 7f6bac69..00000000 --- a/libsrc/core/version.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -#include "archive.hpp" -#include "version.hpp" - -namespace ngcore -{ - void VersionInfo :: DoArchive(Archive& ar) - { - ar & mayor_ & minor_ & release & patch & git_hash; - } -} // namespace ngcore diff --git a/libsrc/core/version.hpp b/libsrc/core/version.hpp index ab14d74a..69598716 100644 --- a/libsrc/core/version.hpp +++ b/libsrc/core/version.hpp @@ -8,7 +8,6 @@ namespace ngcore { - class Archive; class VersionInfo { private: @@ -83,8 +82,6 @@ namespace ngcore bool operator >(const VersionInfo& other) const { return other < (*this); } bool operator <=(const VersionInfo& other) const { return !((*this) > other); } bool operator >=(const VersionInfo& other) const { return !((*this) < other); } - - void DoArchive(Archive& ar); }; } // namespace ngcore