Main Page   Class Hierarchy   Compound List   File List   Compound Members  

awsfparm.h

00001 #ifndef __AWS_FLEXIBLE_PARAMETER_LIST__
00002 #define __AWS_FLEXIBLE_PARAMETER_LIST__
00003 
00004 #include "csgeom/csrect.h"
00005 #include "csgeom/cspoint.h"
00006 #include "csutil/scfstr.h"
00007 #include "csutil/csvector.h"
00008 #include "csutil/csstrvec.h"
00009 
00010 /***********************************************************************************
00011  * Provides support for safely passing named parameters through to different functions
00012  * in a portable manner.  Note that awsParmList does not utilize copy semantics.  In
00013  * the interests of space and speed, it simply takes a reference to the pointers passed
00014  * in.  This means that you should NOT use an awsParmList if any parm it references
00015  * has gone out of scope!
00016  ***********************************************************************************/
00017 class awsParmList
00018 {
00019   csBasicVector parms;
00020 
00021 public:
00022   static const int INT;    
00023   static const int FLOAT;
00024   static const int STRING;   
00025   static const int BASICVECTOR;
00026   static const int STRINGVECTOR;
00027   static const int RECT;
00028   static const int POINT;
00029   static const int BOOL;
00030 
00031   struct parmItem
00032   {
00033     int  type;
00034     unsigned long name;
00035     union parmValue 
00036     {
00037       int i;
00038       float f;
00039       bool b;
00040       iString *s;
00041       csBasicVector *bv;
00042       csStrVector *sv;
00043       csRect *r;
00044       csPoint *p;
00045     } parm;
00046   };
00047 
00048 private:
00049   parmItem *FindParm(char *name, int type);
00050 
00051 public:
00053   void AddInt(char *name, int value);
00055   void AddFloat(char *name, float value);
00057   void AddBool(char *name, bool value);
00059   void AddString(char *name, iString* value);
00061   void AddBasicVector(char *name, csBasicVector* value);
00063   void AddStringVector(char *name, csStrVector* value);
00065   void AddRect(char *name, csRect *value);
00067   void AddPoint(char *name, csPoint *value);
00068 
00070   bool GetInt(char *name, int *value);
00072   bool GetFloat(char *name, float *value);
00074   bool GetBool(char *name, bool *value);
00076   bool GetString(char *name, iString **value);
00078   bool GetBasicVector(char *name, csBasicVector **value);
00080   bool GetStringVector(char *name, csStrVector **value);
00082   bool GetRect(char *name, csRect **value);
00084   bool GetPoint(char *name, csPoint **value);
00085 };
00086 
00087 #endif

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000