9 a struct this for initialising the commandline options.
11 struct Long_option_init {
13 char const * longname;
20 /** C++ for version of long_getopt. For processing GNU style command
21 line arguments. No pointer (return values, arguments) contents are
25 command - , and command --
32 const Long_option_init *option_a_;
35 /// if doing short option, arg_value_ch_a_a_[optind][optindind] is processed next.
36 int argument_index_i_;
39 const Long_option_init *found_option_l_;
43 /** errorcodes: no error, argument expected, no argument expected,
44 unknown option, illegal argument (eg. int expected). */
45 enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
48 /// argument. Set to 0 if not present
49 char const * optional_argument_ch_C_;
51 /// current error status
54 /// arg_value_ch_a_a_[array_index_i_] will be processed next.
58 char **arg_value_ch_a_a_;
61 int argument_count_i_;
63 ostream *error_ostream_l_;
66 /// get ready for processing next error.
68 const Long_option_init *parselong();
69 const Long_option_init *parseshort();
73 /// report an error and abort
74 void report (Errorcod c);
77 /// return an integer (with err. detect)
82 What to do with errors.
83 report messages on #*os#, and abort.
84 if #os# is null, then do not report nor abort, just set #error#
87 void seterror (ostream *os);
89 /// construct: pass arguments and option info.
90 Getopt_long (int c, char **v, Long_option_init *lo);
92 /** get the next option.
93 @return pointer to next option found.
94 0 if error occurred, or next argument is no option.
96 const Long_option_init *operator()();
98 char const *current_arg();
99 char const * get_next_arg();
102 #endif // GETOPT_LONG_HH