exceptions.hpp

    1: #ifndef EXCEPTIONS_HPP
    2: #define EXCEPTIONS_HPP
    3: /*------------------------------------------------------------------------------
    4: 
    5:   Author: Andy Rushton
    6:   Copyright: (c) Andy Rushton, 2004
    7:   License:   BSD License, see ../docs/license.html
    8: 
    9:   The set of general exceptions thrown by STLplus components
   10: 
   11:   ------------------------------------------------------------------------------*/
   12: #include "os_fixes.hpp"
   13: #include <stdexcept>
   14: 
   15: ////////////////////////////////////////////////////////////////////////////////
   16: // Thrown if a pointer or an iterator is dereferenced when it is null
   17: 
   18: class null_dereference : public std::logic_error
   19: {
   20: public:
   21:   null_dereference(const std::string& description) throw();
   22:   ~null_dereference(void) throw();
   23: };
   24: 
   25: ////////////////////////////////////////////////////////////////////////////////
   26: // Thrown if an iterator is dereferenced when it is pointing to the end element
   27: 
   28: class end_dereference : public std::logic_error
   29: {
   30: public:
   31:   end_dereference(const std::string& description) throw();
   32:   ~end_dereference(void) throw();
   33: };
   34: 
   35: ////////////////////////////////////////////////////////////////////////////////
   36: // Thrown if an iterator is used with the wrong container. In other words, an
   37: // iterator is created as a pointer to a sub-object within a container. If
   38: // that iterator is then used with a different container, this exception is
   39: // thrown.
   40: 
   41: class wrong_object : public std::logic_error
   42: {
   43: public:
   44:   wrong_object(const std::string& description) throw();
   45:   ~wrong_object(void) throw();
   46: };
   47: 
   48: ////////////////////////////////////////////////////////////////////////////////
   49: #endif