00001 /* 00002 * hack4u 00003 * Copyright (C) 2004-2008 emuWorks 00004 * http://games.technoplaza.net/ 00005 * 00006 * This file is part of hack4u. 00007 * 00008 * hack4u is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * hack4u is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with hack4u; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 // $Id: InvalidSRAMException.hh,v 1.3 2008/12/16 22:12:52 jdratlif Exp $ 00024 00025 #ifndef HACK4U_INVALIDSRAMEXCEPTION_HH_ 00026 #define HACK4U_INVALIDSRAMEXCEPTION_HH_ 00027 00028 #include <stdexcept> 00029 00030 namespace hack4u { 00031 enum InvalidSRAMError { 00032 ISE_NOSUCHFILE, ISE_IOERROR, ISE_BADCHECKSUM 00033 }; 00034 00035 class InvalidSRAMException : public std::runtime_error { 00036 private: 00037 enum InvalidSRAMError error; 00038 00039 public: 00040 /** 00041 * Creates a new InvalidSRAMException. 00042 * 00043 * @param error The reason for the exception. 00044 */ 00045 InvalidSRAMException(enum InvalidSRAMError error); 00046 00047 /** 00048 * Gets the error code that triggered this exception. 00049 * 00050 * @return The error code. 00051 */ 00052 enum InvalidSRAMError getError() const; 00053 }; 00054 00055 inline InvalidSRAMException:: 00056 InvalidSRAMException(enum InvalidSRAMError error) : 00057 std::runtime_error("InvalidSRAMException"), error(error) {} 00058 00059 inline enum InvalidSRAMError InvalidSRAMException::getError() const 00060 { return error; } 00061 } 00062 00063 #endif 00064