6 #include "std-string.hh"
9 a struct this for initialising the commandline options.
11 struct Long_option_init
13 char const *take_arg_str0_
;
14 char const *longname_str0_
;
17 = 0: don't take short version.
21 char const *help_str0_
;
23 string
to_string () const;
24 string
str_for_help () const;
27 static int compare (Long_option_init
const &, Long_option_init
const &);
28 static string
table_string (Long_option_init
*);
31 /** C++ for version of long_getopt. For processing GNU style command
32 line arguments. No pointer (return values, arguments) contents are
36 command - , and command --
44 const Long_option_init
*option_a_
;
47 /// if doing short option, arg_value_char_a_a_[optind][optindind] is processed next.
51 const Long_option_init
*found_option_
;
54 /** errorcodes: no error, argument expected, no argument expected,
55 unknown option, illegal argument (eg. int expected). */
56 enum Errorcod
{ E_NOERROR
= 0, E_ARGEXPECT
, E_NOARGEXPECT
, E_UNKNOWNOPTION
,
59 /// argument. Set to 0 if not present
60 char const *optional_argument_str0_
;
62 /// current error status
65 /// arg_value_char_a_a_[array_index_] will be processed next.
69 char **arg_value_char_a_a_
;
77 /// get ready for processing next error.
79 const Long_option_init
*parselong ();
80 const Long_option_init
*parseshort ();
84 /// report an error and abort
85 void report (Errorcod c
);
87 /// return an integer (with err. detect)
88 long get_argument_index ();
91 What to do with errors.
92 report messages on #*os#, and abort.
93 if #os# is null, then do not report nor abort, just set #error#
96 void seterror (FILE *os
);
98 /// construct: pass arguments and option info.
99 Getopt_long (int c
, char **v
, Long_option_init
*lo
);
101 /** get the next option.
102 @return pointer to next option found.
103 0 if error occurred, or next argument is no option.
105 const Long_option_init
*operator () ();
107 char const *current_arg ();
108 char const *get_next_arg ();
111 #endif // GETOPT_LONG_HH