7 #ifndef _FCITX_UTILS_SEMVER_H_ 8 #define _FCITX_UTILS_SEMVER_H_ 13 #include <string_view> 16 #include <fcitx-utils/fcitxutils_export.h> 18 #include <fcitx-utils/macros.h> 27 FCITX_INLINE_DEFINE_DEFAULT_DTOR_COPY_AND_MOVE(
PreReleaseId);
29 std::string toString()
const;
31 bool isNumeric()
const noexcept;
32 uint32_t numericId()
const noexcept;
33 const std::string &id()
const noexcept;
38 std::variant<std::string, uint32_t> value_;
51 static std::optional<SemanticVersion> parse(std::string_view data);
53 std::string toString()
const;
55 FCITX_DECLARE_PROPERTY(uint32_t, (major), setMajor);
56 FCITX_DECLARE_PROPERTY(uint32_t, (minor), setMinor);
57 FCITX_DECLARE_PROPERTY(uint32_t, patch, setPatch);
58 FCITX_DECLARE_PROPERTY(std::vector<PreReleaseId>, preReleaseIds,
60 FCITX_DECLARE_PROPERTY(std::vector<std::string>, buildIds, setBuildIds);
61 bool isPreRelease()
const;
69 std::vector<PreReleaseId> preReleaseIds_;
70 std::vector<std::string> buildIds_;
75 return lhs.compare(rhs) < 0;
85 return lhs.compare(rhs) == 0;
105 return lhs.compare(rhs) < 0;
115 return lhs.compare(rhs) == 0;
120 return !(lhs == rhs);
135 builder <<
"SemanticVersion(" << version.toString() <<
")";
141 #endif // _FCITX_UTILS_SEMVER_H_
Provide a Semantic version 2.0 implementation.