pianod2
multisource multiuser scriptable networked music player
Functions | Variables
interpreter.cpp File Reference

pianod command processing. More...

#include <cctype>
#include <cstring>
#include <set>
#include <parsnip/parsnip_command.h>
#include <parsnip/parsnip_argv.h>
#include "fundamentals.h"
#include "interpreter.h"
Include dependency graph for interpreter.cpp:

Functions

static bool helpMatches (std::string help, const std::vector< std::string > search)
 Determine if search criteria match a help string. More...
 
static std::string simplify_statement (const std::string &statement, std::set< std::string > *option_parsers)
 Remove cruft from a statement definition to clean up its presentation as help. More...
 
static std::string getRequestName (const Parsnip::Data &request, const std::set< std::string > &ignore=IgnoreNothing)
 Retrieve the request name by searching keys in a dictionary. More...
 
static void rewrite_push (const char *name, Parsnip::Data *piece, Parsnip::Data *request)
 Move pieces of requests into a tree structure for execution. More...
 

Variables

static const std::set< std::string > IgnoreNothing
 Empty set. More...
 

Detailed Description

pianod command processing.

Function Documentation

◆ getRequestName()

static std::string getRequestName ( const Parsnip::Data request,
const std::set< std::string > &  ignore = IgnoreNothing 
)
static

Retrieve the request name by searching keys in a dictionary.

Parameters
requestThe request.
ignoreA set of keys to ignore.
Returns
The request name.
Exceptions
Commanderror if there are no keys or multiple non-ignored keys in the dictionary.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ helpMatches()

static bool helpMatches ( std::string  help,
const std::vector< std::string >  search 
)
static

Determine if search criteria match a help string.

Parameters
helpThe help string to check.
searchA list of search criteria (words).
Returns
True if the search matches, false otherwise.
Here is the caller graph for this function:

◆ rewrite_push()

static void rewrite_push ( const char *  name,
Parsnip::Data piece,
Parsnip::Data request 
)
static

Move pieces of requests into a tree structure for execution.

Parameters
nameThe new name of the piece being moved.
pieceThe piece being moved. If nullptr, then nothing is performed.
requestThe existing request. On return, the moved piece is moved to wrap this.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simplify_statement()

static std::string simplify_statement ( const std::string &  statement,
std::set< std::string > *  option_parsers 
)
static

Remove cruft from a statement definition to clean up its presentation as help.

Parameters
statementThe statement to clean up.
option_parsersIf the statement references option parsers, they are added to the set.
Returns
The statement, ready for presentation as help.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ IgnoreNothing

const std::set<std::string> IgnoreNothing
static

Empty set.