paludis Version 3.0.2
The one true package mangler
paludis::args::EnumArg Class Reference

#include <args_option.hh>

Inheritance diagram for paludis::args::EnumArg:

Classes

class  EnumArgOptions

Public Member Functions

 EnumArg (ArgsGroup *const group, const std::string &long_name, const char short_name, const std::string &description, const EnumArgOptions &opts, const std::string &default_arg)
const std::string & argument () const
void set_argument (const std::string &arg)
void set_default_arg (const std::string &arg)
const std::string & default_arg () const
bool can_be_negated () const override
const std::string forwardable_string () const override PALUDIS_ATTRIBUTE((warn_unused_result))
const std::shared_ptr< Sequence< std::string > > forwardable_args () const override PALUDIS_ATTRIBUTE((warn_unused_result))
Public Member Functions inherited from paludis::args::ArgsOption
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)
ArgsGroup * group ()
Public Member Functions inherited from paludis::DeclareAbstractAcceptMethods< ArgsOption, MakeTypeList< StringArg, AliasArg, SwitchArg, IntegerArg, EnumArg, StringSetArg, StringSequenceArg >::Type >
void accept (UnwrappedVisitor_ &v)
Result_ accept_returning (UnwrappedVisitor_ &v, const Result_ &r=Result_())
auto make_accept_returning (const Case_ &firstcase, const Cases_ &... cases) const -> CallResultType< Case_ >
void make_accept (const Cases_ &... cases) const
Public Member Functions inherited from paludis::DeclareAbstractAcceptMethods< ArgsOption, ArgsOption::VisitableTypeList >
void accept (UnwrappedVisitor_ &v)
Result_ accept_returning (UnwrappedVisitor_ &v, const Result_ &r=Result_())
auto make_accept_returning (const Case_ &firstcase, const Cases_ &... cases) const -> CallResultType< Case_ >
void make_accept (const Cases_ &... cases) const

Iterate over our allowed arguments and associated descriptions

typedef WrappedForwardIterator< AllowedArgConstIteratorTag, const AllowedEnumArg > AllowedArgConstIterator
AllowedArgConstIterator begin_allowed_args () const
AllowedArgConstIterator end_allowed_args () const
IteratorRange< AllowedArgConstIterator > allowed_args () const

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
Public Types inherited from paludis::DeclareAbstractAcceptMethods< ArgsOption, ArgsOption::VisitableTypeList >
typedef ArgsOption::VisitableTypeList VisitableTypeList
typedef ArgsOption VisitableBaseClass
Protected Member Functions inherited from paludis::args::ArgsOption
 ArgsOption (ArgsGroup *const, const std::string &long_name, const char short_name, const std::string &description)
virtual ~ArgsOption ()=default

Detailed Description

An option that takes one of a predefined set of string arguments.

Constructor & Destructor Documentation

◆ EnumArg()

paludis::args::EnumArg::EnumArg ( ArgsGroup *const group,
const std::string & long_name,
const char short_name,
const std::string & description,
const EnumArgOptions & opts,
const std::string & default_arg )

Member Function Documentation

◆ argument()

const std::string & paludis::args::EnumArg::argument ( ) const
inline

Fetch the argument that was given to this option.

◆ can_be_negated()

bool paludis::args::EnumArg::can_be_negated ( ) const
overridevirtual

Can we be negated?

Needs to match up with ArgsVisitor logic.

Implements paludis::args::ArgsOption.

◆ default_arg()

const std::string & paludis::args::EnumArg::default_arg ( ) const
inline

Fetch the default option, as specified to the constructor or set_default_arg().

Referenced by EnumArg().

◆ forwardable_args()

const std::shared_ptr< Sequence< std::string > > paludis::args::EnumArg::forwardable_args ( ) const
overridevirtual

Ourself as a sequence of strings.

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

Since
0.46

Implements paludis::args::ArgsOption.

References EnumArg(), forwardable_args(), PALUDIS_ATTRIBUTE, and PALUDIS_VISIBLE.

Referenced by forwardable_args().

◆ forwardable_string()

const std::string paludis::args::EnumArg::forwardable_string ( ) const
overridevirtual

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

Implements paludis::args::ArgsOption.

References PALUDIS_ATTRIBUTE.

◆ set_argument()

void paludis::args::EnumArg::set_argument ( const std::string & arg)

Set the argument returned by argument(), having verified that it is one of the arguments allowed for this option.

◆ set_default_arg()

void paludis::args::EnumArg::set_default_arg ( const std::string & arg)

Change the default option (should be called before set_argument()).


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