diff options
author | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-02-12 09:15:07 +0000 |
---|---|---|
committer | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-02-12 09:15:07 +0000 |
commit | 368bacb21c6d0c57c0066ae67c88810b6a79b58d (patch) | |
tree | 789cfb6855f86309856abd8c4825cbe55c652c8e /mg_filters.h | |
parent | 13414776db3ca8457acef6b3466720507c191946 (diff) | |
download | vdr-plugin-muggle-368bacb21c6d0c57c0066ae67c88810b6a79b58d.tar.gz vdr-plugin-muggle-368bacb21c6d0c57c0066ae67c88810b6a79b58d.tar.bz2 |
Moved filter classes into separate files
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@40 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'mg_filters.h')
-rw-r--r-- | mg_filters.h | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/mg_filters.h b/mg_filters.h new file mode 100644 index 0000000..8a983f7 --- /dev/null +++ b/mg_filters.h @@ -0,0 +1,164 @@ +/*******************************************************************/ +/*! \file mg_filters.h + * \brief Top level access to media in vdr plugin muggle + * for the vdr muggle plugindatabase + ******************************************************************** + * \version $Revision: 1.1 $ + * \date $Date: 2004/02/12 09:15:07 $ + * \author Ralf Klueber, Lars von Wedel, Andreas Kellner + * \author file owner: $Author: LarsAC $ + */ +/*******************************************************************/ + +#ifndef _MG_FILTERS_H +#define _MG_FILTERS_H + +#include <string> +#include <vector> + +/*! + ******************************************************************* + * \class mgFilter + * + * Abstract base class for representation of filter values with boundaries + ********************************************************************/ +class mgFilter +{ + public: + typedef enum filterType + { + UNDEF=0, INT, STRING, BOOL, CHOICE + } filterType; + + protected: + filterType m_type; + char* m_name; + + public: + mgFilter(const char* name); + virtual ~mgFilter(); + filterType getType(); + const char* getName(); + virtual std::string getStrVal()=0; + virtual int getIntVal(){return 0;} + virtual void store()=0; + virtual void restore()=0; + virtual void clear()=0; + virtual bool isSet()=0; +}; + +/*! + ******************************************************************* + * \class mgFilterInt + ********************************************************************/ +class mgFilterInt : public mgFilter +{ + private: + int m_min; + int m_max; + int m_stored_val; + int m_default_val; + + public: + int m_intval; + + mgFilterInt(const char *name, int value, int min = 0, int max = 9999); + virtual ~mgFilterInt(); + + int getVal(); + int getMin(); + int getMax(); + virtual std::string getStrVal(); + virtual int getIntVal(); + virtual void store(); + virtual void restore(); + virtual void clear(); + virtual bool isSet(); +}; + +/*! + ******************************************************************* + * \class mgFilterString + ********************************************************************/ +class mgFilterString : public mgFilter +{ + private: + std::string m_allowedchar; + int m_maxlen; + char* m_stored_val; + char* m_default_val; + + public: + char* m_strval; + + mgFilterString(const char *name, const char* value, int maxlen=255, + std::string allowedchar="abcdefghijklmnopqrstuvwxyz0123456789-"); + + virtual ~mgFilterString(); + + int getMaxLength(); + std::string getAllowedChars(); + virtual std::string getStrVal(); + virtual void store(); + virtual void restore(); + virtual void clear(); + virtual bool isSet(); +}; + +/*! + ******************************************************************* + * \class mgFilterBool + ********************************************************************/ +class mgFilterBool : public mgFilter +{ + private: + std::string m_truestr; + std::string m_falsestr; + bool m_stored_val; + bool m_default_val; + + public: + int m_bval; + + mgFilterBool(const char *name, bool value, + std::string truestr="yes", std::string falsestr="no"); + virtual ~mgFilterBool(); + + virtual std::string getStrVal(); + virtual int getIntVal(); + std::string getTrueString(); + std::string getFalseString(); + bool getVal(); + virtual void store(); + virtual void restore(); + virtual void clear(); + virtual bool isSet(); +}; + +/*! + ******************************************************************* + * \class mgFilterChoice + ********************************************************************/ +class mgFilterChoice : public mgFilter +{ + private: + std::vector<std::string> m_choices; + int m_stored_val; + int m_default_val; + + public: + int m_selval; // index of the currently selected item + + mgFilterChoice(const char *name, int val, std::vector<std::string> *choices); + virtual ~mgFilterChoice(); + + virtual std::string getStrVal(); + virtual std::vector<std::string> &getChoices(); + virtual void store(); + virtual void restore(); + virtual void clear(); + virtual bool isSet(); +}; + + +#endif |