blob: 6df3aa66563caaa9eecc3c6e7d3be7f223deda76 [file] [log] [blame]
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <optional>
#include <string>
#ifdef major
#undef major
#ifdef minor
#undef minor
// Represents a semantic version.
class Version {
Version(int major, int minor, int patch);
static std::optional<Version> FromString(std::string s);
int major() const { return major_; }
int minor() const { return minor_; }
int patch() const { return patch_; }
bool operator==(const Version& other) const;
bool operator<(const Version& other) const;
bool operator!=(const Version& other) const;
bool operator>=(const Version& other) const;
bool operator>(const Version& other) const;
bool operator<=(const Version& other) const;
std::string Describe() const;
int major_;
int minor_;
int patch_;