blob: 385430f9eae159ba9796c469e70e839e3731a1b8 (
plain)
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
|
#include "livefeatures.h"
#include "tools.h"
namespace vdrlive {
using namespace std;
SplitVersion::SplitVersion( string version )
: m_version( 0 )
{
static const int factors[] = { 100000000, 1000000, 1000, 1 };
size_t pos = version.find('-');
if ( pos != string::npos ) {
m_suffix = version.substr( pos + 1 );
version.erase( pos );
}
vector< string > parts = StringSplit( version, '.' );
for ( size_t i = 0; i < parts.size() && i < sizeof(factors)/sizeof(factors[0]); ++i ) {
m_version += atoi( parts[ i ].c_str() ) * factors[ i ];
}
}
bool SplitVersion::operator<( const SplitVersion& right ) const
{
dsyslog( "vdrlive::SplitVersion::operator<( %d-%s, %d-%s )", m_version, m_suffix.c_str(), right.m_version, right.m_suffix.c_str() );
if ( m_version == right.m_version ) {
if ( m_suffix.empty() ) return false;
if ( right.m_suffix.empty() ) return true;
return m_suffix < right.m_suffix;
}
return m_version < right.m_version;
}
} // namespace vdrlive
|