[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / addons / AddonVersion.h
blob78537a551a947e57826a23f89639dc06aec466a2
1 /*
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.
7 */
9 #pragma once
11 #include <string>
13 namespace ADDON
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.
23 Further, 1.0 < 1.0.0
25 See here for more info: http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
27 class CAddonVersion
29 public:
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;
51 bool empty() const;
53 static bool SplitFileName(std::string& ID, std::string& version, const std::string& filename);
55 protected:
56 int mEpoch;
57 std::string mUpstream;
58 std::string mRevision;
60 static int CompareComponent(const char* a, const char* b);
62 } // namespace ADDON