00001 /* 00002 * lozsrame - Legend of Zelda SRAM Editor 00003 * Copyright (C) 2007-2008 emuWorks 00004 * http://games.technoplaza.net/ 00005 * 00006 * This file is part of lozsrame. 00007 * 00008 * lozsrame 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 * lozsrame 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 * lozsrame; 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.3 2008/02/01 13:21:44 technoplaza Exp $ 00023 00024 #ifndef LOZSRAME_INVALIDSRAMFILEEXCEPTION_HH_ 00025 #define LOZSRAME_INVALIDSRAMFILEEXCEPTION_HH_ 00026 00027 #include <stdexcept> 00028 00029 namespace lozsrame { 00030 /// The possible InvalidSRAMFileException error codes 00031 enum isfe_error { 00032 ISFE_FILENOTFOUND, ISFE_INVALIDSIZE, ISFE_NOVALIDGAMES 00033 }; 00034 00035 /** 00036 * Exception thrown when SRAMFile is passed an invalid file. 00037 */ 00038 class InvalidSRAMFileException : public std::runtime_error { 00039 private: 00040 enum isfe_error error; 00041 00042 public: 00043 /** 00044 * Creates a new InvalidSRAMFileException. 00045 * 00046 * @param error The error code that triggered this exception. 00047 */ 00048 InvalidSRAMFileException(enum isfe_error error); 00049 00050 /** 00051 * Gets the error code for this InvalidSRAMFileException. 00052 * 00053 * @return The error code. 00054 */ 00055 enum isfe_error getError() const; 00056 }; 00057 00058 inline InvalidSRAMFileException:: 00059 InvalidSRAMFileException(enum isfe_error error) : 00060 std::runtime_error("InvalidSRAMFileException"), error(error) {} 00061 00062 inline enum isfe_error InvalidSRAMFileException::getError() const 00063 { return error; } 00064 } 00065 00066 #endif 00067