00001 /***************************************************************************** 00002 * Copyright (C) 2005 Eliot 00003 * Authors: Olivier Teuliere <ipkiss@via.ecp.fr> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 *****************************************************************************/ 00019 00020 #ifndef _CROSS_H_ 00021 #define _CROSS_H_ 00022 00023 #include "tile.h" 00024 #include <set> 00025 00026 using namespace std; 00027 00028 00029 /************************* 00030 * 00031 *************************/ 00032 00033 class Cross 00034 { 00035 public: 00036 Cross(); 00037 virtual ~Cross() {} 00038 00039 void setAny() { m_any = true; } 00040 bool isAny() const { return m_any; } 00041 bool check(const Tile& iTile) const; 00042 00043 bool operator==(const Cross &iOther) const; 00044 bool operator!=(const Cross &iOther) const { return !(*this == iOther); } 00045 00046 // Standard set methods (almost) 00047 unsigned int size() const { return m_tilesSet.size(); } 00048 void insert(const Tile& iTile) { m_tilesSet.insert(iTile); } 00049 void clear(); 00050 00051 private: 00052 // Set of the tiles accepted for the cross check 00053 set<Tile> m_tilesSet; 00054 00055 // When this value is true, any letter matches the cross check 00056 bool m_any; 00057 }; 00058 00059 #endif 00060 00061 /// Local Variables: 00062 /// mode: c++ 00063 /// mode: hs-minor 00064 /// c-basic-offset: 4 00065 /// indent-tabs-mode: nil 00066 /// End: