Base Module VST 3.6.11 SDK for developing VST Plug-in

- Main Page
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Typedefs | Functions
Steinberg::CommandLine Namespace Reference

Very simple command-line parser. More...

## Classes
class | Description
| The description of one single command-line option. More...
class | Descriptions
| List of command-line option descriptions. More...
class | VariablesMap
| Command-line parsing result. More...

## Typedefs
typedef std::vector< std::string > | FilesVector
| type of the list of elements on the command line that are not handled by options parsing More...

## Functions
bool | parse (int ac, char *av[], const Descriptions &desc, VariablesMap &result, FilesVector *files=0)
| Parse the command-line. More...
std::ostream & | operator<< (std::ostream &os, const Descriptions &desc)
| Make Descriptions stream able. More...

## Detailed Description

Very simple command-line parser.

Parses the command-line into a CommandLine::VariablesMap.
The command-line parser uses CommandLine::Descriptions to define the available options.

Example:

#include "base/source/fcommandline.h"
#include <iostream>
int main (int argc, char* argv[])
{
using namespace std;
using namespace Steinberg;
CommandLine::Descriptions desc;
CommandLine::VariablesMap valueMap;
desc.addOptions ("myTool")
("help", "produce help message")
("opt1", string(), "option 1")
("opt2", string(), "option 2")
;
CommandLine::parse (argc, argv, desc, valueMap);
if (valueMap.hasError () || valueMap.count ("help"))
{
cout << desc << "\n";
return 1;
}
if (valueMap.count ("opt1"))
{
cout << "Value of option 1 " << valueMap["opt1"] << "\n";
}
if (valueMap.count ("opt2"))
{
cout << "Value of option 2 " << valueMap["opt2"] << "\n";
}
return 0;
}

Note
  This is a "header only" implementation.
  If you need the declarations in more than one cpp file, you have to define `SMTG_NO_IMPLEMENTATION` in all but one file.

## Typedef Documentation

typedef std::vector<std::string> FilesVector

type of the list of elements on the command line that are not handled by options parsing

## Function Documentation

bool parse | ( | int | ac,
|  | char * | av[],
|  | const Descriptions & | desc,
|  | VariablesMap & | result,
|  | FilesVector * | files
| ) |  |

Parse the command-line.

Parameters

  [in] | ac | count of command-line parameters
  [in] | av | command-line as array of strings
  [in] | desc | Descriptions including all allowed options
  [out] | result | the parsing result
  [out] | files | optional list of elements on the command line that are not handled by options parsing

std::ostream & operator<< | ( | std::ostream & | os,
|  | const Descriptions & | desc
| ) |  |

Make Descriptions stream able.

Empty

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