Version.hpp 1.8 KB

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