From bf43884b539980d0de639ab5ec39afd13d48af91 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 20 Aug 2023 23:46:36 -0400 Subject: [PATCH] Add string::Version::getMajor(), getMinor(), and getRevision(). --- include/string.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/string.hpp b/include/string.hpp index db9870bc..7126b814 100644 --- a/include/string.hpp +++ b/include/string.hpp @@ -118,6 +118,16 @@ struct Version { operator std::string() const; /** Returns whether this version is earlier than `other`. */ bool operator<(const Version& other); + + std::string getMajor() const { + return get(parts, 0, ""); + } + std::string getMinor() const { + return get(parts, 1, ""); + } + std::string getRevision() const { + return get(parts, 2, ""); + } };