#include <Exception.h>
Inheritance diagram for 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 |
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");
|
Construct the exception; minBound and maxBound are the bounds of the valid index range (inclusive).
|
|
Get a string describing what happened that threw the exception.
Reimplemented from OutOfRangeException. |
|
Get the minimum allowed value for this index.
|
|
Get the maximum allowed value for this index.
|
|
Get a string tag identifying the exception type.
Reimplemented from OutOfRangeException. |
|
Get the value that caused the index to go out-of-bounds.
|
|
|
|
|
|
|