Version.hpp 2.0 KB

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