src/MoveIterator.cpp

Go to the documentation of this file.
00001 
00008 /*
00009 This file is part of Teapot Colony Wars.
00010 
00011 Teapot Colony Wars is free software: you can redistribute it and/or modify
00012 it under the terms of the GNU General Public License as published by
00013 the Free Software Foundation, either version 2 of the License, or
00014 (at your option) any later version.
00015 
00016 Teapot Colony Wars is distributed in the hope that it will be useful,
00017 but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 GNU General Public License for more details.
00020 
00021 You should have received a copy of the GNU General Public License
00022 along with Teapot Colony Wars.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 #include "MoveIterator.h"
00026 
00027 #include <cstdlib>
00028 
00029 #include "Move.h"
00030 
00031 MoveIterator::MoveIterator() : _move(NULL) {
00032 
00033 }
00034 
00035 MoveIterator::MoveIterator(Move * move) : _move(move) {
00036 
00037 }
00038 
00039 MoveIterator::~MoveIterator() {
00040 
00041 }
00042 
00043 MoveIterator& MoveIterator::operator=(const MoveIterator& m) {
00044   _move = m._move;
00045   return (*this);
00046 }
00047 
00048 bool MoveIterator::operator==(const MoveIterator & m) const {
00049   return (_move == m._move);
00050 }
00051 
00052 bool MoveIterator::operator<(const MoveIterator & m) const {
00053   return (this->operator*() < m.operator*()); //Compares the handled movements
00054 }
00055 
00056 bool MoveIterator::operator!=(const MoveIterator & m) const {
00057   return (_move != m._move);
00058 }
00059 
00060 MoveIterator& MoveIterator::operator++() {
00061   if(_move){
00062     _move = _move->_next;
00063   }
00064   return (*this);
00065 }
00066 
00067 move_command MoveIterator::operator*(void) const {
00068   return _move->getHandledMovement();
00069 }
00070 
00071 Move * MoveIterator::operator->(void) const {
00072   return _move;
00073 }

Generated on Sat Feb 2 22:22:54 2008 for Teapot Colony Wars by  doxygen 1.5.4