Version.hpp 1.7 KB

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