libplatform/prog/option.h Source File
option.h
1 #ifndef MP4V2_PLATFORM_PROG_OPTION_H
2 #define MP4V2_PLATFORM_PROG_OPTION_H
3 
22 namespace mp4v2 { namespace platform { namespace prog {
23 
26 MP4V2_EXPORT extern const char* optarg;
27 
33 MP4V2_EXPORT extern int optind;
34 
39 MP4V2_EXPORT extern int optopt;
40 
42 MP4V2_EXPORT extern int opterr;
43 
46 MP4V2_EXPORT extern int optreset;
47 
51 struct MP4V2_EXPORT Option
52 {
55  enum Type {
62  };
63 
65  const char* name;
66 
69 
73  int* flag;
74 
79  int val;
80 };
81 
133 MP4V2_EXPORT
134 int getOption( int argc, char* const* argv, const char* optstr, const Option* longopts, int* idx );
135 
167 MP4V2_EXPORT
168 int 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
mp4v2::platform::prog::Option::OPTIONAL_ARG
@ OPTIONAL_ARG
indicates 0 or 1 arguments follow option
Definition: option.h:61
mp4v2::platform::prog::getOptionSingle
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.
mp4v2::platform::prog::optreset
int optreset
Must be set to 1 before evaluating the 2nd or each additional set of arguments.
mp4v2::platform::prog::Option::REQUIRED_ARG
@ REQUIRED_ARG
indicates exactly 1 argument follow option
Definition: option.h:59
mp4v2::platform::prog::opterr
int opterr
Initialized to 1 and may be set to 0 to disable error messages.
mp4v2::platform::prog::Option::name
const char * name
contains the option name without leading double-dash
Definition: option.h:65
mp4v2::platform::prog::Option::Type
Type
expectation-type indicating number of arguments expected on the command-line following the option-arg...
Definition: option.h:55
mp4v2::platform::prog::getOption
int getOption(int argc, char *const *argv, const char *optstr, const Option *longopts, int *idx)
Get option character from command line argument list.
mp4v2::platform::prog::Option::val
int val
Constant value representing option.
Definition: option.h:79
mp4v2::platform::prog::optopt
int optopt
On return from getOption() or getOptionSingle(), saves the last known option character returned by ge...
mp4v2::platform::prog::optind
int optind
On return from getOption() or getOptionSingle(), contains the index to the next argv argument for a s...
mp4v2::platform::prog::Option::NO_ARG
@ NO_ARG
indicates exactly 0 arguments follow option
Definition: option.h:57
mp4v2::platform::prog::optarg
const char * optarg
On return from getOption() or getOptionSingle(), points to an option argument, if it is anticipated.
mp4v2::platform::prog::Option::type
Type type
option expectation-type
Definition: option.h:68
mp4v2::platform::prog::Option
Structure describing a single option.
Definition: option.h:51
mp4v2::platform::prog::Option::flag
int * flag
If not NULL, then the integer pointed to by it will be set to the value in the val field.
Definition: option.h:73