paludis  Version 2.6.0
Public Member Functions | Protected Member Functions | Friends | List of all members
paludis::args::ArgsOption Class Referenceabstract

#include <args_option.hh>

+ Inheritance diagram for paludis::args::ArgsOption:

Public Member Functions

void remove ()
 
const std::string & long_name () const
 
char short_name () const
 
const std::string & description () const
 
virtual bool specified () const
 
virtual bool explicitly_specified () const
 
virtual void set_specified (const ArgsOptionSpecifiedness value)
 
ArgsGroupgroup ()
 
virtual bool can_be_negated () const =0
 
virtual const std::string forwardable_string () const PALUDIS_ATTRIBUTE((warn_unused_result))=0
 
virtual const std::shared_ptr< Sequence< std::string > > forwardable_args () const PALUDIS_ATTRIBUTE((warn_unused_result))=0
 
- Public Member Functions inherited from paludis::DeclareAbstractAcceptMethods< ArgsOption, MakeTypeList< StringArg, AliasArg, SwitchArg, IntegerArg, EnumArg, StringSetArg, StringSequenceArg >::Type >
void accept (UnwrappedVisitor_ &v)
 
void accept (UnwrappedVisitor_ &v) const
 
void accept (const UnwrappedVisitor_ &v)
 
void accept (const UnwrappedVisitor_ &v) const
 
Result_ accept_returning (UnwrappedVisitor_ &v, const Result_ &r=Result_())
 
Result_ accept_returning (const UnwrappedVisitor_ &v, const Result_ &r=Result_())
 
Result_ accept_returning (UnwrappedVisitor_ &v, const Result_ &r=Result_()) const
 
Result_ accept_returning (const UnwrappedVisitor_ &v, const Result_ &r=Result_()) const
 
auto make_accept_returning (const Case_ &firstcase, const Cases_ &...cases) const -> CallResultType< Case_ >
 
void make_accept (const Cases_ &...cases) const
 

Protected Member Functions

 ArgsOption (ArgsGroup *const, const std::string &long_name, const char short_name, const std::string &description)
 
virtual ~ArgsOption ()
 

Friends

class ArgsHandler
 

Additional Inherited Members

- Public Types inherited from paludis::DeclareAbstractAcceptMethods< ArgsOption, MakeTypeList< StringArg, AliasArg, SwitchArg, IntegerArg, EnumArg, StringSetArg, StringSequenceArg >::Type >
typedef MakeTypeList< StringArg, AliasArg, SwitchArg, IntegerArg, EnumArg, StringSetArg, StringSequenceArg >::Type VisitableTypeList
 
typedef ArgsOption VisitableBaseClass
 

Detailed Description

Base class for a command line option.

Constructor & Destructor Documentation

paludis::args::ArgsOption::ArgsOption ( ArgsGroup const,
const std::string &  long_name,
const char  short_name,
const std::string &  description 
)
protected

Constructor.

virtual paludis::args::ArgsOption::~ArgsOption ( )
protectedvirtual

Destructor.

Member Function Documentation

virtual bool paludis::args::ArgsOption::can_be_negated ( ) const
pure virtual
const std::string& paludis::args::ArgsOption::description ( ) const
inline

Fetch our description.

virtual bool paludis::args::ArgsOption::explicitly_specified ( ) const
inlinevirtual

Fetch whether or not we were explicitly (not an env var) specified. Used to catch -x y -x z where -x takes a single value.

Reimplemented in paludis::args::AliasArg.

Referenced by paludis::args::AliasArg::explicitly_specified().

virtual const std::shared_ptr<Sequence<std::string> > paludis::args::ArgsOption::forwardable_args ( ) const
pure virtual

Ourself as a sequence of strings.

For example, { '–foo', 'bar' } or { '–foo', 'bar', '–foo', 'baz' } if not specified, an empty sequence.

Since
0.46

Implemented in paludis::args::EnumArg, paludis::args::IntegerArg, paludis::args::AliasArg, paludis::args::StringSequenceArg, paludis::args::StringSetArg, paludis::args::StringArg, and paludis::args::SwitchArg.

virtual const std::string paludis::args::ArgsOption::forwardable_string ( ) const
pure virtual

Ourself as a forwardable string.

For example, '–foo bar' or '–foo bar –foo baz' or '–foo', or if not specified, the empty string.

Since
0.40

Implemented in paludis::args::EnumArg, paludis::args::IntegerArg, paludis::args::AliasArg, paludis::args::StringSequenceArg, paludis::args::StringSetArg, paludis::args::StringArg, and paludis::args::SwitchArg.

ArgsGroup* paludis::args::ArgsOption::group ( )
inline

Fetch our group.

References PALUDIS_ATTRIBUTE.

const std::string& paludis::args::ArgsOption::long_name ( ) const
inline

Fetch our long name.

void paludis::args::ArgsOption::remove ( )

Remove this option. Removes our group from its section if the group would be left empty.

virtual void paludis::args::ArgsOption::set_specified ( const ArgsOptionSpecifiedness  value)
inlinevirtual

Set the value returned by specified().

Reimplemented in paludis::args::AliasArg.

Referenced by paludis::args::AliasArg::set_specified().

char paludis::args::ArgsOption::short_name ( ) const
inline

Fetch our short name (may be 0).

virtual bool paludis::args::ArgsOption::specified ( ) const
inlinevirtual

Fetch whether or not we were specified on the command line (or as an env var).

Reimplemented in paludis::args::AliasArg.

Referenced by examples::show_version_and_exit(), and paludis::args::AliasArg::specified().


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