diff options
author | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-06-01 19:57:29 +0000 |
---|---|---|
committer | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-06-01 19:57:29 +0000 |
commit | 883be2c8cade7d68dc743c17bedda6f675a787ba (patch) | |
tree | 71834227bb75137fa5a8424aec10171a29d6c0fb /livefeatures.cpp | |
parent | e71ea234a90f701dfb84e03443c7cd3134da5260 (diff) | |
download | vdr-plugin-live-883be2c8cade7d68dc743c17bedda6f675a787ba.tar.gz vdr-plugin-live-883be2c8cade7d68dc743c17bedda6f675a787ba.tar.bz2 |
- added uniform features detector
Diffstat (limited to 'livefeatures.cpp')
-rw-r--r-- | livefeatures.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/livefeatures.cpp b/livefeatures.cpp new file mode 100644 index 0000000..385430f --- /dev/null +++ b/livefeatures.cpp @@ -0,0 +1,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 |