9 a struct this for initialising the commandline options.
11 struct Long_option_init {
12 char const * take_arg_sz_;
13 char const * longname_sz_;
16 char const * help_sz_;
19 String str_for_help () const;
22 static int compare (Long_option_init const&,Long_option_init const&);
23 static String table_str (Long_option_init *);
27 /** C++ for version of long_getopt. For processing GNU style command
28 line arguments. No pointer (return values, arguments) contents are
32 command - , and command --
39 const Long_option_init *option_a_;
42 /// if doing short option, arg_value_ch_a_a_[optind][optindind] is processed next.
43 int argument_index_i_;
46 const Long_option_init *found_option_l_;
50 /** errorcodes: no error, argument expected, no argument expected,
51 unknown option, illegal argument (eg. int expected). */
52 enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
55 /// argument. Set to 0 if not present
56 char const * optional_argument_ch_C_;
58 /// current error status
61 /// arg_value_ch_a_a_[array_index_i_] will be processed next.
65 char **arg_value_ch_a_a_;
68 int argument_count_i_;
70 ostream *error_ostream_l_;
73 /// get ready for processing next error.
75 const Long_option_init *parselong();
76 const Long_option_init *parseshort();
80 /// report an error and abort
81 void report (Errorcod c);
84 /// return an integer (with err. detect)
89 What to do with errors.
90 report messages on #*os#, and abort.
91 if #os# is null, then do not report nor abort, just set #error#
94 void seterror (ostream *os);
96 /// construct: pass arguments and option info.
97 Getopt_long (int c, char **v, Long_option_init *lo);
99 /** get the next option.
100 @return pointer to next option found.
101 0 if error occurred, or next argument is no option.
103 const Long_option_init *operator()();
105 char const *current_arg();
106 char const * get_next_arg();
109 #endif // GETOPT_LONG_HH