X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Finclude%2Fgetopt-long.hh;h=6d3598954d558715f77c820e1a40b9012ae2be6b;hb=58bcc84c9480dae1b21bc24d8396b91fe19e0131;hp=8233114ed7674858734ca540e572fca7893a92d7;hpb=8942177c7566bc201b53d7829f23523961e80537;p=lilypond.git diff --git a/flower/include/getopt-long.hh b/flower/include/getopt-long.hh index 8233114ed7..6d3598954d 100644 --- a/flower/include/getopt-long.hh +++ b/flower/include/getopt-long.hh @@ -8,56 +8,56 @@ /** a struct this for initialising the commandline options. */ -struct Long_option_init { - char const * take_arg_str0_; - char const * longname_str0_; +struct Long_option_init +{ + char const *take_arg_str0_; + char const *longname_str0_; /* = 0: don't take short version. */ char shortname_char_; - char const * help_str0_; - + char const *help_str0_; + String to_string () const; String str_for_help () const; // NO constructor! - static int compare (Long_option_init const&,Long_option_init const&); - static String table_string (Long_option_init *); + static int compare (Long_option_init const &, Long_option_init const &); + static String table_string (Long_option_init *); }; - /** C++ for version of long_getopt. For processing GNU style command - line arguments. No pointer (return values, arguments) contents are - copied. - - TODO: handle - command - , and command -- - - argument reordering - */ -class Getopt_long { + line arguments. No pointer (return values, arguments) contents are + copied. + + TODO: handle + command - , and command -- + + argument reordering +*/ +class Getopt_long +{ /// the option info. const Long_option_init *option_a_; int table_len_; - + /// if doing short option, arg_value_char_a_a_[optind][optindind] is processed next. int argument_index_; /// the option found const Long_option_init *found_option_; - -public: +public: /** errorcodes: no error, argument expected, no argument expected, - unknown option, illegal argument (eg. int expected). */ + unknown option, illegal argument (eg. int expected). */ enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION, - E_ILLEGALARG } ; + E_ILLEGALARG }; /// argument. Set to 0 if not present - char const * optional_argument_str0_; + char const *optional_argument_str0_; /// current error status Errorcod error_; @@ -84,30 +84,28 @@ public: /// report an error and abort void report (Errorcod c); - /// return an integer (with err. detect) long get_argument_index (); - - + /** - What to do with errors. - report messages on #*os#, and abort. - if #os# is null, then do not report nor abort, just set #error# - */ - + What to do with errors. + report messages on #*os#, and abort. + if #os# is null, then do not report nor abort, just set #error# + */ + void seterror (FILE *os); /// construct: pass arguments and option info. - Getopt_long (int c, char **v, Long_option_init *lo); + Getopt_long (int c, char **v, Long_option_init *lo); - /** get the next option. - @return pointer to next option found. - 0 if error occurred, or next argument is no option. - */ - const Long_option_init *operator () (); + /** get the next option. + @return pointer to next option found. + 0 if error occurred, or next argument is no option. + */ + const Long_option_init *operator() (); char const *current_arg (); - char const * get_next_arg (); + char const *get_next_arg (); }; #endif // GETOPT_LONG_HH