Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class error_with_option_name

boost::program_options::error_with_option_name

Synopsis

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


class error_with_option_name : public  {
public:
  // construct/copy/destruct
  (,  = "", 
                          = "",  = );
  ~();

  // public member functions
   (, );
   (, , 
                              );
   (, , );
   ();
   ();
   () ;
   ();
   () ;

  // protected member functions
   () ;
   (, ) ;
   () ;
   () ;

  // public data members
   ;
};

Description

Base class for most exceptions in the library.

Substitutes the values for the parameter name placeholders in the template to create the human readable error message

Placeholders are surrounded by % signs: example% Poor man's version of boost::format

If a parameter name is absent, perform default substitutions instead so ugly placeholders are never left in-place.

Options are displayed in "canonical" form This is the most unambiguous form of the parsed option name and would correspond to option_description::format_name() i.e. what is shown by print_usage()

The "canonical" form depends on whether the option is specified in short or long form, using dashes or slashes or without a prefix (from a configuration file)

error_with_option_name public construct/copy/destruct

  1. ( template_, 
                            option_name = "", 
                            original_token = "", 
                            option_style = );
  2. ~();

    gcc says that throw specification on dtor is loosened without this line

error_with_option_name public member functions

  1.  ( parameter_name, 
                         value);

    Substitute parameter_name->value to create the error message from the error template

  2.  ( parameter_name, 
                                 from,  to);

    If the parameter is missing, then make the from->to substitution instead

  3.  ( option_name, 
                      original_token,  option_style);

    Add context to an exception

  4.  ( option_style);
  5.  ( option_name);

    Overridden in error_with_no_option_name

  6.  () ;
  7.  ( original_token);
  8.  () ;

    Creates the error_message on the fly Currently a thin wrapper for substitute_placeholders()

error_with_option_name protected member functions

  1.  ( error_template) ;

    Makes all substitutions using the template

  2.  ( from,  to) ;
  3.  () ;

    Construct option name in accordance with the appropriate prefix style: i.e. long dash or short slash etc

  4.  () ;

error_with_option_name public public data members

  1.  ;

    template with placeholders


PrevUpHomeNext