Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

dsGetopt.h

Go to the documentation of this file.
00001 /*
00002  * $Id: dsGetopt.h,v 1.5 2004/03/25 11:38:00 dsamersoff Exp $
00003  *
00004  */
00005 
00006 #ifndef dsGetopt_h
00007 #define dsGetopt_h
00008 
00009 #include <iostream>
00010 
00011 #include <stdlib.h>
00012 #include <string.h>
00013 #include <stdio.h>
00014 
00015 #include <dsSmartException.h>
00016 #include <dsHashTable.h>
00017 #include <dsApprc.h>
00018 
00019 DECLARE_EXCEPTION(dsGetopt);
00020 
00030 class dsGetopt
00031 {
00032   char **_argv;
00033   int    _argc;
00034   
00035   char *_optarg; 
00036   int   _optind;     // index into parent argv vector 
00037   int   _optopt;     // character checked for validity
00038   int  _optreset;    // reset getopt 
00039   char *_place;   
00040 
00041 public:
00049   dsGetopt(int argc, char **argv);
00050 
00057  virtual int next(char *optstr);
00058 
00064   char *optarg(){ return _optarg; }
00065 
00070   int   optind(){ return _optind; }
00071 
00072 };
00073 
00074 class dsGetoptMore
00075 {
00076    dsHashTable *_ht;
00077    dsApprc     *_ap;
00078 
00079    int _argc;
00080    char **_argv;
00081 
00082    int   _optind;
00083 
00084 protected:   
00085    virtual   void usage();
00086 
00087 public:
00088 
00089    dsGetoptMore(dsApprc *dest, int argc, char *argv[]);
00090    virtual  ~dsGetoptMore();
00091 
00092 
00093    void setArg(char *xarg, char *xdescr = 0);
00094    void execute();
00095 
00096    int   optind();
00097    
00098 };
00099 
00100 inline int dsGetoptMore::optind()
00101 {
00102     return _optind; 
00103 }
00104  
00105 #endif

Generated on Mon May 16 18:26:57 2005 for libdms4 by doxygen1.3-rc2