1 /************************************************************************ 2 * * 3 * FreeSynd - a remake of the classic Bullfrog game "Syndicate". * 4 * * 5 * Copyright (C) 2010 Benoit Blancard <benblan@users.sourceforge.net>* 6 * * 7 * This program is free software; you can redistribute it and / or * 8 * modify it under the terms of the GNU General Public License as * 9 * published by the Free Software Foundation; either version 2 of the * 10 * License, or (at your option) any later version. * 11 * * 12 * This program is distributed in the hope that it will be useful, * 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 15 * General Public License for more details. * 16 * * 17 * You can view the GNU General Public License, online, at the GNU * 18 * project's web site; see <http://www.gnu.org/licenses/gpl.html>. * 19 * The full text of the license is also included in the file COPYING. * 20 * * 21 ************************************************************************/ 22 23 #include "seqmodel.h" 24 ~SequenceModel()25SequenceModel::~SequenceModel() { 26 listeners_.clear(); 27 } 28 addModelListener(ModelListener * pListener)29void SequenceModel::addModelListener(ModelListener *pListener) { 30 listeners_.push_back(pListener); 31 } 32 removeModelListener(ModelListener * pListener)33void SequenceModel::removeModelListener(ModelListener *pListener) { 34 for (std::list < ModelListener * >::iterator it = listeners_.begin(); 35 it != listeners_.end(); it++) { 36 if (pListener == *it) { 37 listeners_.erase(it); 38 return; 39 } 40 } 41 } 42 fireModelChanged()43void SequenceModel::fireModelChanged() { 44 for (std::list < ModelListener * >::iterator it = listeners_.begin(); 45 it != listeners_.end(); it++) { 46 (*it)->handleModelChanged(); 47 } 48 } 49