HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
OptionParser Class Reference

Option parser for SET command. More...

Classes

struct  OptionDef
 Option definition structure for SET command options. More...
 

Static Public Member Functions

static const OptionDefFindOption (const std::string &name)
 Find a supported option definition by token.
 
static bool ParseOptions (const std::vector< std::string > &tokens, std::vector< std::pair< OptionType, std::vector< std::string > > > &options)
 Parse SET command options from a token sequence.
 
static const OptionDefGetOptionDef (OptionType type)
 Get an option definition by OptionType.
 

Detailed Description

Option parser for SET command.

Member Function Documentation

◆ FindOption()

static const OptionDef * OptionParser::FindOption ( const std::string & name)
inlinestatic

Find a supported option definition by token.

Parameters
nameToken such as "-f", "--frequency", etc.
Returns
Pointer to the matching definition, or nullptr if unknown.

◆ GetOptionDef()

static const OptionDef * OptionParser::GetOptionDef ( OptionType type)
inlinestatic

Get an option definition by OptionType.

Parameters
typeOption type enum.
Returns
Pointer to the definition, or nullptr if not found.

◆ ParseOptions()

static bool OptionParser::ParseOptions ( const std::vector< std::string > & tokens,
std::vector< std::pair< OptionType, std::vector< std::string > > > & options )
inlinestatic

Parse SET command options from a token sequence.

Supports both flag-style (e.g. -f 0.5) and word-style (e.g. frequency 0.5) options. Multiple options may be specified.

Parameters
tokensTokens following the "set" verb.
optionsOutput vector of parsed options and their argument strings.
Returns
true if parsing succeeded; false if tokens are malformed.
Here is the caller graph for this function:

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