home *** CD-ROM | disk | FTP | other *** search
-
- // abstract.h.command
-
- // Dreamscape - C++ class library for RISC OS
- // Copyright (c) 1996 Mark Seaborn <mseaborn@argonet.co.uk>
- //
- // This library is free software; you can redistribute it and/or
- // modify it under the terms of the GNU Library General Public
- // License as published by the Free Software Foundation; either
- // version 2 of the License, or (at your option) any later version.
- // See the Dreamscape documentation for more information.
-
- #ifndef dreamscape_command_H
- #define dreamscape_command_H
-
- #include "list.h"
-
- class Command {
- public:
- virtual void execute() = 0;
- };
-
- class MultiCommand: public Command {
- public:
- List<Command *> commands;
- inline void execute();
- };
-
- inline void MultiCommand::execute()
- {
- for(ListIterator<Command *> l=commands.begin(); l!=commands.end(); ++l)
- (*l)->execute();
- }
-
- template <class Type>
- class DeleteObjectCommand: public Command {
- Type *object;
- public:
- DeleteObjectCommand(Type *o): object(o) {}
- void execute() { delete object; }
- };
-
- #endif
-