boost.png (6897 bytes) Home Libraries People FAQ More

PrevUpHomeNext

Class template typed_value

boost::program_options::typed_value —

Synopsis

template<typename T, typename charT = char> 
class typed_value
  :  : public boost::program_options::value_semantic_codecvt_helper< charT >
{
public:
  // construct/copy/destruct
  typed_value(T *);

  // public member functions
  typed_value * default_value(const T &) ;
  typed_value * default_value(const T &, const std::string &) ;
  typed_value * notifier(function1< void, const T & >) ;
  typed_value * composing() ;
  typed_value * implicit() ;
  typed_value * multitoken() ;
  typed_value * zero_tokens() ;
  std::string name() const;
  bool is_zero_tokens() const;
  bool is_composing() const;
  bool is_implicit() const;
  bool is_multitoken() const;
  void xparse(boost::any &, const std::vector< std::basic_string< charT > > &) const;
  virtual bool apply_default(boost::any &) const;
  void notify(const boost::any &) const;
};

Description

Class which handles value of a specific type.

typed_value construct/copy/destruct

  1. typed_value(T * store_to);

    Ctor. The 'store_to' parameter tells where to store the value when it's known. The parameter can be NULL.

typed_value public member functions

  1. typed_value * default_value(const T & v) ;

    Specifies default value, which will be used if none is explicitly specified. The type 'T' should provide operator<< for ostream.

  2. typed_value * default_value(const T & v, const std::string & textual) ;

    Specifies default value, which will be used if none is explicitly specified. Unlike the above overload, the type 'T' need not provide operator<< for ostream, but textual representation of default value must be provided by the user.

  3. typed_value * notifier(function1< void, const T & > f) ;

    Specifies a function to be called when the final value is determined.

  4. typed_value * composing() ;

    Specifies that the value is composing. See the 'is_composing' method for explanation.

  5. typed_value * implicit() ;

    Specifies that the value is implicit.

  6. typed_value * multitoken() ;

    Specifies that the value can span multiple tokens.

  7. typed_value * zero_tokens() ;
  8. std::string name() const;
  9. bool is_zero_tokens() const;
  10. bool is_composing() const;
  11. bool is_implicit() const;
  12. bool is_multitoken() const;
  13. void xparse(boost::any & value_store, 
                const std::vector< std::basic_string< charT > > & new_tokens) const;

    Creates an instance of the 'validator' class and calls its operator() to perform athe ctual conversion.

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

    If default value was specified via previous call to 'default_value', stores that value into 'value_store'. Returns true if default value was stored.

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

    If an address of variable to store value was specified when creating *this, stores the value there. Otherwise, does nothing.

Copyright © 2002-2004 Vladimir Prus

PrevUpHomeNext