Source · fairmq/tools/
Version.hpublic header
Defines struct fair::mq::tools::Version.
1/********************************************************************************2 * Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *3 * *4 * This software is distributed under the terms of the *5 * GNU Lesser General Public Licence (LGPL) version 3, *6 * copied verbatim in the file "LICENSE" *7 ********************************************************************************/8 9#ifndef FAIR_MQ_TOOLS_VERSION_H10#define FAIR_MQ_TOOLS_VERSION_H11 12#include <ostream>13#include <tuple>14 15namespace fair::mq::tools16{17 18struct Version19{20 const int fkMajor, fkMinor, fkPatch;21 22 friend auto operator< (const Version& lhs, const Version& rhs) -> bool { return std::tie(lhs.fkMajor, lhs.fkMinor, lhs.fkPatch) < std::tie(rhs.fkMajor, rhs.fkMinor, rhs.fkPatch); }23 friend auto operator> (const Version& lhs, const Version& rhs) -> bool { return rhs < lhs; }24 friend auto operator<=(const Version& lhs, const Version& rhs) -> bool { return !(lhs > rhs); }25 friend auto operator>=(const Version& lhs, const Version& rhs) -> bool { return !(lhs < rhs); }26 friend auto operator==(const Version& lhs, const Version& rhs) -> bool { return std::tie(lhs.fkMajor, lhs.fkMinor, lhs.fkPatch) == std::tie(rhs.fkMajor, rhs.fkMinor, rhs.fkPatch); }27 friend auto operator!=(const Version& lhs, const Version& rhs) -> bool { return !(lhs == rhs); }28 friend auto operator<<(std::ostream& os, const Version& v) -> std::ostream& { return os << v.fkMajor << "." << v.fkMinor << "." << v.fkPatch; }29};30 31} // namespace fair::mq::tools32 33#endif /* FAIR_MQ_TOOLS_VERSION_H */