Base Module VST 3.7
SDK for developing VST plug-in
Descriptions Class Reference

List of command-line option descriptions. More...

#include <fcommandline.h>

Public Member Functions

DescriptionsaddOptions (const std::string &caption="", std::initializer_list< Description > &&options={})
 Sets the command-line tool caption and starts adding Descriptions. More...
 
bool parse (int ac, char *av[], VariablesMap &result, FilesVector *files=nullptr) const
 Parse the command-line. More...
 
void print (std::ostream &os) const
 Print a brief description for the command-line tool into the stream os. More...
 
Descriptionsoperator() (const std::string &name, const std::string &help)
 Add a new switch. More...
 
template<typename Type >
Descriptionsoperator() (const std::string &name, const Type &inType, std::string help)
 Add a new option of type inType. More...
 
template<>
Descriptionsoperator() (const std::string &name, const std::string &inType, std::string help)
 Add a new option with a string as parameter. More...
 

Detailed Description

List of command-line option descriptions.

Use addOptions (const std::string&) to add Descriptions.

Member Function Documentation

◆ addOptions()

Descriptions & addOptions ( const std::string &  caption = "",
std::initializer_list< Description > &&  options = {} 
)

Sets the command-line tool caption and starts adding Descriptions.

Usage example:

CommandLine::Descriptions desc;
desc.addOptions ("myTool") // Set caption to "myTool"
("help", "produce help message") // add switch -help
("opt1", string(), "option 1") // add string option -opt1
("opt2", string(), "option 2") // add string option -opt2
;
Note
The operator() is used for every additional option.

Or with initializer list :

CommandLine::Descriptions desc;
desc.addOptions ("myTool", // Set caption to "myTool"
{{"help", "produce help message", Description::kBool}, // add switch -help
{"opt1", "option 1", Description::kString}, // add string option -opt1
{"opt2", "option 2", Description::kString}} // add string option -opt2
);
static const std::string kBool
Definition: fcommandline.h:152
static const std::string kString
Definition: fcommandline.h:153
Parameters
[in]captionthe caption of the command-line tool.
[in]optionsinitializer list with options
Returns
a reverense to *this.

◆ parse()

bool parse ( int  ac,
char *  av[],
VariablesMap result,
FilesVector files = nullptr 
) const

Parse the command-line.

Parameters
[in]account of command-line parameters
[in]avcommand-line as array of strings
[out]resultthe parsing result
[out]filesoptional list of elements on the command line that are not handled by options parsing

◆ print()

void print ( std::ostream &  os) const

Print a brief description for the command-line tool into the stream os.

The description includes the help strings for all options.

◆ operator()() [1/3]

Descriptions & operator() ( const std::string &  name,
const std::string &  help 
)

Add a new switch.

Only

Returning a reference to *this, enables chaining of calls to operator()(const std::string&, const std::string&).

Parameters
[in]nameof the added option.
[in]helpa help description for this option.
Returns
a reference to *this.

◆ operator()() [2/3]

Descriptions & operator() ( const std::string &  name,
const Type &  inType,
std::string  help 
)

Add a new option of type inType.

Currently only std::string is supported.

◆ operator()() [3/3]

Descriptions & operator() ( const std::string &  name,
const std::string &  inType,
std::string  help 
)

Add a new option with a string as parameter.

Empty

Copyright © Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.