rack.cpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Copyright (C) 1999-2005 Eliot
00003  * Authors: Antoine Fraboulet <antoine.fraboulet@free.fr>
00004  *          Olivier Teuliere  <ipkiss@via.ecp.fr>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  *****************************************************************************/
00020 
00021 /**
00022  *  \file   rack.cpp
00023  *  \brief  Rack class : multiset of tiles
00024  *  \author Antoine Fraboulet & Olivier Teuliere
00025  *  \date   2002 - 2005
00026  */
00027 
00028 #include "rack.h"
00029 
00030 
00031 void Rack::remove(const Tile &t)
00032 {
00033     multiset<Tile>::const_iterator it = m_tiles.find(t);
00034     if (it != m_tiles.end())
00035         m_tiles.erase(it);
00036 }
00037 
00038 
00039 void Rack::getTiles(list<Tile> &oTiles) const
00040 {
00041     multiset<Tile>::const_iterator it;
00042     for (it = m_tiles.begin(); it != m_tiles.end(); it++)
00043     {
00044         oTiles.push_back(*it);
00045     }
00046 }
00047 
00048 
00049 string Rack::toString()
00050 {
00051   string rs("");
00052   multiset<Tile>::const_iterator it;
00053   for (it = m_tiles.begin(); it != m_tiles.end(); it++)
00054     {
00055       rs += it->toChar();
00056     }
00057   return rs;
00058 }
00059 
00060 /// Local Variables:
00061 /// mode: c++
00062 /// mode: hs-minor
00063 /// c-basic-offset: 4
00064 /// indent-tabs-mode: nil
00065 /// End:

Generated on Thu Dec 29 02:01:14 2005 for Eliot by  doxygen 1.4.5