This is intended to be the base class for most general-purpose utility programs in the PANDATOOL tree. More...
#include "programBase.h"
Public Types | |
typedef pdeque< std::string > | Args |
Public Member Functions | |
ProgramBase (const std::string &name=std::string()) | |
std::string | get_exec_command () const |
Returns the command that invoked this program, as a shell-friendly string, suitable for pasting into the comments of output files. More... | |
virtual void | parse_command_line (int argc, char **argv) |
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_args(). More... | |
void | show_description () |
Writes the program description to stderr. More... | |
void | show_options () |
Describes each of the available options to stderr. More... | |
void | show_text (const std::string &text) |
Formats the indicated text to stderr with the known _terminal_width. More... | |
void | show_text (const std::string &prefix, int indent_width, std::string text) |
Formats the indicated text and its prefix for output to stderr with the known _terminal_width. More... | |
void | show_usage () |
Writes the usage line(s) to stderr. More... | |
void | write_man_page (std::ostream &out) |
Generates a man page in nroff syntax based on the description and options. More... | |
Public Attributes | |
Args | _program_args |
Filename | _program_name |
This is intended to be the base class for most general-purpose utility programs in the PANDATOOL tree.
It automatically handles things like command-line arguments in a portable way.
Definition at line 34 of file programBase.h.
string ProgramBase::get_exec_command | ( | ) | const |
Returns the command that invoked this program, as a shell-friendly string, suitable for pasting into the comments of output files.
Definition at line 455 of file programBase.cxx.
References Filename::get_basename_wo_extension().
|
virtual |
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_args().
If an error on the command line is detected, will automatically call show_usage() and exit(1).
Definition at line 274 of file programBase.cxx.
References Filename::from_os_specific(), and preprocess_argv().
void ProgramBase::show_description | ( | ) |
Writes the program description to stderr.
Definition at line 129 of file programBase.cxx.
void ProgramBase::show_options | ( | ) |
Describes each of the available options to stderr.
Definition at line 152 of file programBase.cxx.
|
inline |
Formats the indicated text to stderr with the known _terminal_width.
Definition at line 18 of file programBase.I.
void ProgramBase::show_text | ( | const std::string & | prefix, |
int | indent_width, | ||
std::string | text | ||
) |
Formats the indicated text and its prefix for output to stderr with the known _terminal_width.
Definition at line 174 of file programBase.cxx.
void ProgramBase::show_usage | ( | ) |
Writes the usage line(s) to stderr.
Definition at line 137 of file programBase.cxx.
void ProgramBase::write_man_page | ( | std::ostream & | out | ) |
Generates a man page in nroff syntax based on the description and options.
This is useful when creating a man page for this utility.
Definition at line 189 of file programBase.cxx.
References Filename::get_basename_wo_extension().