clean seafile api
This commit is contained in:
1 parent
133424f5f8
commit
3e4694ceb5
14 files changed
+476
-290
No files matched your search
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Created by Shell on 2026/7/21.
|
||||
//
|
||||
|
||||
#ifndef SEADISK_VERSION_HPP
|
||||
#define SEADISK_VERSION_HPP
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
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<int> minor() const noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
std::optional<int> 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<int> minor_;
|
||||
std::optional<int> patch_;
|
||||
};
|
||||
|
||||
}
|
||||
#endif //SEADISK_VERSION_HPP
|
||||
Reference in new issue
Block a user