Class AdvancedTclapOutput

Inheritance Relationships

Base Type

  • public TCLAP::StdOutput

Class Documentation

class AdvancedTclapOutput : public TCLAP::StdOutput

The AdvancedTclapOutput is similar to the TCLAP::StdOutput but provides some additional options.

The AdvancedTclapOutput generates output similar to the TCLAP::StdOutput. It however exposes some internal parameters to make them user-defined and adds additional functionality.

The features are:

- The maximum line-width can be set instead of being fixed to 75

- The output stream (or multiple streams) can be set. When just
  providing &std::cout, it behaves similar to the TCLAP::StdOutput.
  When providing e.g. an std::stringstream, the string output of this
  class (when printing help or version) can be used by the user code
  and e.g. displayed in a GUI.

- When printing the --help or --version, the programm is not killed any
  more but continues running. Of course the user code can still kill
  the program if desired.

- Arguments can be hidden from the output, e.g. in cases where
  dreprecated parameters are still supposed to exist but shall not
  appear in the help any more.

Public Functions

AdvancedTclapOutput(const std::vector<std::ostream*> &output_streams, int max_width)

Creates an AdvancedTclapOutput that will publish its output on multiple streams.

Parameters:
  • output_streams – A vector of streams to publish the output to

  • max_width – The maximum line width of the output

AdvancedTclapOutput(std::ostream *output_stream, int max_width)

Creates an AdvancedTclapOutput that will publish its output to the given stream.

Parameters:
  • output_stream – The stream to publish the output to (e.g. &std::cout)

  • max_width – The maximum line width of the output

void version(TCLAP::CmdLineInterface &cmd) override
void usage(TCLAP::CmdLineInterface &cmd) override
void failure(TCLAP::CmdLineInterface &cmd, TCLAP::ArgException &e) override
void setArgumentHidden(TCLAP::Arg *argument, bool hidden)

Hides / un-hides an argument.

Hidden arguments do not appear in the help or usage output.

Parameters:
  • argument – The argument to hide

  • hidden – Whether the argument shall be hidden

Protected Functions

virtual void shortUsage(TCLAP::CmdLineInterface &cmd, std::ostream &os) const
virtual void longUsage(TCLAP::CmdLineInterface &cmd, std::ostream &os) const