args  6.2.0
A simple single-header C++11 STL-only argument parser library
Public Member Functions | Protected Attributes | List of all members
args::ImplicitValueFlag< T, Reader > Class Template Reference

An optional argument-accepting flag class. More...

#include <args.hxx>

Inheritance diagram for args::ImplicitValueFlag< T, Reader >:
args::ValueFlag< T, ValueReader > args::ValueFlagBase args::FlagBase args::NamedBase args::Base

Public Member Functions

 ImplicitValueFlag (Group &group_, const std::string &name_, const std::string &help_, Matcher &&matcher_, const T &implicitValue_, const T &defaultValue_=T(), Options options_={})
 
 ImplicitValueFlag (Group &group_, const std::string &name_, const std::string &help_, Matcher &&matcher_, const T &defaultValue_=T(), Options options_={})
 
 ImplicitValueFlag (Group &group_, const std::string &name_, const std::string &help_, Matcher &&matcher_, Options options_)
 
virtual Nargs NumberOfArguments () const noexcept override
 Defines how many values can be consumed by this option. More...
 
virtual void ParseValue (const std::vector< std::string > &value_) override
 Parse values of this option. More...
 
- Public Member Functions inherited from args::ValueFlag< T, ValueReader >
 ValueFlag (Group &group_, const std::string &name_, const std::string &help_, Matcher &&matcher_, const T &defaultValue_, Options options_)
 
 ValueFlag (Group &group_, const std::string &name_, const std::string &help_, Matcher &&matcher_, const T &defaultValue_=T(), const bool extraError_=false)
 
 ValueFlag (Group &group_, const std::string &name_, const std::string &help_, Matcher &&matcher_, Options options_)
 
virtual void Reset () noexcept override
 
T & Get () noexcept
 Get the value.
 
const T & GetDefault () noexcept
 Get the default value.
 
- Public Member Functions inherited from args::ValueFlagBase
 ValueFlagBase (const std::string &name_, const std::string &help_, Matcher &&matcher_, const bool extraError_=false)
 
 ValueFlagBase (const std::string &name_, const std::string &help_, Matcher &&matcher_, Options options_)
 
- Public Member Functions inherited from args::FlagBase
 FlagBase (const std::string &name_, const std::string &help_, Matcher &&matcher_, const bool extraError_=false)
 
 FlagBase (const std::string &name_, const std::string &help_, Matcher &&matcher_, Options options_)
 
virtual FlagBaseMatch (const EitherFlag &flag) override
 
virtual std::vector< FlagBase * > GetAllFlags () override
 
const MatcherGetMatcher () const
 
virtual void Validate (const std::string &shortPrefix, const std::string &longPrefix) const override
 
virtual std::vector< std::string > GetProgramLine (const HelpParams &params) const override
 
virtual bool HasFlag () const override
 
- Public Member Functions inherited from args::NamedBase
 NamedBase (const std::string &name_, const std::string &help_, Options options_={})
 
void HelpDefault (const std::string &str)
 Sets default value string that will be added to argument description. More...
 
std::string HelpDefault (const HelpParams &params) const
 Gets default value string that will be added to argument description.
 
void HelpChoices (const std::vector< std::string > &array)
 Sets choices strings that will be added to argument description. More...
 
std::vector< std::string > HelpChoices (const HelpParams &params) const
 Gets choices strings that will be added to argument description.
 
virtual std::vector< std::tuple< std::string, std::string, unsigned > > GetDescription (const HelpParams &params, const unsigned indentLevel) const override
 
virtual std::string Name () const
 
- Public Member Functions inherited from args::Base
 Base (const std::string &help_, Options options_={})
 
Options GetOptions () const noexcept
 
bool IsRequired () const noexcept
 
virtual bool Matched () const noexcept
 
 operator bool () const noexcept
 
virtual std::vector< Command * > GetCommands ()
 
virtual bool IsGroup () const
 
virtual PositionalBaseGetNextPositional ()
 
virtual bool HasPositional () const
 
virtual bool HasCommand () const
 
void KickOut (bool kickout_) noexcept
 Sets a kick-out value for building subparsers.
 
bool KickOut () const noexcept
 Gets the kick-out value for building subparsers.
 

Protected Attributes

implicitValue
 
- Protected Attributes inherited from args::ValueFlag< T, ValueReader >
value
 
defaultValue
 
- Protected Attributes inherited from args::FlagBase
const Matcher matcher
 
- Protected Attributes inherited from args::NamedBase
const std::string name
 
bool kickout = false
 
std::string defaultString
 
bool defaultStringManual = false
 
std::vector< std::string > choicesStrings
 
bool choicesStringManual = false
 
- Protected Attributes inherited from args::Base
bool matched = false
 
const std::string help
 

Additional Inherited Members

- Protected Member Functions inherited from args::ValueFlag< T, ValueReader >
virtual std::string GetDefaultString (const HelpParams &) const override
 
- Protected Member Functions inherited from args::FlagBase
virtual std::string GetNameString (const HelpParams &params) const override
 
- Protected Member Functions inherited from args::NamedBase
virtual std::vector< std::string > GetChoicesStrings (const HelpParams &) const
 
void AddDescriptionPostfix (std::string &dest, const bool isManual, const std::string &manual, bool isGenerated, const std::string &generated, const std::string &str) const
 

Detailed Description

template<typename T, typename Reader = ValueReader>
class args::ImplicitValueFlag< T, Reader >

An optional argument-accepting flag class.

Template Parameters
Tthe type to extract the argument as
ReaderThe functor type used to read the argument, taking the name, value, and destination reference with operator(), and returning a bool (if ARGS_NOEXCEPT is defined)

Member Function Documentation

◆ NumberOfArguments()

template<typename T , typename Reader = ValueReader>
virtual Nargs args::ImplicitValueFlag< T, Reader >::NumberOfArguments ( ) const
inlineoverridevirtualnoexcept

Defines how many values can be consumed by this option.

Returns
closed interval [min, max]

Reimplemented from args::ValueFlagBase.

◆ ParseValue()

template<typename T , typename Reader = ValueReader>
virtual void args::ImplicitValueFlag< T, Reader >::ParseValue ( const std::vector< std::string > &  values_)
inlineoverridevirtual

Parse values of this option.

Parameters
valueVector of values. It's size must be in NumberOfArguments() interval.

Reimplemented from args::ValueFlag< T, ValueReader >.


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