Changeset 1632


Ignore:
Timestamp:
Nov 19, 2008, 5:20:49 PM (13 years ago)
Author:
Peter
Message:

move the setting of print_arg from constructor to function in order to allow usage also in daughter classes.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/commandline_test.cc

    r1629 r1632  
    7777  OptionHelp help(cmd);
    7878  OptionArg<std::string> target(cmd, "T,target", "treat DEST as a normal file",
    79                                 true, "TARGET");
     79                                true);
     80  target.print_arg("=TARGET");
    8081  OptionSwitch verbose(cmd, "v,verbose", "explain what is being done");
    8182  OptionSwitch version(cmd, "version", "output version and exit");
  • trunk/yat/utility/OptionArg.h

    r1631 r1632  
    5959       \param required If true option must be found in commandline or
    6060       exception is thrown in validation
    61        \param arg string to be used in help output such as `=TARGET' in
    62        `--target=TARGET'. See print3(). New in yat 0.5.
    6361    */
    6462    OptionArg(CommandLine& cmd, std::string name, std::string desc,
    65               bool required=false, std::string arg="")
    66       : Option(cmd, name, desc), print_arg_(arg), required_(required) {}
     63              bool required=false)
     64      : Option(cmd, name, desc), required_(required) {}
     65
     66    /**
     67       \param arg string to be used in help output such as `=TARGET'
     68       in `--target=TARGET'. See print3().
     69
     70       \since New in yat 0.5.
     71     */
     72    void print_arg(std::string arg) { print_arg_ = arg; }
    6773
    6874    /**
Note: See TracChangeset for help on using the changeset viewer.