| Home | Libraries | People | FAQ | More

## Class value_semantic

boost::program_options::value_semantic —

## Synopsis

    class value_semantic {
    public:
      // construct/copy/destruct
      ~value_semantic();

      // public member functions
      virtual std::string name() const;
      virtual bool is_zero_tokens() const;
      virtual bool is_composing() const;
      virtual bool is_implicit() const;
      virtual bool is_multitoken() const;
      virtual void
      parse(boost::any &, const std::vector< std::string > &, bool) const;
      virtual bool apply_default(boost::any &) const;
      virtual void notify(const boost::any &) const;
    };

## Description

Class which specifies how the option's value is to be parsed and converted into C++ types.

### `value_semantic` construct/copy/destruct

1.     ~value_semantic();

### `value_semantic` public member functions

1.     virtual std::string name() const;

   Returns the name of the option. The name is only meaningful for automatic help message.

2.     virtual bool is_zero_tokens() const;

   Returns true if value cannot be specified in source at all. Other methods can still set the value somehow, but user can't affect it.

3.     virtual bool is_composing() const;

   Returns true if values from different sources should be composed. Otherwise, value from the first source is used and values from other sources are discarded.

4.     virtual bool is_implicit() const;

   Returns true if explicit value of an option can be omitted.

5.     virtual bool is_multitoken() const;

   Returns true if value can span several token in input source.

6.     virtual void
       parse(boost::any & value_store, const std::vector< std::string > & new_tokens,
             bool utf8) const;

   Parses a group of tokens that specify a value of option. Stores the result in 'value_store', using whatever representation is desired. May be be called several times if value of the same option is specified more than once.

7.     virtual bool apply_default(boost::any & value_store) const;

   Called to assign default value to 'value_store'. Returns true if default value is assigned, and false if no default value exists.

8.     virtual void notify(const boost::any & value_store) const;

   Called when final value of an option is determined.

| Copyright © 2002-2004 Vladimir Prus