sptk2 logo
SPTK Home Page
Public Member Functions | List of all members
sptk::CommandLine::CommandLineOption Class Reference

#include <CommandLine.h>

Inheritance diagram for sptk::CommandLine::CommandLineOption:
sptk::CommandLine::CommandLineElement

Public Member Functions

 CommandLineOption (const String &name, const String &shortName, const Visibility &useWithCommands, const String &help)
 
 ~CommandLineOption () override=default
 
bool hasValue () const override
 
CommandLineElement::Type type () const override
 
String printableName () const override
 
- Public Member Functions inherited from sptk::CommandLine::CommandLineElement
 CommandLineElement (const String &name, const String &shortName, const String &help, const Visibility &useWithCommands)
 
virtual ~CommandLineElement ()=default
 
virtual Type type () const
 
virtual String name () const
 
virtual String shortName () const
 
virtual bool hasValue () const
 
virtual void validate (const String &value) const
 
virtual String printableName () const
 
bool useWithCommand (const String &command) const
 
void formatHelp (size_t textWidth, Strings &formattedText) const
 
void printHelp (size_t nameWidth, size_t textWidth, const String &optionDefaultValue) const
 

Additional Inherited Members

- Public Types inherited from sptk::CommandLine::CommandLineElement
enum class  Type { IS_UNKNOWN , IS_COMMAND , IS_OPTION , IS_VALUE_OPTION }
 

Detailed Description

Command line option

Command line argument that starts from '-' character and doesn't expect a value. It may have a long name that starts from '–', and/or a short name, that starts from '-'.

Constructor & Destructor Documentation

◆ CommandLineOption()

sptk::CommandLine::CommandLineOption::CommandLineOption ( const String name,
const String shortName,
const Visibility useWithCommands,
const String help 
)

Constructor

Parameters
nameElement name
shortNameShort element name (single character, options only)
useWithCommandsElement visibility for a command (options only)
helpHelp (description) for the element

◆ ~CommandLineOption()

sptk::CommandLine::CommandLineOption::~CommandLineOption ( )
overridedefault

Destructor

Member Function Documentation

◆ hasValue()

bool sptk::CommandLine::CommandLineOption::hasValue ( ) const
overridevirtual

Returns true if element expects value

Reimplemented from sptk::CommandLine::CommandLineElement.

◆ printableName()

String sptk::CommandLine::CommandLineOption::printableName ( ) const
overridevirtual

Returns element name in help print format

Reimplemented from sptk::CommandLine::CommandLineElement.

◆ type()

CommandLineElement::Type sptk::CommandLine::CommandLineOption::type ( ) const
overridevirtual

Returns element type

Reimplemented from sptk::CommandLine::CommandLineElement.


The documentation for this class was generated from the following file:

Fri Oct 14 2022 09:58:38: SPTK 5.4.1