APM:Libraries
getopt_cpp.h
Go to the documentation of this file.
1 /*
2  * Portions Copyright (c) 1987, 1993, 1994
3  * The Regents of the University of California. All rights reserved.
4  *
5  * Portions Copyright (c) 2003-2010, PostgreSQL Global Development
6  * Group
7  *
8  * Simple conversion to C++ by Andrew Tridgell for ArduPilot. Based on
9  * getopt_long.h from ccache
10  */
11 #pragma once
12 
13 
14 class GetOptLong {
15 public:
16  struct option {
17  const char *name;
18  bool has_arg;
19  int *flag;
20  int val;
21  };
22 
23  GetOptLong(int argc, char *const argv[], const char *optstring, const option * longopts);
24 
25  int opterr;
26  int optind;
27  int optopt;
28  int longindex;
29  const char *optarg;
30 
31  enum error_return {
32  BADCH='?',
33  BADARG=':'
34  };
35 
36 
37  int getoption(void);
38 
39 private:
40  int argc;
41  char *const *argv;
42  const char *optstring;
43  const struct option *longopts;
44  const char *place;
45 };
char *const * argv
Definition: getopt_cpp.h:41
int opterr
Definition: getopt_cpp.h:25
GetOptLong(int argc, char *const argv[], const char *optstring, const option *longopts)
const char * name
Definition: getopt_cpp.h:17
const char * optarg
Definition: getopt_cpp.h:29
int optind
Definition: getopt_cpp.h:26
const char * optstring
Definition: getopt_cpp.h:42
int longindex
Definition: getopt_cpp.h:28
const struct option * longopts
Definition: getopt_cpp.h:43
const char * place
Definition: getopt_cpp.h:44
int getoption(void)
int optopt
Definition: getopt_cpp.h:27