Version.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-27
  6. * Changed: 2021-04-23
  7. *
  8. * */
  9. #ifndef LS_STD_VERSION_HPP
  10. #define LS_STD_VERSION_HPP
  11. #include "Class.hpp"
  12. #include <ls_std/serialization/ISerializable.hpp>
  13. #include "Types.hpp"
  14. namespace ls_std
  15. {
  16. class Version : public ISerializable
  17. {
  18. public:
  19. explicit Version(ls_std::version_type _majorVersion, ls_std::version_type _minorVersion, ls_std::version_type _patchVersion);
  20. ~Version() = default;
  21. // implementation
  22. ls_std::byte_field marshal() override;
  23. void unmarshal(const ls_std::byte_field &_data) override;
  24. // other functionality
  25. ls_std::version_type getMajorVersion() const;
  26. ls_std::version_type getMinorVersion() const;
  27. ls_std::version_type getPatchVersion() const;
  28. static bool isValid(const std::string &_versionString);
  29. void setMajorVersion(ls_std::version_type _major);
  30. void setMinorVersion(ls_std::version_type _minor);
  31. void setPatchVersion(ls_std::version_type _patch);
  32. private:
  33. ls_std::version_type majorVersion{};
  34. ls_std::version_type minorVersion{};
  35. ls_std::version_type patchVersion{};
  36. static bool _isValid(const std::string &_versionString);
  37. };
  38. }
  39. #endif