5
#include "base/basictypes.h"
10
// Parses version strings of the format "Major.Minor.Sub" and lets you interact with them conveniently.
12
Version() : major(0), minor(0), sub(0) {}
13
Version(const std::string &str) {
14
if (!ParseVersionString(str)) {
25
bool IsValid() const {
26
return sub >= 0 && minor >= 0 && major >= 0;
29
bool operator == (const Version &other) const {
30
return major == other.major && minor == other.minor && sub == other.sub;
32
bool operator != (const Version &other) const {
33
return !(*this == other);
36
bool operator <(const Version &other) const {
37
if (major < other.major) return true;
38
if (major > other.major) return false;
39
if (minor < other.minor) return true;
40
if (minor > other.minor) return false;
41
if (sub < other.sub) return true;
42
if (sub > other.sub) return false;
46
bool operator >=(const Version &other) const {
47
return !(*this < other);
50
std::string ToString() const;
51
int ToInteger() const;
53
bool ParseVersionString(std::string str);
56
bool ParseMacAddress(std::string str, uint8_t macAddr[6]);
b'\\ No newline at end of file'