-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathlivefeatures.cpp
More file actions
37 lines (30 loc) · 802 Bytes
/
livefeatures.cpp
File metadata and controls
37 lines (30 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "livefeatures.h"
#include "tools.h"
namespace vdrlive {
SplitVersion::SplitVersion(cSv version)
: m_version(0)
{
static const int factors[] = { 100000000, 1000000, 1000, 1 };
size_t pos = version.find('-');
if (pos != std::string_view::npos) {
m_suffix = version.substr(pos + 1);
version.remove_suffix(version.size() - pos);
}
size_t i = 0;
for (int part: cSplit<int>(version, '.' )) {
if (i >= sizeof(factors)/sizeof(factors[0])) break;
m_version += part * factors[i];
++i;
}
}
bool SplitVersion::operator<( const SplitVersion& right ) const
{
if ( m_version == right.m_version ) {
if (right.m_suffix.empty()) {
return false;
}
return m_suffix < right.m_suffix;
}
return m_version < right.m_version;
}
} // namespace vdrlive