libplatform/prog/option.h Source File
option.h
1#ifndef MP4V2_PLATFORM_PROG_OPTION_H
2#define MP4V2_PLATFORM_PROG_OPTION_H
3
22namespace mp4v2 { namespace platform { namespace prog {
23
26MP4V2_EXPORT extern const char* optarg;
27
33MP4V2_EXPORT extern int optind;
34
39MP4V2_EXPORT extern int optopt;
40
42MP4V2_EXPORT extern int opterr;
43
46MP4V2_EXPORT extern int optreset;
47
51struct MP4V2_EXPORT Option
52{
63
65 const char* name;
66
69
73 int* flag;
74
79 int val;
80};
81
133MP4V2_EXPORT
134int getOption( int argc, char* const* argv, const char* optstr, const Option* longopts, int* idx );
135
167MP4V2_EXPORT
168int getOptionSingle( int argc, char* const* argv, const char* optstr, const Option* longopts, int* idx );
169
171
172}}} // namespace mp4v2::platform::prog
173
174#endif // MP4V2_PLATFORM_PROG_OPTION_H
Command-line argument parsing.
int getOptionSingle(int argc, char *const *argv, const char *optstr, const Option *longopts, int *idx)
Get option character from command line argument list and allow long-options with single-hyphens.
int opterr
Initialized to 1 and may be set to 0 to disable error messages.
int getOption(int argc, char *const *argv, const char *optstr, const Option *longopts, int *idx)
Get option character from command line argument list.
(private) Platform abstraction.
Definition File.h:4
Definition option.h:52
Type type
option expectation-type
Definition option.h:68
Type
Definition option.h:55
@ NO_ARG
indicates exactly 0 arguments follow option
Definition option.h:57
@ REQUIRED_ARG
indicates exactly 1 argument follow option
Definition option.h:59
@ OPTIONAL_ARG
indicates 0 or 1 arguments follow option
Definition option.h:61
const char * name
contains the option name without leading double-dash
Definition option.h:65
int val
Definition option.h:79
int * flag
Definition option.h:73