libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
CmdLineParser::Option Class Reference

Describes a single command-line option. More...

#include <cmdlineparser.h>

Collaboration diagram for CmdLineParser::Option:

Public Types

enum  ArgType {
  ArgNone , ArgBool , ArgString , ArgInt ,
  ArgDouble , ArgUnknown
}
 Enumerates the argument types an option can accept. More...
 

Public Member Functions

 Option ()=default
 Default constructor.
 
 Option (char sn, const String &ln, const String &d, OptionCallbackVariant cb)
 Constructs an option with all fields.
 
ArgType argType () const
 Returns the argument type inferred from the callback variant.
 

Public Attributes

char shortName = 0
 Single-character short option name, or 0 if none.
 
String longName
 Long option name, or empty if none.
 
String desc
 Description shown in usage/help text.
 
OptionCallbackVariant callback
 Typed callback invoked when this option is parsed.
 

Detailed Description

Describes a single command-line option.

Each option has an optional single-character short name, an optional long name, a description for help text, and a typed callback.

Member Enumeration Documentation

◆ ArgType

Enumerates the argument types an option can accept.

Enumerator
ArgNone 

No argument required.

ArgBool 

Boolean argument.

ArgString 

String argument.

ArgInt 

Integer argument.

ArgDouble 

Double argument.

ArgUnknown 

Unknown or unsupported type.

Constructor & Destructor Documentation

◆ Option()

CmdLineParser::Option::Option ( char  sn,
const String ln,
const String d,
OptionCallbackVariant  cb 
)
inline

Constructs an option with all fields.

Parameters
snShort name character (0 for none).
lnLong name string.
dDescription for help text.
cbTyped callback variant.

Member Function Documentation

◆ argType()

ArgType CmdLineParser::Option::argType ( ) const
inline

Returns the argument type inferred from the callback variant.

Returns
The ArgType corresponding to the held callback type.

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