summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMountainMan <MountainMan@e10066b5-e1e2-0310-b819-94efdf66514b>2004-02-02 18:34:34 +0000
committerMountainMan <MountainMan@e10066b5-e1e2-0310-b819-94efdf66514b>2004-02-02 18:34:34 +0000
commitf47b07b342a6e37e76b41b1ab40101190918dbe5 (patch)
treef25bb06d480e465b9e12244e3cd300f2534a6a70
parent41b962e0042a8e3cf66caeea7fd6610648175941 (diff)
downloadvdr-plugin-muggle-f47b07b342a6e37e76b41b1ab40101190918dbe5.tar.gz
vdr-plugin-muggle-f47b07b342a6e37e76b41b1ab40101190918dbe5.tar.bz2
class mgFilterChoices implemented
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@16 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r--mg_media.c51
-rw-r--r--mg_media.h59
2 files changed, 99 insertions, 11 deletions
diff --git a/mg_media.c b/mg_media.c
index 4027ab9..de0f91d 100644
--- a/mg_media.c
+++ b/mg_media.c
@@ -3,8 +3,8 @@
* \brief Top level access to media in vdr plugin muggle
* for the vdr muggle plugindatabase
********************************************************************
- * \version $Revision: 1.3 $
- * \date $Date: 2004/02/02 17:57:53 $
+ * \version $Revision: 1.4 $
+ * \date $Date: 2004/02/02 18:34:34 $
* \author Ralf Klueber, Lars von Wedel, Andreas Kellner
* \author file owner: $Author: MountainMan $
*
@@ -22,6 +22,9 @@
using namespace std;
+//-------------------------------------------------------------------
+// mgFilter
+//-------------------------------------------------------------------
mgFilter::mgFilter(const char* name)
{
m_name = strdup(name);
@@ -36,6 +39,9 @@ const char* mgFilter::getName()
return m_name;
}
+//-------------------------------------------------------------------
+// mgFilterInt
+//-------------------------------------------------------------------
mgFilterInt::mgFilterInt(const char *name, int value, int min, int max)
: mgFilter(name)
{
@@ -64,6 +70,9 @@ int mgFilterInt::getMax()
return m_max;
}
+//-------------------------------------------------------------------
+// mgFilterString
+//-------------------------------------------------------------------
mgFilterString::mgFilterString(const char *name, const char* value)
: mgFilter(name)
{
@@ -84,6 +93,9 @@ string mgFilterString::getStrVal()
return (string) m_strval;
}
+//-------------------------------------------------------------------
+// mgFilterBool
+//-------------------------------------------------------------------
mgFilterBool::mgFilterBool(const char *name, bool value)
: mgFilter(name)
{
@@ -102,6 +114,39 @@ string mgFilterBool::getStrVal()
return "false";
}
+//-------------------------------------------------------------------
+// mgFilterChoice
+//-------------------------------------------------------------------
+mgFilterChoice::mgFilterChoice(const char *name, int val, vector<char*> *choices)
+ : mgFilter(name)
+{
+ m_choices = *choices;
+ m_selval = val;
+ if( m_selval < 0 || m_selval >= (int) m_choices.size() )
+ {
+ mgError("mgFilterChoice::mgFilterChoice(..): Illegal index %d", m_selval);
+ }
+}
+mgFilterChoice::~mgFilterChoice()
+{
+ m_choices.clear();
+}
+
+string mgFilterChoice::getStrVal()
+{
+ if( m_selval < 0 || m_selval >= (int) m_choices.size() )
+ {
+ mgError("mgFilterChoice::getStrVal(): Illegal index %d", m_selval);
+ }
+ return m_choices[m_selval];
+}
+vector<char*> &mgFilterChoice::getChoices()
+{
+ return m_choices;
+}
+//-------------------------------------------------------------------
+// mgTrackFilters
+//-------------------------------------------------------------------
mgTrackFilters::mgTrackFilters()
{
}
@@ -216,7 +261,7 @@ vector<mgFilter*> *mgMedia::getTrackFilters()
return NULL;
}
-void mgMedia::setTrackFilters(vector<mgFilter*> *filters)
+void mgMedia::applyTrackFilters(vector<mgFilter*> *filters)
{
}
diff --git a/mg_media.h b/mg_media.h
index a77500a..0df4bd9 100644
--- a/mg_media.h
+++ b/mg_media.h
@@ -3,15 +3,15 @@
* \brief Top level access to media in vdr plugin muggle
* for the vdr muggle plugindatabase
********************************************************************
- * \version $Revision: 1.3 $
- * \date $Date: 2004/02/02 17:57:53 $
+ * \version $Revision: 1.4 $
+ * \date $Date: 2004/02/02 18:34:34 $
* \author Ralf Klueber, Lars von Wedel, Andreas Kellner
* \author file owner: $Author: MountainMan $
*
*
*/
/*******************************************************************/
-/* makes sur we dont use parse the same declarations twice */
+/* makes sure we dont use parse the same declarations twice */
#ifndef _MG_MEDIA_H
#define _MG_MEDIA_H
@@ -28,6 +28,7 @@ class mgSelectionTreeNode;
*******************************************************************
* \class mgFilter
*
+ * represents a filter value with boundaries or choices
********************************************************************/
class mgFilter
{
@@ -38,14 +39,17 @@ class mgFilter
char* m_name;
public:
-
mgFilter(const char* name);
virtual ~mgFilter();
filterType getType();
const char* getName();
virtual std::string getStrVal()=0;
};
-
+
+/*!
+ *******************************************************************
+ * \class mgFilterInt
+ ********************************************************************/
class mgFilterInt : public mgFilter
{
private:
@@ -64,6 +68,10 @@ class mgFilterInt : public mgFilter
virtual std::string getStrVal();
};
+/*!
+ *******************************************************************
+ * \class mgFilterString
+ ********************************************************************/
class mgFilterString : public mgFilter
{
private:
@@ -77,6 +85,10 @@ class mgFilterString : public mgFilter
virtual std::string getStrVal();
};
+/*!
+ *******************************************************************
+ * \class mgFilterBool
+ ********************************************************************/
class mgFilterBool : public mgFilter
{
private:
@@ -91,6 +103,33 @@ class mgFilterBool : public mgFilter
};
+/*!
+ *******************************************************************
+ * \class mgFilterChoices
+ ********************************************************************/
+class mgFilterChoice : public mgFilter
+{
+ private:
+ std::vector<char* > m_choices;
+
+ public:
+ int m_selval; // index of the currently selected item
+
+ mgFilterChoice(const char *name, int val, std::vector<char* > *choices);
+ virtual ~mgFilterChoice();
+
+ virtual std::string getStrVal();
+ virtual std::vector<char*> &getChoices();
+
+};
+
+/*!
+ *******************************************************************
+ * \class mgrackFilters
+ *
+ * Represents a set of filters to set and memorize the search
+ * constraint for a specific track
+ ********************************************************************/
class mgTrackFilters
{
protected:
@@ -105,12 +144,16 @@ class mgTrackFilters
virtual void clear()=0;
};
-
/*!
*******************************************************************
* \class mgMedia
*
* \brief main class to access content in the vdr plugin muggle
+ *
+ * The constructor of this class should be the only point in the plugin,
+ * where the data type is explicitelymentioned.
+ * The class provides a set of objects that abstract from the data
+ * type and source
********************************************************************/
class mgMedia
{
@@ -135,9 +178,9 @@ class mgMedia
mgSelectionTreeNode* getSelectionRoot();
+ // filter management
std::vector<mgFilter*> *getTrackFilters();
-
- void setTrackFilters(std::vector<mgFilter*> *filters);
+ void applyTrackFilters(std::vector<mgFilter*> *filters);
// playlist management
mgPlaylist* createTemporaryPlaylist();