00001 /* 00002 * Game Genie Encoder/Decoder 00003 * Copyright (C) 2004-2006,2008 emuWorks 00004 * http://games.technoplaza.net/ 00005 * 00006 * This file is part of Game Genie Encoder/Decoder. 00007 * 00008 * Game Genie Encoder/Decoder is free software; you can redistribute it and/or 00009 * modify 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 * Game Genie Encoder/Decoder 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 Game Genie Encoder/Decoder; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 // $Id: genesisgamegeniecode.hh,v 1.8 2008/12/18 03:23:30 jdratlif Exp $ 00024 00025 #ifndef GGENCODER_GENESISGAMEGENIECODE_HH_ 00026 #define GGENCODER_GENESISGAMEGENIECODE_HH_ 00027 00028 #include "exceptions/invalidgamegeniecode.hh" 00029 00030 #include "model/gamegeniecode.hh" 00031 00032 namespace ggencoder { 00033 /** 00034 * An implementation of a Genesis game genie code. 00035 */ 00036 class GenesisGameGenieCode : public GameGenieCode { 00037 private: 00038 /** 00039 * Constructor for an GenesisGameGenieCode. 00040 */ 00041 GenesisGameGenieCode(const QString &code); 00042 00043 public: 00044 /// The game genie alphabet. 00045 static const char ALPHABET[]; 00046 00047 /** 00048 * Creates a GenesisGameGenieCode object. 00049 * 00050 * @param code The game genie code string. 00051 * 00052 * @throws InvalidGameGenieCodeException if the code is invalid. 00053 */ 00054 static GenesisGameGenieCode create(const QString &code) 00055 throw (InvalidGameGenieCodeException); 00056 00057 /** 00058 * Gets the game genie alphabet. 00059 * 00060 * @return The genie alphabet array. 00061 */ 00062 const char *getAlphabet() const; 00063 00064 /** 00065 * Gets the number of letters in the game genie alphabet. 00066 * 00067 * @return The alphabet letter count. 00068 */ 00069 int getAlphabetCount() const; 00070 00071 /** 00072 * Checks if the code is a valid game genie code. 00073 * 00074 * @param code The code to check. 00075 * 00076 * @return true if valid; false otherwise. 00077 */ 00078 static bool isValidCode(const QString &code); 00079 }; 00080 00081 inline GenesisGameGenieCode::GenesisGameGenieCode(const QString &code) 00082 { setCode(code); } 00083 inline int GenesisGameGenieCode::getAlphabetCount() const 00084 { return 32; } 00085 } 00086 00087 #endif 00088