Version.hpp 1.7 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: 2022-05-19
  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. namespace ls
  15. {
  16. namespace std
  17. {
  18. namespace core
  19. {
  20. class Version : public ls::std::core::interface_type::ISerializable
  21. {
  22. public:
  23. explicit Version(ls::std::core::type::version_type _majorVersion, ls::std::core::type::version_type _minorVersion, ls::std::core::type::version_type _patchVersion);
  24. ~Version() = default;
  25. // implementation
  26. ls::std::core::type::byte_field marshal() override;
  27. void unmarshal(const ls::std::core::type::byte_field &_data) override;
  28. // other functionality
  29. ls::std::core::type::version_type getMajorVersion() const;
  30. ls::std::core::type::version_type getMinorVersion() const;
  31. ls::std::core::type::version_type getPatchVersion() const;
  32. static bool isValid(const ::std::string &_versionString);
  33. void setMajorVersion(ls::std::core::type::version_type _major);
  34. void setMinorVersion(ls::std::core::type::version_type _minor);
  35. void setPatchVersion(ls::std::core::type::version_type _patch);
  36. private:
  37. ls::std::core::type::version_type majorVersion{};
  38. ls::std::core::type::version_type minorVersion{};
  39. ls::std::core::type::version_type patchVersion{};
  40. static bool _isValid(const ::std::string &_versionString);
  41. };
  42. }
  43. }
  44. }
  45. #endif