CGR Localization
 All Classes Namespaces Files Functions Variables Macros Pages
popt_pp.h
1 #ifndef _INCLUDED_POPT_PP_H_
2 #define _INCLUDED_POPT_PP_H_
3 
4 #include <popt.h>
5 
6 class POpt{
7 protected:
8  poptContext con;
9 public:
10  // creation and deletion
11  POpt(const char *name, int argc, const char **argv,
12  const poptOption *options, int flags)
13  {con = poptGetContext(name,argc,argv,options,flags);}
14  POpt(const char *name, int argc, char **argv,
15  const poptOption *options, int flags)
16  {con = poptGetContext(name,argc,(const char **)argv,options,flags);}
17  ~POpt()
18  {poptFreeContext(con);}
19 
20  // functions for processing options
21  int getNextOpt()
22  {return(poptGetNextOpt(con));}
23  void ignoreOptions()
24  {while(getNextOpt() >= 0);}
25  const char *getOptArg()
26  {return(poptGetOptArg(con));}
27  const char *strError(int error)
28  {return(poptStrerror(error));}
29  const char *badOption(int flags = POPT_BADOPTION_NOALIAS)
30  {return(poptBadOption(con,flags));}
31 
32  // processing other arguments
33  const char *getArg()
34  {return(poptGetArg(con));}
35  void ignoreArgs()
36  {while(getArg());}
37 };
38 
39 #endif
Definition: popt_pp.h:6