pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
pftool Class Reference

The type of menu we are constructing. More...

#include <pftool.h>

Inheritance diagram for pftool:
[legend]
Collaboration diagram for pftool:
[legend]

Classes

class  State
 static variables to share across menu More...
 

Static Public Attributes

static State state {}
 actual instance of the state
 
- Static Public Attributes inherited from pflib::menu::BaseMenu
static std::string output_directory = ""
 output directory to include in default path
 
static std::string timestamp_format = "_%Y%m%d_%H%M%S"
 format of timestamp to append to default path
 

Additional Inherited Members

- Public Types inherited from pflib::menu::Menu< Target * >
using TargetHandle
 the type of target this menu will hold and pass around
 
using SingleTargetCommand
 type of function which does something with the target
 
using MultipleTargetCommands
 type of function which does one of several commands with target
 
using RenderFuncType
 The type of function used to "render" a menu.
 
- Public Member Functions inherited from pflib::menu::Menu< Target * >
Menuline (const char *name, const char *desc, SingleTargetCommand ex, unsigned int category=0)
 declare a single target command with thei nput name and desc
 
Menuline (const char *name, const char *desc, MultipleTargetCommands ex, unsigned int category=0)
 declare a single target command with the input name and desc
 
std::shared_ptr< Menusubmenu (const char *name, const char *desc, RenderFuncType f=0, unsigned int category=0)
 declare a sub menu of us with input name and desc
 
void build ()
 Go through and build each of the lines in this menu.
 
 Menu (const Menu &)=delete
 no copying
 
 Menu (RenderFuncType f=0, unsigned int hidden_categories=0)
 Construct a menu with a rendering function.
 
void operator= (const Menu &)=delete
 no copying
 
void hide (unsigned int categories)
 set hidden categories
 
void print (std::ostream &s, int indent=0) const
 Print menu without running it.
 
void render (TargetHandle tgt) const
 render this menu to the user
 
void enter (TargetHandle tgt) const
 entered this menu
 
void steer (TargetHandle p_target) const
 give control over the target to this menu
 
- Static Public Member Functions inherited from pflib::menu::Menu< Target * >
static Menuroot ()
 Retreve a pointer to the root menu.
 
static void run (TargetHandle tgt)
 Call this function when ready to run.
 
static std::shared_ptr< Menumenu (const char *name, const char *desc, RenderFuncType render_func=0, unsigned int category=0)
 Construct a new menu with the root as parent and optional rendering.
 
- Static Public Member Functions inherited from pflib::menu::BaseMenu
static void set_history_filepath (std::string fp)
 Decide where the filepath for reading/writing the history should be.
 
static void open_history ()
 open history and read from file (if it exists)
 
static void close_history ()
 close up history
 
static std::string readline (const std::string &prompt, const std::string &defval, bool preserve_last_blank=false)
 Read in a parameter using the default value if nothing provided.
 
static std::string readline_nosplit (const std::string &prompt, const std::string &defval)
 Get a raw input value without the additional splitting and modifications done in base readline.
 
static std::string readline (const std::string &prompt)
 Read a string parameter without a default.
 
static std::string readline (const std::string &prompt, const std::vector< std::string > &opts, const std::string &def="")
 Read a string parameter without a default but with the input list of options for tab-completion.
 
static std::string default_path (const std::string &name, const std::string &extension="")
 Create a default path from the output directory and timestamp format parameters.
 
static std::string readline_path (const std::string &name, const std::string &extension="")
 Read a path from the user using default_path to generate a default value.
 
static int readline_int (const std::string &prompt)
 Read an integer parameter without a default.
 
static int readline_int (const std::string &prompt, int aval, bool ashex=false)
 Read an integer parameter with a default.
 
static double readline_float (const std::string &prompt)
 Read a float parameter with a default.
 
static bool readline_bool (const std::string &prompt, bool aval)
 Read a bool parameter with a default.
 
static std::string readline_cmd ()
 Read a command from the menu.
 
static void add_to_command_queue (const std::string &str)
 Add to the queue of commands to execute automatically.
 
- Protected Member Functions inherited from pflib::menu::BaseMenu
void add_to_history (const std::string &cmd) const
 Add a command to the history of commands that have been executed.
 
- Static Protected Attributes inherited from pflib::menu::BaseMenu
static std::list< std::stringcmdTextQueue_
 the ordered list of commands to be executed from a script file
 
static std::vector< std::stringcmd_options_
 the current command options (for interfacing with readline's tab completion)
 
static const std::vector< std::string > * rl_comp_opts_
 a pointer to the list of options when attempting readline completion
 
::pflib::logging::logger the_log_ = ::pflib::logging::get("menu")
 

Detailed Description

The type of menu we are constructing.

We inherit from the base menu class so we can hold a static State of the menu.

Member Data Documentation

◆ state

pftool::State pftool::state {}
static

actual instance of the state

initial definition of the menu state


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