20 #ifndef PROGRAM_OPTIONS_ACCUMULATOR_HPP 21 #define PROGRAM_OPTIONS_ACCUMULATOR_HPP 23 #include <boost/program_options/value_semantic.hpp> 24 #include <boost/any.hpp> 25 #include <boost/version.hpp> 59 virtual std::string
name()
const {
return std::string(); }
65 #if BOOST_VERSION >= 105900 66 virtual bool adjacent_tokens_only()
const {
return false; }
79 virtual void parse(boost::any& value_store,
80 const std::vector<std::string>& new_tokens,
83 assert(new_tokens.empty());
84 if (value_store.empty()) value_store =
T();
85 boost::any_cast<
T&>(value_store) += _interval;
90 value_store = _default;
95 virtual void notify(
const boost::any& value_store)
const {
96 if (_notifier) _notifier(boost::any_cast<T>(value_store));
102 std::function<void(const T&)> _notifier;
virtual unsigned max_tokens() const
Definition: accumulator.h:63
virtual void parse(boost::any &value_store, const std::vector< std::string > &new_tokens, bool) const
Every appearance of the option simply increments the value.
Definition: accumulator.h:79
virtual unsigned min_tokens() const
There are no tokens for an accumulator_type.
Definition: accumulator.h:62
accumulator_type * default_value(const T &t)
Set the default value for this option.
Definition: accumulator.h:45
accumulator_type()
Definition: accumulator.h:36
virtual std::string name() const
Definition: accumulator.h:59
Definition: GnashKey.h:152
accumulator_type * notifier(std::function< void(const T &)> f)
Set the notifier function.
Definition: accumulator.h:39
Definition: GnashKey.h:166
virtual bool is_composing() const
Accumulating from different sources is silly.
Definition: accumulator.h:71
An accumulating option value to handle multiple incrementing options.
Definition: accumulator.h:32
virtual bool apply_default(boost::any &value_store) const
If the option doesn't appear, this is the default value.
Definition: accumulator.h:89
accumulator_type< T > * accumulator()
Definition: accumulator.h:108
Definition: GnashKey.h:132
accumulator_type * implicit_value(const T &t)
Set the implicit value for this option.
Definition: accumulator.h:54
virtual ~accumulator_type()
Definition: accumulator.h:99
virtual void notify(const boost::any &value_store) const
Notify the user function with the value of the value store.
Definition: accumulator.h:95
virtual bool is_required() const
Requiring one or more appearances is unlikely.
Definition: accumulator.h:74