Remove version.cpp

This commit is contained in:
Matthias Hochsteger 2018-12-12 17:18:52 +01:00
parent 5a9e913172
commit 835b2703f4
4 changed files with 14 additions and 16 deletions

View File

@ -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) target_compile_definitions(ngcore PRIVATE -DNGCORE_EXPORTS)

View File

@ -142,6 +142,18 @@ namespace ngcore
virtual Archive & operator & (std::string & str) = 0; virtual Archive & operator & (std::string & str) = 0;
virtual Archive & operator & (char *& 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 ================================================ // Archive std classes ================================================
template<typename T> template<typename T>
@ -182,7 +194,7 @@ namespace ngcore
} }
else else
{ {
size_t size; size_t size = 0;
(*this) & size; (*this) & size;
T1 key; T2 val; T1 key; T2 val;
for(size_t i = 0; i < size; i++) for(size_t i = 0; i < size; i++)

View File

@ -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

View File

@ -8,7 +8,6 @@
namespace ngcore namespace ngcore
{ {
class Archive;
class VersionInfo class VersionInfo
{ {
private: private:
@ -83,8 +82,6 @@ namespace ngcore
bool operator >(const VersionInfo& other) const { return other < (*this); } 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); }
bool operator >=(const VersionInfo& other) const { return !((*this) < other); } bool operator >=(const VersionInfo& other) const { return !((*this) < other); }
void DoArchive(Archive& ar);
}; };
} // namespace ngcore } // namespace ngcore