Version.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-27
  6. * Changed: 2020-09-29
  7. *
  8. * */
  9. #ifndef LS_STD_VERSION_HPP
  10. #define LS_STD_VERSION_HPP
  11. #include "Class.hpp"
  12. #include "../serialization/ISerializable.hpp"
  13. #include "../base/Types.hpp"
  14. namespace ls_std {
  15. class Version : public ISerializable {
  16. public:
  17. explicit Version(version_type _majorVersion, version_type _minorVersion, version_type _patchVersion);
  18. ~Version() = default;
  19. // implementation
  20. ls_std::byte_field marshal() override;
  21. void unmarshal(const ls_std::byte_field& _data) override;
  22. // other functionality
  23. version_type getMajorVersion() const;
  24. version_type getMinorVersion() const;
  25. version_type getPatchVersion() const;
  26. static bool isValid(const std::string& _versionString);
  27. void setMajorVersion(version_type _major);
  28. void setMinorVersion(version_type _minor);
  29. void setPatchVersion(version_type _patch);
  30. private:
  31. version_type majorVersion {};
  32. version_type minorVersion {};
  33. version_type patchVersion {};
  34. static bool _isValid(const std::string& _versionString);
  35. };
  36. }
  37. #endif