Version.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-27
  6. * Changed: 2022-06-29
  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/types/Types.hpp>
  14. #include <ls_std/os/dynamic_goal.hpp>
  15. namespace ls
  16. {
  17. namespace std
  18. {
  19. namespace core
  20. {
  21. class 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() = default;
  26. // implementation
  27. ls::std::core::type::byte_field marshal() override;
  28. void unmarshal(const ls::std::core::type::byte_field &_data) override;
  29. // other functionality
  30. ls::std::core::type::version_type getMajorVersion() const;
  31. ls::std::core::type::version_type getMinorVersion() const;
  32. ls::std::core::type::version_type getPatchVersion() const;
  33. 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. static bool _isValid(const ::std::string &_versionString);
  42. };
  43. }
  44. }
  45. }
  46. #endif