summaryrefslogtreecommitdiff
path: root/livefeatures.h
diff options
context:
space:
mode:
Diffstat (limited to 'livefeatures.h')
-rw-r--r--livefeatures.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/livefeatures.h b/livefeatures.h
new file mode 100644
index 0000000..a94cc90
--- /dev/null
+++ b/livefeatures.h
@@ -0,0 +1,70 @@
+#ifndef VDR_LIVE_FEATURES_H
+#define VDR_LIVE_FEATURES_H
+
+#include <string>
+#include <vdr/plugin.h>
+
+namespace vdrlive {
+
+//LiveFeatures<EpgsearchFeature>().Available();
+
+class SplitVersion
+{
+public:
+ explicit SplitVersion( std::string version );
+
+ bool operator<( const SplitVersion& right ) const;
+
+private:
+ int m_version;
+ std::string m_suffix;
+};
+
+template< typename Feat >
+class Features;
+
+template< typename Feat >
+Features< Feat >& LiveFeatures();
+
+template< typename Feat >
+class Features
+{
+ friend Features< Feat >& LiveFeatures<>();
+
+public:
+ bool Loaded() const { return m_plugin != 0; }
+ bool Recent() const { return !(m_version < m_minVersion); }
+ char const* Version() const { return m_plugin ? m_plugin->Version() : ""; }
+ char const* MinVersion() const { return Feat::MinVersion(); }
+
+private:
+ cPlugin* m_plugin;
+ SplitVersion m_version;
+ SplitVersion m_minVersion;
+
+ Features()
+ : m_plugin( cPluginManager::GetPlugin( Feat::Plugin() ) )
+ , m_version( Version() )
+ , m_minVersion( Feat::MinVersion() ) {}
+};
+
+template< typename Feat >
+Features< Feat >& LiveFeatures()
+{
+ static Features< Feat > instance;
+ return instance;
+}
+
+namespace features
+{
+ struct epgsearch
+ {
+ static const char* Plugin() { return "epgsearch"; }
+ static const char* MinVersion() { return "0.9.22"; }
+ };
+
+} // namespace features
+
+} // namespace vdrlive
+
+#endif // VDR_LIVE_FEATURES_H