CModVersion.h 836 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * CModVersion.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. VCMI_LIB_NAMESPACE_BEGIN
  12. struct DLL_LINKAGE CModVersion
  13. {
  14. int major = 0;
  15. int minor = 0;
  16. int patch = 0;
  17. CModVersion() = default;
  18. CModVersion(int mj, int mi, int p): major(mj), minor(mi), patch(p) {}
  19. static CModVersion GameVersion();
  20. static CModVersion fromString(std::string from);
  21. std::string toString() const;
  22. bool compatible(const CModVersion & other, bool checkMinor = false, bool checkPatch = false) const;
  23. bool isNull() const;
  24. template <typename Handler> void serialize(Handler &h, const int version)
  25. {
  26. h & major;
  27. h & minor;
  28. h & patch;
  29. }
  30. };
  31. VCMI_LIB_NAMESPACE_END