Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Class abstract_variables_map

boost::program_options::abstract_variables_map

Synopsis

// In header: <boost/program_options/variables_map.hpp>


class abstract_variables_map {
public:

  // public member functions
  abstract_variables_map();
  abstract_variables_map(const abstract_variables_map *);
  virtual ~abstract_variables_map();
  const variable_value & operator[](const std::string &) const;
  void next(abstract_variables_map *);

  // private member functions
  virtual const variable_value & get(const std::string &) const = 0;
};

Description

Implements string->string mapping with convenient value casting facilities.

abstract_variables_map public member functions

  1. abstract_variables_map();
  2. abstract_variables_map(const abstract_variables_map * next);
  3. virtual ~abstract_variables_map();
  4. const variable_value & operator[](const std::string & name) const;

    Obtains the value of variable 'name', from *this and possibly from the chain of variable maps.

    • if there's no value in *this.

      • if there's next variable map, returns value from it

      • otherwise, returns empty value

    • if there's defaulted value

      • if there's next variable map, which has a non-defaulted value, return that

      • otherwise, return value from *this

    • if there's a non-defaulted value, returns it.

  5. void next(abstract_variables_map * next);

    Sets next variable map, which will be used to find variables not found in *this.

abstract_variables_map private member functions

  1. virtual const variable_value & get(const std::string & name) const = 0;

    Returns value of variable 'name' stored in *this, or empty value otherwise.


PrevUpHomeNext