Command  0.3
Public Types | Public Member Functions | Protected Attributes | List of all members
command::Argument< ParameterType > Class Template Reference

#include <argument.h>

Inheritance diagram for command::Argument< ParameterType >:
[legend]
Collaboration diagram for command::Argument< ParameterType >:
[legend]

Public Types

typedef class Argument Type
 
- Public Types inherited from command::Parameter
typedef class Parameter Type
 

Public Member Functions

 Argument (const std::string &description, std::function< void(ParameterType)> function)
 
virtual void handle ()
 
virtual bool understand (const std::string &argv)
 
virtual unsigned int valuePosition (const std::string &)
 
- Public Member Functions inherited from command::Parameter
 Parameter (const std::string &description)
 
virtual void handle ()=0
 
virtual bool understand (const std::string &)=0
 
virtual bool isRequired ()
 
virtual bool isUsed ()
 
virtual bool hungryForValue ()
 
virtual unsigned int valuePosition (const std::string &)=0
 
- Public Member Functions inherited from command::Descriptive
 Descriptive (const std::string &description)
 
const std::string & describe ()
 
- Public Member Functions inherited from command::Callable< ParameterType >
 Callable (std::function< void(ParameterType)> function)
 

Protected Attributes

ParameterType value
 
- Protected Attributes inherited from command::Parameter
bool used = false
 
- Protected Attributes inherited from command::Callable< ParameterType >
std::function< void(ParameterType)> func
 

Additional Inherited Members

- Protected Member Functions inherited from command::Callable< ParameterType >
void call (ParameterType value)
 

Detailed Description

template<typename ParameterType>
class command::Argument< ParameterType >

Class responsible for handling commandline arguments. Arguments are non-named parameters of program.

Example:

Constructor & Destructor Documentation

◆ Argument()

template<typename ParameterType >
command::Argument< ParameterType >::Argument ( const std::string &  description,
std::function< void(ParameterType)>  function 
)
inline

Default constructor.

Parameters
descriptionDescription of current Argument
functionFunction used to handle current Argument.

Member Function Documentation

◆ handle()

template<typename ParameterType >
virtual void command::Argument< ParameterType >::handle ( )
inlinevirtual

Method used for handling method calls linked with this Parameter

Implements command::Parameter.

◆ understand()

template<typename ParameterType >
virtual bool command::Argument< ParameterType >::understand ( const std::string &  argv)
inlinevirtual

Method used for checking if Argument understands user value. If so current Argument is flagged as used and no more checks against it will be done in future.

Attention
If conversion from passed value to ParameterType is impossible, it is ignored. It means that it is not understanded by Argument.
Parameters
argvcommand line value against which test will be made.
Returns
If passed argv is succesfully converted to ParameterType, returns true and Argument is set as used one. If there was an error during conversion, method returns false and can be used to check against next value.

Implements command::Parameter.

◆ valuePosition()

template<typename ParameterType >
virtual unsigned int command::Argument< ParameterType >::valuePosition ( const std::string &  )
inlinevirtual

Returns
position where value starts in passed string

Implements command::Parameter.


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