Version.hpp 1.7 KB

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