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: gamegeniecode.hh,v 1.9 2008/12/18 03:23:30 jdratlif Exp $ 00024 00025 #ifndef GGENCODER_GAMEGENIECODE_HH_ 00026 #define GGENCODER_GAMEGENIECODE_HH_ 00027 00028 #include <QString> 00029 00030 namespace ggencoder { 00031 /** 00032 * Interface for a Game Genie code. 00033 */ 00034 class GameGenieCode { 00035 private: 00036 QString code; 00037 00038 public: 00039 /** 00040 * Virtual destructor for a GameGenieCode. 00041 */ 00042 virtual ~GameGenieCode(); 00043 00044 /** 00045 * Gets the game genie alphabet. 00046 * 00047 * @return The genie alphabet array. 00048 */ 00049 virtual const char *getAlphabet() const = 0; 00050 00051 /** 00052 * Gets the number of letters in the game genie alphabet. 00053 * 00054 * @return The alphabet letter count. 00055 */ 00056 virtual int getAlphabetCount() const; 00057 00058 /** 00059 * Gets the game genie code. 00060 * 00061 * @return The game genie code. 00062 */ 00063 const QString &getCode() const; 00064 00065 /** 00066 * Sets the game genie code. 00067 * 00068 * @param code The new game genie code. 00069 */ 00070 void setCode(const QString &code); 00071 00072 /** 00073 * Gets the corresponding hex value for a particular game genie letter. 00074 * 00075 * @param letter The game genie letter. 00076 * 00077 * @return The hex value of the letter or -1 if the letter is invalid. 00078 */ 00079 virtual int toHex(char letter) const; 00080 }; 00081 00082 inline GameGenieCode::~GameGenieCode() {} 00083 inline int GameGenieCode::getAlphabetCount() const 00084 { return 16; } 00085 inline const QString &GameGenieCode::getCode() const 00086 { return code; } 00087 inline void GameGenieCode::setCode(const QString &code) 00088 { this->code = code.toUpper(); } 00089 } 00090 00091 #endif 00092