error.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018  ***************************************************************************/
00019 
00020 #ifndef IDIOSKOPOSERROR_H
00021 #define IDIOSKOPOSERROR_H
00022 
00023 #include <typeinfo>
00024 
00025 namespace Idioskopos {
00026 
00027 namespace error {
00028 
00029   class bad_cast: public std::bad_cast {
00030     public:
00031       virtual const char * what () const throw () {
00032         return "idioskopos: Unable to perform property cast";
00033       }
00034   };
00035 
00036 class read_only: public std::exception {
00037 public:
00038   virtual const char* what() const throw () {
00039   return "idioskopos: Assignment to read only property";
00040   }
00041 };
00042 
00043 class write_only: public std::exception {
00044 public:
00045   virtual const char* what() const throw () {
00046   return "idioskopos: Accessing a write only property";
00047   }
00048 };
00049 
00050 namespace cast {
00051 
00052     class wrong_property_type: public bad_cast {
00053     public:
00054       virtual const char * what () const throw () {
00055         return "idioskopos: Unable to cast property, casting to wrong type";
00056       }
00057   };
00058 
00059   class null_pointer: public bad_cast {
00060     public:
00061       virtual const char * what () const throw () {
00062         return "idioskopos: Cannot cast a null pointer to a property";
00063       }
00064   };
00065 
00066   };
00067 
00068 class bad_property_name: public std::exception {
00069 public:
00070   virtual const char * what () const throw () {
00071   return "idioskopos: Object does not have requested property";
00072   }
00073 };
00074 
00075 class not_a_child: public std::exception {
00076   public:
00077     virtual const char * what () const throw () {
00078       return "idioskopos: Requested child name doesn't exist or can't be cast to idioskopos::Object";
00079     }
00080 };
00081 
00082 };
00083 };
00084 
00085 #endif
00086 

Generated on Thu Jan 11 00:26:41 2007 by  doxygen 1.5.1