wibble::exception::ValOutOfRange< C > Class Template Reference

Exception thrown when index checking fails. More...

`#include <exception.h>`

Inheritance diagram for wibble::exception::ValOutOfRange< C >:
[legend]
Collaboration diagram for wibble::exception::ValOutOfRange< C >:
[legend]

## Public Member Functions

| ValOutOfRange (const std::string &var_desc, C val, C inf, C sup, const std::string &context) throw ()
| Construct the exception; minBound and maxBound are the bounds of the valid index range (inclusive). More...
virtual const char * | type () const throw ()
| Get a string tag identifying the exception type. More...
virtual std::string | desc () const throw ()
| Get a string describing what happened that threw the exception. More...
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. More...
virtual C | inf () const throw ()
| Get the minimum allowed value for this index. More...
virtual C | sup () const throw ()
| Get the maximum allowed value for this index. More...
Public Member Functions inherited from wibble::exception::OutOfRange
| OutOfRange (const std::string &var_desc, const std::string &context) throw ()
| ~OutOfRange () throw ()
virtual std::string | var_desc () const throw ()
| Get a short description of the variable that has been checked. More...
Public Member Functions inherited from wibble::exception::Consistency
| Consistency (const std::string &context, const std::string &error=std::string()) throw ()
| ~Consistency () throw ()
Public Member Functions inherited from wibble::exception::Generic
| Generic () throw ()
| Generic (const std::string &context) throw ()
virtual | ~Generic () throw ()
virtual const std::string & | fullInfo () const throw ()
| Format in a string all available information about the exception. More...
virtual const char * | what () const throw ()
Public Member Functions inherited from wibble::exception::Context
| Context () throw ()
| Context (const std::string &context) throw ()
void | addContext (const std::string &c) throw ()
std::string | formatContext () const throw ()
const std::vector< std::string > & | context () const throw ()

## Protected Attributes

C | m_val
C | m_inf
C | m_sup
Protected Attributes inherited from wibble::exception::OutOfRange
std::string | m_var_desc
Protected Attributes inherited from wibble::exception::Generic
std::string | m_formatted
Protected Attributes inherited from wibble::exception::Context
std::vector< std::string > | m_context

## Detailed Description

### template<class C>
class wibble::exception::ValOutOfRange< C >

Exception thrown when index checking fails.

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", age, 18, 0, "obtaining driver license");
if (i < 0 || i > 100)
throw IndexOutOfRangeException("percentage of items sold", i, 0, 100, "checking input consistency");

## Constructor & Destructor Documentation

## ValOutOfRange()

template<class C>

wibble::exception::ValOutOfRange< C >::ValOutOfRange | ( | const std::string & | var_desc,
|  | C | val,
|  | C | inf,
|  | C | sup,
|  | const std::string & | context
| ) |  |
throw | ( |
| ) |  |

inline

Construct the exception; minBound and maxBound are the bounds of the valid index range (inclusive).

## Member Function Documentation

## desc()

template<class C>

virtual std::string wibble::exception::ValOutOfRange< C >::desc | ( |  | ) | const
throw | ( |
| ) |  |

virtual

Get a string describing what happened that threw the exception.

Reimplemented from wibble::exception::OutOfRange.

## inf()

template<class C>

virtual C wibble::exception::ValOutOfRange< C >::inf | ( |  | ) | const
throw | ( |
| ) |  |

inline virtual

Get the minimum allowed value for this index.

## sup()

template<class C>

virtual C wibble::exception::ValOutOfRange< C >::sup | ( |  | ) | const
throw | ( |
| ) |  |

inline virtual

Get the maximum allowed value for this index.

## type()

template<class C>

virtual const char* wibble::exception::ValOutOfRange< C >::type | ( |  | ) | const
throw | ( |
| ) |  |

inline virtual

Get a string tag identifying the exception type.

Reimplemented from wibble::exception::OutOfRange.

## val()

template<class C>

virtual C wibble::exception::ValOutOfRange< C >::val | ( |  | ) | const
throw | ( |
| ) |  |

inline virtual

Get the value that caused the index to go out-of-bounds.

## Member Data Documentation

## m_inf

template<class C>

C wibble::exception::ValOutOfRange< C >::m_inf

protected

## m_sup

template<class C>

C wibble::exception::ValOutOfRange< C >::m_sup

protected

## m_val

template<class C>

C wibble::exception::ValOutOfRange< C >::m_val

protected

The documentation for this class was generated from the following file:

- exception.h