|
pianod2
multisource multiuser scriptable networked music player
|
Interpreter class based on Parsnip template, customized base for pianod interpreters with the addition of help support. More...
#include <interpreter.h>


Public Types | |
| using | HelpList = PianodDispatcher::HelpList |
Public Member Functions | |
| virtual void | registerInterpreter (PianodDispatcher &dispatcher) |
| Register the interpreter with a dispatcher. More... | |
| const HelpList | getHelp (const std::vector< std::string > &search, std::set< std::string > *option_parsers) |
| Search the interpreter's definitions for any definitions matching search criteria. More... | |
Static Public Member Functions | |
| static bool | optionIs (const Parsnip::Data &options, const char *name, const char *expected) |
| Check if a string value exists and is case-blind equal to a particular value. More... | |
| template<typename ValueType , typename LookupType > | |
| static ValueType | optionalValue (const Parsnip::Data &options, const char *name, const LookupType &lookup, const ValueType default_value) |
| Retrieve the ID of a string value. More... | |
Protected Types | |
| using | StringVector = std::vector< std::string > |
Protected Member Functions | |
| virtual bool | authorizedCommand (Parsnip::Parser::CommandId command_id, PianodConnection &context)=0 |
| Check whether a command is authorized. More... | |
| virtual ResponseCollector | handleCommand (Parsnip::Parser::CommandId command_id, const Parsnip::Data ¶meters, PianodConnection &context)=0 |
| Command handler. More... | |
| virtual const Parsnip::Parser::Definitions & | getParserDefinitions ()=0 |
| Retrieve the parser definitions handled by the interpreter. More... | |
Static Protected Attributes | |
| static const Parsnip::Data | EmptyDictionary {Parsnip::Data::Dictionary} |
| An empty dictionary, often used as a default with Parsnip::Data::getOr. More... | |
| static const StringVector | EmptyStringVector |
| An empty string vector, often used as a default with Parsnip::Data::getOr. More... | |
Private Member Functions | |
| virtual ResponseCollector | interpret (Parsnip::Parser::CommandId command_id, const Parsnip::Data ¶meters, PianodConnection &context) override final |
| Authorize and execute a command. More... | |
Private Attributes | |
| friend | PianodDispatcher |
Interpreter class based on Parsnip template, customized base for pianod interpreters with the addition of help support.
|
protected |
|
protectedpure virtual |
Check whether a command is authorized.
| command_id | The command requesting execution. |
| context | Connection details, including authentication state and privileges. |
Implemented in UserManager, ToneGeneratorCommands, PandoraCommands, FilesystemCommands, Tuner::Tuner, ServiceManager, Media::Manager, and AudioEngine.

| const std::vector< std::string > PianodInterpreter::getHelp | ( | const std::vector< std::string > & | search, |
| std::set< std::string > * | option_parsers | ||
| ) |
Search the interpreter's definitions for any definitions matching search criteria.
| search | The search criteria. If empty, returns all. |
| option_parsers | Any option parsers used by matching statements are added to this set. |

|
protectedpure virtual |
Retrieve the parser definitions handled by the interpreter.
Implemented in UserManager, Tuner::Tuner, ServiceManager, ToneGeneratorCommands, PandoraCommands, Media::Manager, FilesystemCommands, and AudioEngine.

|
protectedpure virtual |
Command handler.
| command_id | Command to execute. |
| parameters | Command parameters. |
| context | Connection details, including authentication state and privileges. |
| CommandError | or other exception if an error occurs. |
Implemented in UserManager, ToneGeneratorCommands, PandoraCommands, FilesystemCommands, Tuner::Tuner, ServiceManager, Media::Manager, and AudioEngine.

|
finaloverrideprivatevirtual |
Authorize and execute a command.
| command_id | The command to execute. |
| parameters | Options for the command. |
| context | The connection and context executing the command. |
| CommandError | or any other exception. |
Implements Parsnip::Interpreter< ResponseCollector, PianodConnection & >.

|
inlinestatic |
Retrieve the ID of a string value.
| options | Where to look for the value. |
| name | The name of the value. |
| lookup | The lookup table for the value. |
| default_value | The default value, if not specified. |
| If | the value is not in the table. |


|
static |
Check if a string value exists and is case-blind equal to a particular value.
| options | The options dictionary to look in. |
| name | The name of the value to check |
| expected | The expected value. |
| If | the value has the wrong type. |


|
virtual |
Register the interpreter with a dispatcher.
| dispatcher | The dispatcher with which to register. |
Reimplemented in AudioEngine.


|
staticprotected |
An empty dictionary, often used as a default with Parsnip::Data::getOr.
|
staticprotected |
An empty string vector, often used as a default with Parsnip::Data::getOr.
|
private |