yat
0.20.3pre
|
Class for version option. More...
#include <yat/utility/OptionVersion.h>
Public Member Functions | |
OptionVersion (CommandLine &cmd, const std::string &prog, const std::string &version, const std::string ©right_year, const std::vector< std::string > &authors, const std::string &package="", const std::string &name="v,version", const std::string &desc="output version information and exit") | |
Constructor. More... | |
std::string & | copyright_holder (void) |
std::string & | license (void) |
bool | value (void) const |
return value | |
std::string | description (void) const |
void | description (const std::string &description) |
set description More... | |
std::string | long_name (void) const |
void | parse (std::vector< std::string >::iterator &, const std::vector< std::string >::iterator &) |
parsing the commandline | |
bool | present (void) const |
Get if option was found in cmd. More... | |
std::string | print (void) |
print help output More... | |
void | reset (void) |
sets present to false | |
char | short_name (void) const |
void | validate (void) |
Validate the Option. More... | |
Protected Member Functions | |
const CommandLine & | cmd (void) const |
Class for version option.
When this option is found in parsing of commandline, it displays a version output and exits. A typical output looks like:
<prog> (<package>) <version> Copyright (C) 2022 John Doe and Jane Doe License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
theplu::yat::utility::OptionVersion::OptionVersion | ( | CommandLine & | cmd, |
const std::string & | prog, | ||
const std::string & | version, | ||
const std::string & | copyright_year, | ||
const std::vector< std::string > & | authors, | ||
const std::string & | package = "" , |
||
const std::string & | name = "v,version" , |
||
const std::string & | desc = "output version information and exit" |
||
) |
Constructor.
cmd | Commandline object |
prog | name of the program |
version | string typically taken from PACKAGE_VERSION or VERSION defined in config.h |
copyright_year | Year in 'Copyright (C) Year...' |
authors | authors |
package | if not empty, '(package) ' is added between program name and version |
name | default "v,version" implies object is associated with switches -v and –version |
desc | string output in help output (OptionHelp) |
|
protectedinherited |
std::string& theplu::yat::utility::OptionVersion::copyright_holder | ( | void | ) |
Function to change the copyright holder. The default behaviour is to set copyright holder from authors passed in constructor. If the copyright holder is altered and additional line is added at the bottom:
Written by <authors>
|
inherited |
|
inherited |
set description
std::string& theplu::yat::utility::OptionVersion::license | ( | void | ) |
Change the license information from the default
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
|
inherited |
|
inherited |
Get if option was found in cmd.
|
inherited |
print help output
This function calls the four virtual private functions print1, print2, print3, and print4. This allows an inherited class to implement one (or several) of these functions and keep the default output of the others. The default behavior is that:
|
inherited |
|
inherited |
Validate the Option.
This function is called by CommandLine::parse() after all options have been detected and parsed (see Option::parse()).