21 #ifndef PALUDIS_GUARD_ARGS_ARGS_OPTION_HH 22 #define PALUDIS_GUARD_ARGS_ARGS_OPTION_HH 1 25 #include <paludis/util/wrapped_forward_iterator.hh> 26 #include <paludis/util/type_list.hh> 27 #include <paludis/util/named_value.hh> 28 #include <paludis/util/visitor.hh> 46 typedef Name<struct name_description> description;
47 typedef Name<struct name_long_name> long_name;
48 typedef Name<struct name_short_name> short_name;
60 class StringSequenceArg;
62 enum ArgsOptionSpecifiedness
76 StringArg, AliasArg, SwitchArg, IntegerArg, EnumArg, StringSetArg, StringSequenceArg>::Type>
83 const std::string _long_name;
84 const char _short_name;
85 const std::string _description;
87 ArgsOptionSpecifiedness _specified;
97 const char short_name,
const std::string & description);
141 return _specified != aos_not;
151 return _specified == aos_specified;
175 virtual bool can_be_negated()
const = 0;
185 virtual const std::string forwardable_string()
const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
195 virtual const std::shared_ptr<Sequence<std::string> > forwardable_args()
const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
209 bool _can_be_negated;
218 const std::string & description,
const bool can_be_negated);
222 virtual bool can_be_negated()
const;
224 virtual const std::string forwardable_string()
const PALUDIS_ATTRIBUTE((warn_unused_result));
225 virtual const std::shared_ptr<Sequence<std::string> > forwardable_args()
const PALUDIS_ATTRIBUTE((warn_unused_result));
238 std::string _argument;
239 bool _can_be_negated;
240 void (* _validator) (
const std::string &);
247 const char short_name,
const std::string & description,
248 const bool can_be_negated =
false);
254 const char short_name,
const std::string & description,
255 void (* validator) (
const std::string &),
256 const bool can_be_negated =
false);
261 const std::string &
argument()
const {
return _argument; }
266 void set_argument(
const std::string & arg);
268 virtual bool can_be_negated()
const;
270 virtual const std::string forwardable_string()
const PALUDIS_ATTRIBUTE((warn_unused_result));
271 virtual const std::shared_ptr<Sequence<std::string> > forwardable_args()
const PALUDIS_ATTRIBUTE((warn_unused_result));
287 void (* _validator) (
const std::string &);
334 const char short_name,
const std::string & description,
338 const char short_name,
const std::string & description,
340 void (* validator) (
const std::string &));
349 struct ConstIteratorTag;
352 ConstIterator begin_args()
const;
354 ConstIterator end_args()
const;
361 void add_argument(
const std::string & arg);
366 struct AllowedArgConstIteratorTag;
370 AllowedArgConstIterator begin_allowed_args()
const;
372 AllowedArgConstIterator end_allowed_args()
const;
376 virtual bool can_be_negated()
const;
378 virtual const std::string forwardable_string()
const PALUDIS_ATTRIBUTE((warn_unused_result));
379 virtual const std::shared_ptr<Sequence<std::string> > forwardable_args()
const PALUDIS_ATTRIBUTE((warn_unused_result));
401 const char short_name,
const std::string & description);
410 struct ConstIteratorTag;
413 ConstIterator begin_args()
const;
415 ConstIterator end_args()
const;
422 void add_argument(
const std::string & arg);
424 virtual bool can_be_negated()
const;
426 virtual const std::string forwardable_string()
const PALUDIS_ATTRIBUTE((warn_unused_result));
427 virtual const std::shared_ptr<Sequence<std::string> > forwardable_args()
const PALUDIS_ATTRIBUTE((warn_unused_result));
448 AliasArg(
ArgsOption *
const other,
const std::string & new_long_name,
bool is_hidden =
false);
465 virtual bool hidden()
const 470 virtual void set_hidden(
const bool value)
483 virtual bool can_be_negated()
const;
485 virtual const std::string forwardable_string()
const PALUDIS_ATTRIBUTE((warn_unused_result));
486 virtual const std::shared_ptr<Sequence<std::string> > forwardable_args()
const PALUDIS_ATTRIBUTE((warn_unused_result));
506 const char short_name,
const std::string & description);
517 virtual bool can_be_negated()
const;
519 virtual const std::string forwardable_string()
const PALUDIS_ATTRIBUTE((warn_unused_result));
520 virtual const std::shared_ptr<Sequence<std::string> > forwardable_args()
const PALUDIS_ATTRIBUTE((warn_unused_result));
551 std::string _argument;
552 std::string _default_arg;
579 EnumArgOptions(
const std::string &,
const char,
const std::string &);
589 EnumArgOptions & operator() (
const std::string &,
const std::string &);
596 EnumArgOptions & operator() (
const std::string &,
const char,
const std::string &);
603 const char short_name,
const std::string & description,
620 void set_argument(
const std::string & arg);
626 void set_default_arg(
const std::string & arg);
640 struct AllowedArgConstIteratorTag;
644 AllowedArgConstIterator begin_allowed_args()
const;
646 AllowedArgConstIterator end_allowed_args()
const;
650 virtual bool can_be_negated()
const;
652 virtual const std::string forwardable_string()
const PALUDIS_ATTRIBUTE((warn_unused_result));
653 virtual const std::shared_ptr<Sequence<std::string> > forwardable_args()
const PALUDIS_ATTRIBUTE((warn_unused_result));
659 const std::pair<std::string, std::string> >;
Definition: args_option.hh:436
Definition: about_metadata-fwd.hh:23
const std::string & description() const
Definition: args_option.hh:130
Definition: args_group.hh:50
Definition: visitor-fwd.hh:52
const std::string & argument() const
Definition: args_option.hh:261
const std::string & default_arg() const
Definition: args_option.hh:632
char short_name() const
Definition: args_option.hh:122
virtual void set_specified(const ArgsOptionSpecifiedness value)
Definition: args_option.hh:460
ArgsGroup * group()
Definition: args_option.hh:165
Definition: args_option.hh:544
Definition: args_option.hh:296
const std::string & argument() const
Definition: args_option.hh:611
Definition: args_option.hh:494
Definition: args_option.hh:529
Definition: args_option.hh:204
virtual bool specified() const
Definition: args_option.hh:450
Definition: args_option.hh:233
virtual bool specified() const
Definition: args_option.hh:139
const std::string & long_name() const
Definition: args_option.hh:114
Definition: wrapped_forward_iterator-fwd.hh:26
Definition: args_handler.hh:59
ArgsOption * other() const
Definition: args_option.hh:478
Definition: args_option.hh:74
virtual void set_specified(const ArgsOptionSpecifiedness value)
Definition: args_option.hh:157
void set_argument(const int arg)
Definition: args_option.hh:515
virtual bool explicitly_specified() const
Definition: args_option.hh:149
Definition: visitor-fwd.hh:49
Definition: args_option.hh:389
int argument() const
Definition: args_option.hh:510
Definition: args_option.hh:561
#define PALUDIS_ATTRIBUTE(x)
Definition: attributes.hh:53
#define PALUDIS_VISIBLE
Definition: attributes.hh:59
virtual bool explicitly_specified() const
Definition: args_option.hh:455
Definition: args_option.hh:280
NamedValue< n::short_name, char > short_name
Might be '\0', for none.
Definition: args_option.hh:535