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-27
  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 _major, version_type _minor, version_type _patch);
  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 getMajor() const;
  24. version_type getMinor() const;
  25. version_type getPatch() const;
  26. static bool isValid(const std::string& _versionString);
  27. void setMajor(version_type _major);
  28. void setMinor(version_type _minor);
  29. void setPatch(version_type _patch);
  30. private:
  31. version_type major {};
  32. version_type minor {};
  33. version_type patch {};
  34. static bool _isValid(const std::string& _versionString);
  35. };
  36. }
  37. #endif