2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
15 /* \brief Addon versioning using the debian versioning scheme
17 CAddonVersion uses debian versioning, which means in the each section of the period
18 separated version string, numbers are compared numerically rather than lexicographically,
19 thus any preceding zeros are ignored.
21 i.e. 1.00 is considered the same as 1.0, and 1.01 is considered the same as 1.1.
25 See here for more info: http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
30 explicit CAddonVersion(const char* version
= nullptr);
31 explicit CAddonVersion(const std::string
& version
);
33 CAddonVersion(const CAddonVersion
& other
) = default;
34 CAddonVersion(CAddonVersion
&& other
) = default;
35 CAddonVersion
& operator=(const CAddonVersion
& other
) = default;
36 CAddonVersion
& operator=(CAddonVersion
&& other
) = default;
38 virtual ~CAddonVersion() = default;
40 int Epoch() const { return mEpoch
; }
41 const std::string
& Upstream() const { return mUpstream
; }
42 const std::string
& Revision() const { return mRevision
; }
44 bool operator<(const CAddonVersion
& other
) const;
45 bool operator>(const CAddonVersion
& other
) const;
46 bool operator<=(const CAddonVersion
& other
) const;
47 bool operator>=(const CAddonVersion
& other
) const;
48 bool operator==(const CAddonVersion
& other
) const;
49 bool operator!=(const CAddonVersion
& other
) const;
50 std::string
asString() const;
53 static bool SplitFileName(std::string
& ID
, std::string
& version
, const std::string
& filename
);
57 std::string mUpstream
;
58 std::string mRevision
;
60 static int CompareComponent(const char* a
, const char* b
);