Version.hpp 1.3 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-11-26
  7. *
  8. * */
  9. #ifndef LS_STD_VERSION_HPP
  10. #define LS_STD_VERSION_HPP
  11. #include "Class.hpp"
  12. #include <ls_std/serialization/ISerializable.hpp>
  13. #include "Types.hpp"
  14. namespace ls_std {
  15. class Version : public ISerializable {
  16. public:
  17. explicit Version(ls_std::version_type _majorVersion, ls_std::version_type _minorVersion, ls_std::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. ls_std::version_type getMajorVersion() const;
  24. ls_std::version_type getMinorVersion() const;
  25. ls_std::version_type getPatchVersion() const;
  26. static bool isValid(const std::string& _versionString);
  27. void setMajorVersion(ls_std::version_type _major);
  28. void setMinorVersion(ls_std::version_type _minor);
  29. void setPatchVersion(ls_std::version_type _patch);
  30. private:
  31. ls_std::version_type majorVersion {};
  32. ls_std::version_type minorVersion {};
  33. ls_std::version_type patchVersion {};
  34. static bool _isValid(const std::string& _versionString);
  35. };
  36. }
  37. #endif