| Home | Libraries | People | FAQ | More

## Class untyped_value

boost::program_options::untyped_value

## Synopsis

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

    class untyped_value :
      public boost::program_options::value_semantic_codecvt_helper< char >
    {
    public:
      // construct/copy/destruct
      untyped_value(bool = false);

      // public member functions
      virtual std::string name() const;
      virtual unsigned min_tokens() const;
      virtual unsigned max_tokens() const;
      virtual bool adjacent_tokens_only() const;
      virtual bool is_composing() const;
      virtual bool is_required() const;
      virtual void xparse(boost::any &, const std::vector< std::string > &) const;
      virtual bool apply_default(boost::any &) const;
      virtual void notify(const boost::any &) const;
    };

## Description

Class which specifies a simple handling of a value: the value will have string type and only one token is allowed.

### `untyped_value` public construct/copy/destruct

1.     untyped_value(bool zero_tokens = false);

### `untyped_value` 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 unsigned min_tokens() const;

   The minimum number of tokens for this option that should be present on the command line.

3.     virtual unsigned max_tokens() const;

   The maximum number of tokens for this option that should be present on the command line.

4.     virtual bool adjacent_tokens_only() const;

   Returns true if the option should only take adjacent token, not one from further command-line arguments.

5.     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.

6.     virtual bool is_required() const;

   Returns true if value must be given. Non-optional value

7.     virtual void
       xparse(boost::any & value_store,
              const std::vector< std::string > & new_tokens) const;

   If 'value_store' is already initialized, or new_tokens has more than one elements, throws. Otherwise, assigns the first string from 'new_tokens' to 'value_store', without any modifications.

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

   Does nothing.

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

   Does nothing.