aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include/VersionT.cpp
blob: 6ea5d3810f7b169d4651fc8a2d0efa6e3d39fde6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "pch.h"
#include "VersionT.h"
#include "vcpkg_Strings.h"

namespace vcpkg
{
    VersionT::VersionT() : value("0.0.0") {}
    VersionT::VersionT(const std::string& value) : value(value) {}
    std::string VersionT::to_string() const { return value; }
    bool operator==(const VersionT& left, const VersionT& right) { return left.value == right.value; }
    bool operator!=(const VersionT& left, const VersionT& right) { return left.value != right.value; }
    std::string to_printf_arg(const VersionT& version) { return version.value; }

    VersionDiff::VersionDiff() : left(), right() {}
    VersionDiff::VersionDiff(const VersionT& left, const VersionT& right) : left(left), right(right) {}

    std::string VersionDiff::to_string() const
    {
        return Strings::format("%s -> %s", left.value, right.value);
    }
}