10 a struct this for initialising the commandline options.
12 struct Long_option_init {
14 char const * longname;
17 void printon (ostream &errorout) const ;
21 /** C++ for version of long_getopt. For processing GNU style command
22 line arguments. No pointer (return values, arguments) contents are
26 command - , and command --
33 const Long_option_init *option_a_;
36 /// if doing short option, arg_value_ch_a_a_[optind][optindind] is processed next.
37 int argument_index_i_;
40 const Long_option_init *found_option_l_;
44 /** errorcodes: no error, argument expected, no argument expected,
45 unknown option, illegal argument (eg. int expected). */
46 enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
49 /// argument. Set to 0 if not present
50 char const * optional_argument_ch_C_;
52 /// current error status
55 /// arg_value_ch_a_a_[array_index_i_] will be processed next.
59 char **arg_value_ch_a_a_;
62 int argument_count_i_;
64 ostream *error_ostream_l_;
67 /// get ready for processing next error.
69 const Long_option_init *parselong();
70 const Long_option_init *parseshort();
74 /// report an error and abort
75 void report (Errorcod c);
78 /// return an integer (with err. detect)
83 What to do with errors.
84 report messages on #*os#, and abort.
85 if #os# is null, then do not report nor abort, just set #error#
88 void seterror (ostream *os);
90 /// construct: pass arguments and option info.
91 Getopt_long (int c, char **v, Long_option_init *lo);
93 /** get the next option.
94 @return pointer to next option found.
95 0 if error occurred, or next argument is no option.
97 const Long_option_init *operator()();
99 char const *current_arg();
100 char const * get_next_arg();