• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

yapet/pwgen/pwgenexception.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //
00003 // $Id: pwgenexception.h 3343 2010-09-17 18:36:31Z java $
00004 //
00005 // Copyright (C) 2009-2010  Rafael Ostertag
00006 //
00007 // This file is part of YAPET.
00008 //
00009 // YAPET is free software: you can redistribute it and/or modify it under the
00010 // terms of the GNU General Public License as published by the Free Software
00011 // Foundation, either version 3 of the License, or (at your option) any later
00012 // version.
00013 //
00014 // YAPET is distributed in the hope that it will be useful, but WITHOUT ANY
00015 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00016 // FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00017 // details.
00018 //
00019 // You should have received a copy of the GNU General Public License along with
00020 // YAPET.  If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 
00023 #ifndef _PWGENEXCEPTION_H
00024 #define _PWGENEXCEPTION_H
00025 
00026 #ifdef HAVE_CONFIG_H
00027 # include <config.h>
00028 #endif
00029 
00030 #ifdef HAVE_EXCEPTION
00031 # include <exception>
00032 #endif
00033 
00034 #ifdef HAVE_STRING
00035 # include <string>
00036 #endif
00037 
00038 #include "../../intl.h"
00039 
00040 
00041 namespace YAPET {
00042 
00043     namespace PWGEN {
00049         class PWGenException : public std::exception {
00050             private:
00051                 std::string message;
00052 
00053             public:
00054                 inline PWGenException() throw() : exception(), message (_ ("Generic exception message") ) {}
00055                 inline PWGenException (std::string msg) throw() : exception(), message (msg) {}
00056                 inline PWGenException (const PWGenException& ex) throw() {
00057                     message = ex.message;
00058                 }
00059                 inline virtual ~PWGenException() throw() {}
00060                 inline const PWGenException& operator= (const PWGenException& ex)
00061                 throw() {
00062                     if (this == &ex) return *this;
00063 
00064                     message = ex.message;
00065                     return *this;
00066                 }
00067                 inline virtual const char* what() const throw() {
00068                     return message.c_str();
00069                 }
00070         };
00071 
00077         class PWGenNoRNGException : public PWGenException {
00078             public:
00079                 inline PWGenNoRNGException() throw() : PWGenException (_ ("No Random Number Generator available") ) {}
00080                 inline PWGenNoRNGException (std::string msg) throw() : PWGenException (msg) {}
00081                 inline PWGenNoRNGException (const PWGenNoRNGException& ex) throw() : PWGenException (ex) {}
00082                 inline virtual ~PWGenNoRNGException() throw() {}
00083                 inline const PWGenNoRNGException& operator= (const PWGenNoRNGException& ex)
00084                 throw() {
00085             PWGenException::operator= ( ex );
00086             return *this;
00087                 }
00088         };
00089 
00095         class PWGenRNGNotAvailable : public PWGenException {
00096             public:
00097                 inline PWGenRNGNotAvailable() throw() : PWGenException (_ ("The requested RNG is not available") ) {}
00098                 inline PWGenRNGNotAvailable (std::string msg) throw() : PWGenException (msg) {}
00099                 inline PWGenRNGNotAvailable (const PWGenRNGNotAvailable& ex) throw() : PWGenException (ex) {}
00100                 inline virtual ~PWGenRNGNotAvailable() throw() {}
00101                 inline const PWGenRNGNotAvailable& operator= (const PWGenRNGNotAvailable& ex)
00102                 throw() {
00103                     PWGenException::operator= ( ex );
00104                     return *this;
00105                 }
00106         };
00107 
00108     }
00109 }
00110 
00111 #endif // _PWGENEXCEPTION_H

Generated on Sun Sep 19 2010 15:37:14 for YAPET by  doxygen 1.7.1