// // Created by Shell on 2026/7/21. // #ifndef SEADISK_VERSION_HPP #define SEADISK_VERSION_HPP #include #include namespace seafile::util { /** * @brief Semantic version parser. * * Supports: * 10 * 10.0 * 10.0.2 */ class Version final { public: Version() = default; explicit Version(const std::string& version); [[nodiscard]] int major() const noexcept; [[nodiscard]] std::optional minor() const noexcept; [[nodiscard]] std::optional patch() const noexcept; [[nodiscard]] std::string toString() const; bool operator==(const Version& other) const; bool operator<(const Version& other) const; private: void parse(const std::string& version); private: int major_{0}; std::optional minor_; std::optional patch_; }; } #endif //SEADISK_VERSION_HPP