Version.hpp 1.5 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: 2024-05-31
  7. *
  8. * */
  9. #ifndef LS_STD_VERSION_HPP
  10. #define LS_STD_VERSION_HPP
  11. #include <ls-std/core/definition.hpp>
  12. #include <ls-std/core/interface/ISerializable.hpp>
  13. #include <ls-std/core/type/Types.hpp>
  14. #include <string_view>
  15. namespace ls::std::core
  16. {
  17. ls_std_class Version final : public interface_type::ISerializable
  18. {
  19. public:
  20. explicit Version(type::version_type _majorVersion, type::version_type _minorVersion, type::version_type _patchVersion);
  21. ~Version() noexcept override;
  22. // implementation
  23. [[nodiscard]] type::byte_field marshal() override;
  24. void unmarshal(const type::byte_field &_data) override;
  25. // other functionality
  26. [[nodiscard]] type::version_type getMajorVersion() const;
  27. [[nodiscard]] type::version_type getMinorVersion() const;
  28. [[nodiscard]] type::version_type getPatchVersion() const;
  29. [[nodiscard]] static bool isValid(const ::std::string &_versionString);
  30. void setMajorVersion(type::version_type _major);
  31. void setMinorVersion(type::version_type _minor);
  32. void setPatchVersion(type::version_type _patch);
  33. private:
  34. type::version_type majorVersion{};
  35. type::version_type minorVersion{};
  36. type::version_type patchVersion{};
  37. [[nodiscard]] static bool _isValid(::std::string_view _versionString);
  38. };
  39. }
  40. #endif