TagLib API Documentation
tversionnumber.h
Go to the documentation of this file.
1/***************************************************************************
2 copyright : (C) 2020 by Kevin Andre
3 email : hyperquantum@gmail.com
4
5 copyright : (C) 2023 by Urs Fleisch
6 email : ufleisch@users.sourceforge.net
7 ***************************************************************************/
8
9/***************************************************************************
10 * This library is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU Lesser General Public License version *
12 * 2.1 as published by the Free Software Foundation. *
13 * *
14 * This library is distributed in the hope that it will be useful, but *
15 * WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
17 * Lesser General Public License for more details. *
18 * *
19 * You should have received a copy of the GNU Lesser General Public *
20 * License along with this library; if not, write to the Free Software *
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
22 * 02110-1301 USA *
23 * *
24 * Alternatively, this file is available under the Mozilla Public *
25 * License Version 1.1. You may obtain a copy of the License at *
26 * http://www.mozilla.org/MPL/ *
27 ***************************************************************************/
28
29#ifndef TAGLIB_VERSIONNUMBER_H
30#define TAGLIB_VERSIONNUMBER_H
31
32#include "taglib_export.h"
33
34namespace TagLib {
35
36 class String;
37
39
41 public:
45 constexpr VersionNumber(unsigned int major, unsigned int minor,
46 unsigned int patch = 0)
47 : m_combined(((major & 0xff) << 16) | ((minor & 0xff) << 8)
48 | (patch & 0xff)) {
49 }
50
56 constexpr unsigned int combinedVersion() const {
57 return m_combined;
58 }
59
63 constexpr unsigned int majorVersion() const {
64 return (m_combined & 0xff0000) >> 16;
65 }
66
70 constexpr unsigned int minorVersion() const {
71 return (m_combined & 0xff00) >> 8;
72 }
73
77 constexpr unsigned int patchVersion() const {
78 return m_combined & 0xff;
79 }
80
84 constexpr bool operator==(const VersionNumber &rhs) const {
85 return m_combined == rhs.m_combined;
86 }
87
91 constexpr bool operator!=(const VersionNumber &rhs) const {
92 return m_combined != rhs.m_combined;
93 }
94
98 constexpr bool operator<(const VersionNumber &rhs) const {
99 return m_combined < rhs.m_combined;
100 }
101
105 constexpr bool operator>(const VersionNumber &rhs) const {
106 return m_combined > rhs.m_combined;
107 }
108
112 constexpr bool operator<=(const VersionNumber &rhs) const {
113 return m_combined <= rhs.m_combined;
114 }
115
119 constexpr bool operator>=(const VersionNumber &rhs) const {
120 return m_combined >= rhs.m_combined;
121 }
122
128
129 private:
130 unsigned int m_combined;
131 };
132
139
140} // namespace TagLib
141
142#endif
A wide string class suitable for unicode.
Definition: tstring.h:83
Version number with major, minor and patch segments.
Definition: tversionnumber.h:40
constexpr unsigned int majorVersion() const
Definition: tversionnumber.h:63
TAGLIB_EXPORT VersionNumber runtimeVersion()
constexpr bool operator>(const VersionNumber &rhs) const
Definition: tversionnumber.h:105
constexpr unsigned int combinedVersion() const
Definition: tversionnumber.h:56
constexpr bool operator==(const VersionNumber &rhs) const
Definition: tversionnumber.h:84
constexpr bool operator<(const VersionNumber &rhs) const
Definition: tversionnumber.h:98
String toString() const
constexpr VersionNumber(unsigned int major, unsigned int minor, unsigned int patch=0)
Definition: tversionnumber.h:45
constexpr bool operator!=(const VersionNumber &rhs) const
Definition: tversionnumber.h:91
constexpr bool operator<=(const VersionNumber &rhs) const
Definition: tversionnumber.h:112
constexpr unsigned int minorVersion() const
Definition: tversionnumber.h:70
constexpr unsigned int patchVersion() const
Definition: tversionnumber.h:77
constexpr bool operator>=(const VersionNumber &rhs) const
Definition: tversionnumber.h:119
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
#define TAGLIB_EXPORT
Definition: taglib_export.h:40