#include <Exception.h>
Inheritance diagram for Tagcoll::ValOutOfRangeException< C >:
Public Member Functions | |
ValOutOfRangeException (const std::string &context, const std::string &var_desc, C val, C inf, C sup) throw () | |
Construct the exception; minBound and maxBound are the bounds of the valid index range (inclusive). | |
virtual const char * | type () const throw () |
Get a string tag identifying the exception type. | |
virtual std::string | desc () const throw () |
Get a string describing what happened that threw the exception. | |
Methods used to get informations about the index and its bounds | |
virtual C | val () const throw () |
Get the value that caused the index to go out-of-bounds. | |
virtual C | inf () const throw () |
Get the minimum allowed value for this index. | |
virtual C | sup () const throw () |
Get the maximum allowed value for this index. | |
Protected Attributes | |
C | _val |
C | _inf |
C | _sup |
This exception is to be thrown when an index checking fails, providing informations on the acceptable index range and on the offending value. The context should be a description of the index, possibly preceeded by a description of in what context did the index checking happen.
Example:
if (age < 18) throw IndexOutOfRangeException(age, 18, 0, "obtaining driver license, age"); if (i < 0 || i > 100) throw IndexOutOfRangeException(i, 0, 100, "percentage of items sold");
Tagcoll::ValOutOfRangeException< C >::ValOutOfRangeException | ( | const std::string & | context, | |
const std::string & | var_desc, | |||
C | val, | |||
C | inf, | |||
C | sup | |||
) | throw () [inline] |
Construct the exception; minBound and maxBound are the bounds of the valid index range (inclusive).
virtual C Tagcoll::ValOutOfRangeException< C >::val | ( | ) | const throw () [inline, virtual] |
Get the value that caused the index to go out-of-bounds.
virtual C Tagcoll::ValOutOfRangeException< C >::inf | ( | ) | const throw () [inline, virtual] |
Get the minimum allowed value for this index.
virtual C Tagcoll::ValOutOfRangeException< C >::sup | ( | ) | const throw () [inline, virtual] |
Get the maximum allowed value for this index.
virtual const char* Tagcoll::ValOutOfRangeException< C >::type | ( | ) | const throw () [inline, virtual] |
virtual std::string Tagcoll::ValOutOfRangeException< C >::desc | ( | ) | const throw () [inline, virtual] |
Get a string describing what happened that threw the exception.
Reimplemented from Tagcoll::OutOfRangeException.
C Tagcoll::ValOutOfRangeException< C >::_val [protected] |
C Tagcoll::ValOutOfRangeException< C >::_inf [protected] |
C Tagcoll::ValOutOfRangeException< C >::_sup [protected] |