forked from sourishg/stereo-calibration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
popt_pp.h
39 lines (34 loc) · 1.01 KB
/
popt_pp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef _INCLUDED_POPT_PP_H_
#define _INCLUDED_POPT_PP_H_
#include <popt.h>
class POpt{
protected:
poptContext con;
public:
// creation and deletion
POpt(const char *name, int argc, const char **argv,
const poptOption *options, int flags)
{con = poptGetContext(name,argc,argv,options,flags);}
POpt(const char *name, int argc, char **argv,
const poptOption *options, int flags)
{con = poptGetContext(name,argc,(const char **)argv,options,flags);}
~POpt()
{poptFreeContext(con);}
// functions for processing options
int getNextOpt()
{return(poptGetNextOpt(con));}
void ignoreOptions()
{while(getNextOpt() >= 0);}
const char *getOptArg()
{return(poptGetOptArg(con));}
const char *strError(int error)
{return(poptStrerror(error));}
const char *badOption(int flags = POPT_BADOPTION_NOALIAS)
{return(poptBadOption(con,flags));}
// processing other arguments
const char *getArg()
{return(poptGetArg(con));}
void ignoreArgs()
{while(getArg());}
};
#endif