MythTV  master
Presentable.h
Go to the documentation of this file.
1 /* Presentable.h
2 
3  Copyright (C) David C. J. Matthews 2004 dm at prolingua.co.uk
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  as published by the Free Software Foundation; either version 2
8  of the License, or (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18  Or, point your browser to http://www.gnu.org/copyleft/gpl.html
19 
20 */
21 
22 
23 #if !defined(PRESENTABLE_H)
24 #define PRESENTABLE_H
25 
26 #include "Ingredients.h"
27 // Dependencies
28 #include "Root.h"
29 #include "BaseClasses.h"
30 #include "BaseActions.h"
31 #include "Actions.h"
32 
33 
34 class MHPresentable : public MHIngredient
35 {
36  public:
37  MHPresentable() = default;
39  // No new components.
40 
41  // Actions.
42  void Run(MHEngine *engine) override; // MHRoot
43  void Stop(MHEngine *engine) override; // MHRoot
44 
45  // Additional actions for stream components.
46  virtual void BeginPlaying(MHEngine *) {}
47  virtual void StopPlaying(MHEngine *) {}
48 };
49 
50 // Run and stop actions.
51 class MHRun: public MHElemAction
52 {
53  public:
54  MHRun(): MHElemAction(":Run") {}
55  void Perform(MHEngine *engine) override // MHElemAction
56  { Target(engine)->Run(engine); }
57 };
58 
59 class MHStop: public MHElemAction
60 {
61  public:
62  MHStop(): MHElemAction(":Stop") {}
63  void Perform(MHEngine *engine) override // MHElemAction
64  { Target(engine)->Stop(engine); }
65 };
66 
67 #endif
MHRoot * Target(MHEngine *engine)
Definition: BaseActions.cpp:46
void Run(MHEngine *engine) override
Definition: Presentable.cpp:27
MHPresentable()=default
void Perform(MHEngine *engine) override
Definition: Presentable.h:55
virtual void StopPlaying(MHEngine *)
Definition: Presentable.h:47
virtual void Run(MHEngine *)
Definition: Root.h:95
virtual void BeginPlaying(MHEngine *)
Definition: Presentable.h:46
MHStop()
Definition: Presentable.h:62
MHRun()
Definition: Presentable.h:54
virtual void Stop(MHEngine *)
Definition: Root.h:96
void Perform(MHEngine *engine) override
Definition: Presentable.h:63
void Stop(MHEngine *engine) override
Definition: Presentable.cpp:35
MHPresentable(const MHPresentable &ref)
Definition: Presentable.h:38