debian/tmp/usr/include/bit-0.3/bit/except.h

00001 /***************************************************************************
00002  *   Copyright (C) 2001 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 #ifndef BITEXCEPTION_H
00020 #define BITEXCEPTION_H
00021 
00026 #include <stdexcept>
00027 
00028 namespace bit
00029   {
00030 
00036   class bit_exception: public std::runtime_error
00037     {
00038     public:
00039       bit_exception(const std::string s="bit: Unknown exception."):
00040           std::runtime_error(s),
00041           m_exception_string(s)
00042       {}
00043 
00044       ~bit_exception() throw ()
00045       { }
00046 
00047       virtual const char * what () const throw ()
00048       {
00049         return m_exception_string.c_str();
00050       }
00051 
00052     protected:
00053       std::string m_exception_string;
00054     }
00055   ;
00056 
00057   namespace exception
00058     {
00059 
00064     class invalid_iterator: public bit_exception
00065     {
00066     public:
00067     invalid_iterator(): bit_exception("bit: Attempted to use invalid iterator")
00068       { }
00069     }
00070     ;
00071 
00076     class invalid_container_op: public bit_exception
00077     {
00078       public:
00079         invalid_container_op(): bit_exception("bit: Using container methods on a FieldBase descendant that is not valid for that descendant.")
00080         { }
00081     }
00082     ;
00083 
00088     class name: public bit_exception
00089       {
00090       public:
00091         name(): bit_exception("bit: Name identifiers may not contain the following characters: .[]")
00092         { }
00093         name(const std::string s): bit_exception(s)
00094         {
00095           m_exception_string = "bit: The name \"" + s + "\" is invalid. Name identifiers may not contain the following characters: .[]";
00096         }
00097       }
00098     ;
00099 
00104     class no_record: public bit_exception
00105       {
00106       public:
00107         no_record(): bit_exception("bit:FieldBuffer: record() method called, but this instance does not have a record.")
00108         { }
00109       }
00110     ;
00111 
00116     class invalid_index: public bit_exception
00117     {
00118       public:
00119         invalid_index(): bit_exception("bit: Invalid index.")
00120         { }
00121     }
00122     ;
00123 
00124     }
00125 
00126 }
00127 
00128 #include <bit/except_field.h>
00129 #include <bit/except_record.h>
00130 #include <bit/except_indices.h>
00131 #include <bit/except_type.h>
00132 
00133 #endif
00134 

Generated on Tue Mar 13 20:00:01 2007 by  doxygen 1.5.1