CModVersion.h 989 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #ifdef __UCLIBC__
  12. #undef major
  13. #undef minor
  14. #undef patch
  15. #endif
  16. VCMI_LIB_NAMESPACE_BEGIN
  17. struct DLL_LINKAGE CModVersion
  18. {
  19. int major = 0;
  20. int minor = 0;
  21. int patch = 0;
  22. CModVersion() = default;
  23. CModVersion(int mj, int mi, int p): major(mj), minor(mi), patch(p) {}
  24. static CModVersion GameVersion();
  25. static CModVersion fromString(std::string from);
  26. std::string toString() const;
  27. bool compatible(const CModVersion & other, bool checkMinor = false, bool checkPatch = false) const;
  28. bool isNull() const;
  29. template <typename Handler> void serialize(Handler &h, const int version)
  30. {
  31. h & major;
  32. h & minor;
  33. h & patch;
  34. }
  35. };
  36. DLL_LINKAGE bool operator < (const CModVersion & lesser, const CModVersion & greater);
  37. VCMI_LIB_NAMESPACE_END