X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=flower%2Flgetopt.hh;h=3b2b0348b3a9a0698682d0de6b72b571e6423d88;hb=4bdf5f822b18b10b48f619c116641e6aee1968ac;hp=67deb700bc703fd24e17ed14849ee75d2c3c08ba;hpb=89e80b41fb745ed7ebc2ba3ee4f183a740f305be;p=lilypond.git diff --git a/flower/lgetopt.hh b/flower/lgetopt.hh index 67deb700bc..3b2b0348b3 100644 --- a/flower/lgetopt.hh +++ b/flower/lgetopt.hh @@ -6,7 +6,10 @@ class ostream; -struct long_option_init { +/** + a struct this for initialising the commandline options. + */ +struct Long_option_init { bool take_arg; const char* longname; char shortname; @@ -15,9 +18,9 @@ struct long_option_init { }; -/// C++ for version of long_getopt. -/** For processing GNU style command line arguments. No pointer - (return values, arguments) contents are copied. */ +/** C++ for version of long_getopt. For processing GNU style command + line arguments. No pointer (return values, arguments) contents are + copied. */ class Getopt_long { public: /** errorcodes: no error, argument expected, no argument expected, @@ -29,35 +32,31 @@ public: private: /// the option info. - long_option_init *the_opts; + Long_option_init *the_opts; int table_len; /// if doing short option, argv[optind][optindind] is processed next. int optindind; /// the option found - long_option_init *beet; + Long_option_init *beet; /// get ready for processing next error. bool next(); - long_option_init *parselong(); - long_option_init *parseshort(); + Long_option_init *parselong(); + Long_option_init *parseshort(); ostream *errorout; /// report an error and abort void report(Errorcod c); public: - /// 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(ostream *os); + /// argument. Set to 0 if not present char* optarg; + /// current error status + Errorcod error; /// return an integer (with err. detect) long intarg(); @@ -70,18 +69,26 @@ public: /// the arg. count int argc; + /* *************** */ + + /** + 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(ostream *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 - /** + /** get the next option. @return pointer to next option found. 0 if error occurred, or next argument is no option. */ - long_option_init *operator()(); + Long_option_init *operator()(); char *current_arg(); char * get_next_arg(); - Errorcod error; }; #endif