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