00001 /* 00002 * Secret of Evermore SRAM Editor 00003 * Copyright (C) 2006,2008 emuWorks 00004 * http://games.technoplaza.net/ 00005 * 00006 * This file is part of Secret of Evermore SRAM Editor. 00007 * 00008 * Secret of Evermore SRAM Editor is free software; you can redistribute it 00009 * and/or modify it under the terms of the GNU General Public License as 00010 * published by the Free Software Foundation; either version 2 of the License, 00011 * or (at your option) any later version. 00012 * 00013 * Secret of Evermore SRAM Editor is distributed in the hope that it will be 00014 * useful, 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 Secret of Evermore SRAM Editor; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 // $Id: invalidsramfileexception.hh,v 1.6 2008/01/24 01:18:03 technoplaza Exp $ 00024 00025 #ifndef SOESRAME_INVALIDSRAMFILEEXCEPTION_HH_ 00026 #define SOESRAME_INVALIDSRAMFILEEXCEPTION_HH_ 00027 00028 #include <stdexcept> 00029 00030 /// namespace used by all soesrame classes and constants 00031 namespace soesrame { 00032 /// The possible InvalidSRAMFileException error codes 00033 enum isfe_error { 00034 ISFE_FILENOTFOUND, ISFE_INVALIDSIZE, ISFE_NOVALIDGAMES 00035 }; 00036 00037 /** 00038 * Exception thrown when a file is not a valid SRAM file. 00039 */ 00040 class InvalidSRAMFileException : public std::runtime_error { 00041 private: 00042 enum isfe_error error; 00043 00044 public: 00045 /** 00046 * Creates a new InvalidSRAMFileException. 00047 * 00048 * @param error The error code that triggered this exception. 00049 */ 00050 InvalidSRAMFileException(enum isfe_error error); 00051 00052 /** 00053 * Gets the error code for this InvalidSRAMFileException. 00054 * 00055 * @return The error code. 00056 */ 00057 enum isfe_error getError() const; 00058 }; 00059 00060 inline InvalidSRAMFileException:: 00061 InvalidSRAMFileException(enum isfe_error error) : 00062 std::runtime_error("InvalidSRAMFileException"), error(error) {} 00063 00064 inline enum isfe_error InvalidSRAMFileException::getError() const 00065 { return error; } 00066 } 00067 00068 #endif 00069