Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CompoundCommand.cxx

Go to the documentation of this file.
00001 //     $Id: CompoundCommand.cxx,v 1.1.1.1 2001/01/04 01:01:11 burnett Exp $
00002 //  Author: Toby Burnett
00003 //
00004 // Implementation of CompoundCommand
00005 
00006 #include "gui/CompoundCommand.h"
00007 #include <algorithm>
00008 
00009 namespace gui {
00010 
00011 CompoundCommand::CompoundCommand(Command* cmd)
00012 {
00013     if(cmd ) append(cmd);
00014 }
00015 
00016 void CompoundCommand::append(Command * cmd)
00017 {
00018     push_back(cmd);
00019 }
00020 
00021 CompoundCommand::~CompoundCommand()
00022 {
00023     iterator ic = begin();
00024     while (ic != end() )
00025         delete *ic++;
00026 }
00027 
00028 //static void Executor (Command *p) { p->execute (); }
00029 class Executor { 
00030 public: 
00031     void operator()(Command* c){c->execute();} 
00032 };
00033 
00034 void CompoundCommand::execute()
00035 {
00036     std::for_each (begin (), end (), Executor());
00037 }
00038 
00039 } // namespace gui

Generated at Wed Nov 21 12:20:54 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000