SASC
DVBSoftCAM

opts.h

Go to the documentation of this file.
00001 /*
00002  * Softcam plugin to VDR (C++)
00003  *
00004  * This code is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This code is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
00018  */
00019 
00020 #ifndef ___OPTS_H
00021 #define ___OPTS_H
00022 
00023 #include "i18n.h"
00024 
00025 class cOsdMenu;
00026 
00027 // ----------------------------------------------------------------
00028 
00029 class cOpt {
00030 private:
00031   char *fullname;
00032   bool persistant;
00033 protected:
00034   const char *name, *title;
00035   //
00036   const char *FullName(const char *PreStr);
00037 public:
00038   cOpt(const char *Name, const char *Title);
00039   virtual ~cOpt();
00040   virtual void Parse(const char *Value)=0;
00041   virtual void Backup(void)=0;
00042   virtual bool Set(void)=0;
00043   virtual void Store(const char *PreStr)=0;
00044   virtual void Create(cOsdMenu *menu)=0;
00045   const char *Name(void) { return name; }
00046   void Persistant(bool per) { persistant=per; }
00047   bool Persistant(void) { return persistant; }
00048   };
00049 
00050 // ----------------------------------------------------------------
00051 
00052 class cOptInt : public cOpt {
00053 protected:
00054   int *storage, value, min, max;
00055 public:
00056   cOptInt(const char *Name, const char *Title, int *Storage, int Min, int Max);
00057   virtual void Parse(const char *Value);
00058   virtual void Backup(void);
00059   virtual bool Set(void);
00060   virtual void Store(const char *PreStr);
00061   virtual void Create(cOsdMenu *menu);
00062   };
00063 
00064 // ----------------------------------------------------------------
00065 
00066 class cOptSel : public cOptInt {
00067 private:
00068   const char **trStrings;
00069 protected:
00070   const char * const *strings;
00071 public:
00072   cOptSel(const char *Name, const char *Title, int *Storage, int NumStr, const char * const *Strings);
00073   virtual ~cOptSel();
00074   virtual void Create(cOsdMenu *menu);
00075   };
00076 
00077 // ----------------------------------------------------------------
00078 
00079 class cOptBool : public cOptInt {
00080 public:
00081   cOptBool(const char *Name, const char *Title, int *Storage);
00082   virtual void Create(cOsdMenu *menu);
00083   };
00084 
00085 // ----------------------------------------------------------------
00086 
00087 class cOptStr : public cOpt {
00088 protected:
00089   char *storage, *value;
00090   const char *allowed;
00091   int size;
00092 public:
00093   cOptStr(const char *Name, const char *Title, char *Storage, int Size, const char *Allowed);
00094   virtual ~cOptStr();
00095   virtual void Parse(const char *Value);
00096   virtual void Backup(void);
00097   virtual bool Set(void);
00098   virtual void Store(const char *PreStr);
00099   virtual void Create(cOsdMenu *menu);
00100   };
00101 
00102 // ----------------------------------------------------------------
00103 
00104 class cOpts {
00105 private:
00106   int numOpts, numAdd;
00107   const char *preStr;
00108   cOpt **opts;
00109 public:
00110   cOpts(const char *PreStr, int NumOpts);
00111   ~cOpts();
00112   void Add(cOpt *opt);
00113   bool Parse(const char *Name, const char *Value);
00114   bool Store(bool AsIs);
00115   void Backup(void);
00116   void Create(cOsdMenu *menu);
00117   };
00118 
00119 #endif //___OPTS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines