senf::console::factory::Command Class Reference

OverloadedCommandNode factory. More...

#include <senf/Utils/Console/ParsedCommand.hh>

Inheritance diagram for senf::console::factory::Command:

Public Types

typedef OverloadedCommandNode node_type
 
typedef unspecified result_type
 
- Public Types inherited from senf::console::ParsedArgumentAttributor< Overload, index, flag >
typedef senf::function_traits_arg_type< typename Overload::traits, int(index) >::type arg_type
 
typedef senf::remove_cvref< arg_type >::type value_type
 
typedef ParsedArgumentAttributor< Overload, index+1 > next_type
 
- Public Types inherited from senf::console::ParsedCommandAttributorBase
typedef OverloadedCommandNode node_type
 
typedef OverloadedCommandNoderesult_type
 

Public Member Functions

 Command (unspecified fn)
 Create a node calling fn. More...
 
template<class Signature >
 Command (unspecified fn)
 Create a node calling fn with signature Signature. More...
 
 Command (member_function_pointer fn, Owner const *owner)
 Create a node calling member function fn on owner. More...
 
template<class Signature >
 Command (member_function_pointer fn, Owner const *owner)
 Create a node calling member function fn on owner with the given Signature. More...
 
- Public Member Functions inherited from senf::console::ParsedArgumentAttributor< Overload, index, flag >
next_type arg () const
 Set argument attributes. More...
 
- Public Member Functions inherited from senf::console::ParsedArgumentAttributorBase< Overload, ParsedArgumentAttributor< Overload, index, flag > >
ParsedArgumentAttributor< Overload, index, flag > doc (std::string const &doc)
 Set documentation for all overloads. More...
 
ParsedArgumentAttributor< Overload, index, flag > shortdoc (std::string const &doc)
 Set short documentation for all overloads. More...
 
ParsedArgumentAttributor< Overload, index, flag > overloadDoc (std::string const &doc)
 Set overload specific documentation. More...
 
ParsedArgumentAttributor< Overload, index, flag > formatter (typename Overload::Formatter formatter)
 Set return value formatter. More...
 
- Public Member Functions inherited from senf::console::ParsedCommandAttributor< Overload >
Overload & overload () const
 Get the command overload. More...
 

Additional Inherited Members

- Protected Member Functions inherited from senf::console::ParsedArgumentAttributorBase< Overload, ParsedArgumentAttributor< Overload, index, flag > >
 ParsedArgumentAttributorBase (typename Overload::ptr overload, unsigned index)
 
 ParsedArgumentAttributorBase (ParsedCommandAttributorBase const &other, unsigned index)
 
- Protected Member Functions inherited from senf::console::ParsedCommandAttributor< Overload >
 ParsedCommandAttributor (typename Overload::ptr overload, unsigned index)
 
 ParsedCommandAttributor (ParsedCommandAttributorBase const &other, unsigned index)
 
- Protected Member Functions inherited from senf::console::ParsedCommandAttributorBase
 ParsedCommandAttributorBase (ParsedCommandOverloadBase::ptr overload, unsigned index)
 
 ParsedCommandAttributorBase (ParsedCommandAttributorBase const &other, unsigned index)
 
void argName (std::string const &name)
 
void argDoc (std::string const &doc)
 
void typeName (std::string const &doc)
 
void defaultDoc (std::string const &doc)
 
ParsedCommandOverloadBaseoverload () const
 
void overloadDoc (std::string const &doc)
 
void nodeDoc (std::string const &doc)
 
void shortDoc (std::string const &doc)
 

Detailed Description

OverloadedCommandNode factory.

This factory will create new OverloadedCommandNode instances or add new overloads to an existing OverloadedCommandNode. The factory supports automatic argument parsing.

Commands are added to the tree using

namespace fty = senf::console::factory;
node.add("name", fty::Command(function));
    The Command factory supports the following features:
    \li Automatic argument parsing
    \li Automatic binding of member functions. Pass the owning instance as second argument to
        the factory
    \li Conversion to a compatible signature. Pass the signature as template argument to the
        factory

    If the signature of the command added matches
void (std::ostream &, senf::console::ParsedCommandInfo const &)

The command is added using manual argument parsing, otherwise it is added using automatic argument parsing.

See the List of all members for additional attributes.

Note
This class is for exposition only, the real interface consists of several overloaded factory functions.
See also
Manually parsing command arguments
Automatic argument parsing

Definition at line 604 of file ParsedCommand.hh.

Member Typedef Documentation

◆ node_type

◆ result_type

Definition at line 608 of file ParsedCommand.hh.

Constructor & Destructor Documentation

◆ Command() [1/4]

senf::console::factory::Command::Command ( unspecified  fn)

Create a node calling fn.

◆ Command() [2/4]

template<class Signature >
senf::console::factory::Command::Command ( unspecified  fn)

Create a node calling fn with signature Signature.

The given Signature must be compatible with fn for each argument and the return value.

◆ Command() [3/4]

senf::console::factory::Command::Command ( member_function_pointer  fn,
Owner const *  owner 
)

Create a node calling member function fn on owner.

◆ Command() [4/4]

template<class Signature >
senf::console::factory::Command::Command ( member_function_pointer  fn,
Owner const *  owner 
)

Create a node calling member function fn on owner with the given Signature.

The given Signature must be compatible with fn for each argument and the return value.


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