Aktualizr
C++ SOTA Client
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
accumulator_type< T > Class Template Reference

An accumulating option value to handle multiple incrementing options. More...

#include <accumulator.h>

Inheritance diagram for accumulator_type< T >:
[legend]
Collaboration diagram for accumulator_type< T >:
[legend]

Public Member Functions

 accumulator_type (T *store)
 
accumulator_typenotifier (std::function< void(const T &)> f)
 Set the notifier function.
 
accumulator_typedefault_value (const T &t)
 Set the default value for this option.
 
accumulator_typeimplicit_value (const T &t)
 Set the implicit value for this option. More...
 
virtual std::string name () const
 
virtual unsigned min_tokens () const
 There are no tokens for an accumulator_type.
 
virtual unsigned max_tokens () const
 
virtual bool adjacent_tokens_only () const
 
virtual bool is_composing () const
 Accumulating from different sources is silly.
 
virtual bool is_required () const
 Requiring one or more appearances is unlikely.
 
virtual void parse (boost::any &value_store, const std::vector< std::string > &, bool) const
 Every appearance of the option simply increments the value. More...
 
virtual bool apply_default (boost::any &value_store) const
 If the option doesn't appear, this is the default value.
 
virtual void notify (const boost::any &value_store) const
 Notify the user function with the value of the value store.
 

Detailed Description

template<typename T>
class accumulator_type< T >

An accumulating option value to handle multiple incrementing options.

Definition at line 19 of file accumulator.h.

Member Function Documentation

◆ implicit_value()

template<typename T >
accumulator_type* accumulator_type< T >::implicit_value ( const T &  t)
inline

Set the implicit value for this option.

Unlike for program_options::value, this specifies a value to be applied on each occurrence of the option.

Definition at line 39 of file accumulator.h.

◆ parse()

template<typename T >
virtual void accumulator_type< T >::parse ( boost::any &  value_store,
const std::vector< std::string > &  ,
bool   
) const
inlinevirtual

Every appearance of the option simply increments the value.

There should never be any tokens.

Definition at line 61 of file accumulator.h.


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