Interactive CLI 2.3
A cross-platform C++14 library for interactive command-line interfaces
Loading...
Searching...
No Matches
cli::Menu Class Reference

#include <menu.h>

Inheritance diagram for cli::Menu:

Public Member Functions

 Menu (const Menu &)=delete
Menu & operator= (const Menu &)=delete
 Menu (Menu &&)=delete
Menu & operator= (Menu &&)=delete
 Menu ()
 Menu (const std::string &_name, std::string desc="(menu)", const std::string &_prompt="", std::function< void(std::ostream &)> _onEnter={})
template<typename R, typename ... Args>
CmdHandler Insert (const std::string &cmdName, R(*f)(std::ostream &, Args...), const std::string &help, const std::vector< std::string > &parDesc={})
template<typename F>
CmdHandler Insert (const std::string &cmdName, F f, const std::string &help="", const std::vector< std::string > &parDesc={})
template<typename F>
CmdHandler Insert (const std::string &cmdName, const std::vector< std::string > &parDesc, F f, const std::string &help="")
CmdHandler Insert (std::unique_ptr< Command > &&cmd)
CmdHandler Insert (std::unique_ptr< Menu > &&menu)
bool Exec (const std::vector< std::string > &cmdLine, CliSession &session) override
bool ExecParent (const std::vector< std::string > &cmdLine, CliSession &session)
bool ScanCmds (const std::vector< std::string > &cmdLine, CliSession &session)
std::string Prompt () const
void EnterAction (const std::function< void(std::ostream &)> &action)
void OnEnter (std::ostream &out) const
void MainHelp (detail::HelpGroup &entries)
void Help (detail::HelpGroup &entries) const override
std::vector< std::string > GetCompletions (const std::string &currentLine) const
std::vector< std::string > GetCompletionRecursive (const std::string &line) const override
Public Member Functions inherited from cli::Command
 Command (std::string _name)
virtual ~Command () noexcept=default
 Command (const Command &)=delete
 Command (Command &&)=delete
Command & operator= (const Command &)=delete
Command & operator= (Command &&)=delete
virtual void Enable ()
virtual void Disable ()

Additional Inherited Members

Protected Member Functions inherited from cli::Command
const std::string & Name () const
bool IsEnabled () const

Detailed Description

Definition at line 51 of file menu.h.

Constructor & Destructor Documentation

◆ Menu() [1/4]

cli::Menu::Menu ( const Menu & )
delete
Here is the caller graph for this function:

◆ Menu() [2/4]

cli::Menu::Menu ( Menu && )
delete

◆ Menu() [3/4]

cli::Menu::Menu ( )
inline

Definition at line 59 of file menu.h.

◆ Menu() [4/4]

cli::Menu::Menu ( const std::string & _name,
std::string desc = "(menu)",
const std::string & _prompt = "",
std::function< void(std::ostream &)> _onEnter = {} )
inlineexplicit

Definition at line 61 of file menu.h.

Member Function Documentation

◆ EnterAction()

void cli::Menu::EnterAction ( const std::function< void(std::ostream &)> & action)
inline

Definition at line 129 of file menu.h.

◆ Exec()

bool cli::Menu::Exec ( const std::vector< std::string > & cmdLine,
CliSession & session )
inlineoverridevirtual

Implements cli::Command.

Definition at line 103 of file menu.h.

◆ ExecParent()

bool cli::Menu::ExecParent ( const std::vector< std::string > & cmdLine,
CliSession & session )
inline

Definition at line 108 of file menu.h.

◆ GetCompletionRecursive()

std::vector< std::string > cli::Menu::GetCompletionRecursive ( const std::string & line) const
inlineoverridevirtual

Reimplemented from cli::Command.

Definition at line 170 of file menu.h.

◆ GetCompletions()

std::vector< std::string > cli::Menu::GetCompletions ( const std::string & currentLine) const
inline

Definition at line 159 of file menu.h.

◆ Help()

void cli::Menu::Help ( detail::HelpGroup & entries) const
inlineoverridevirtual

Implements cli::Command.

Definition at line 149 of file menu.h.

◆ Insert() [1/5]

template<typename F>
CmdHandler cli::Menu::Insert ( const std::string & cmdName,
const std::vector< std::string > & parDesc,
F f,
const std::string & help = "" )
inline

Definition at line 81 of file menu.h.

◆ Insert() [2/5]

template<typename F>
CmdHandler cli::Menu::Insert ( const std::string & cmdName,
F f,
const std::string & help = "",
const std::vector< std::string > & parDesc = {} )
inline

Definition at line 75 of file menu.h.

◆ Insert() [3/5]

template<typename R, typename ... Args>
CmdHandler cli::Menu::Insert ( const std::string & cmdName,
R(* f )(std::ostream &, Args...),
const std::string & help,
const std::vector< std::string > & parDesc = {} )

Definition at line 241 of file menu.h.

Here is the caller graph for this function:

◆ Insert() [4/5]

CmdHandler cli::Menu::Insert ( std::unique_ptr< Command > && cmd)
inline

Definition at line 86 of file menu.h.

◆ Insert() [5/5]

CmdHandler cli::Menu::Insert ( std::unique_ptr< Menu > && menu)
inline

Definition at line 94 of file menu.h.

◆ MainHelp()

void cli::Menu::MainHelp ( detail::HelpGroup & entries)
inline

Definition at line 140 of file menu.h.

◆ OnEnter()

void cli::Menu::OnEnter ( std::ostream & out) const
inline

Definition at line 134 of file menu.h.

Here is the caller graph for this function:

◆ operator=() [1/2]

Menu & cli::Menu::operator= ( const Menu & )
delete

◆ operator=() [2/2]

Menu & cli::Menu::operator= ( Menu && )
delete

◆ Prompt()

std::string cli::Menu::Prompt ( ) const
inline

Definition at line 124 of file menu.h.

◆ ScanCmds()

bool cli::Menu::ScanCmds ( const std::vector< std::string > & cmdLine,
CliSession & session )
inline

Definition at line 113 of file menu.h.


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