libyui  3.3.2
YMacro.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YMacro.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 #ifndef YMacro_h
26 #define YMacro_h
27 
28 #include <string>
29 
30 class YMacroRecorder;
31 class YMacroPlayer;
32 
33 
34 /**
35  * Simple access to macro recording and playing.
36  *
37  * This class stores an instance of a macro recorder and a macro player.
38  * Since both YMacroRecorder and YMacroPlayer are abstract base classes,
39  * derived classes from either of them have to be instantiated and set
40  * (setRecorder(), setPlayer()) from the outside for anything to happen. Until
41  * that point, none of the macro operations here do anything (but also don't
42  * throw any error or exception).
43  **/
44 class YMacro
45 {
46 private:
47  YMacro() {}
48  ~YMacro() {}
49 
50 public:
51 
52  /**
53  * Set a macro recorder.
54  *
55  * This needs to be done from the outside since YMacroRecorder is an
56  * abstract base class, i.e., it needs to be derived to be instantiated.
57  **/
58  static void setRecorder( YMacroRecorder * recorder );
59 
60  /**
61  * Set a macro player.
62  *
63  * This needs to be done from the outside since YMacroRecorder is an
64  * abstract base class, i.e., it needs to be derived to be instantiated.
65  **/
66  static void setPlayer( YMacroPlayer * player );
67 
68  /**
69  * Record a macro to the specified macro file.
70  **/
71  static void record( const std::string & macroFile );
72 
73  /**
74  * End macro recording.
75  **/
76  static void endRecording();
77 
78  /**
79  * Return 'true' if a macro is currently being recorded.
80  **/
81  static bool recording();
82 
83  /**
84  * Play a macro from the specified macro file.
85  **/
86  static void play( const std::string & macroFile );
87 
88  /**
89  * Play the next block from the current macro, if there is one playing.
90  **/
91  static void playNextBlock();
92 
93  /**
94  * Return 'true' if a macro is currently being played.
95  **/
96  static bool playing();
97 
98  /**
99  * Return the current macro recorder or 0 if there is none.
100  **/
101  static YMacroRecorder * recorder() { return _recorder; }
102 
103  /**
104  * Return the current macro player or 0 if there is none.
105  **/
106  static YMacroPlayer * player() { return _player; }
107 
108  /**
109  * Delete the current macro recorder if there is one.
110  **/
111  static void deleteRecorder();
112 
113  /**
114  * Delete the current macro player if there is one.
115  **/
116  static void deletePlayer();
117 
118 private:
119 
120  static YMacroRecorder * _recorder;
121  static YMacroPlayer * _player;
122 };
123 
124 
125 
126 #endif // YMacro_h
static void setPlayer(YMacroPlayer *player)
Set a macro player.
Definition: YMacro.cc:43
Abstract base class for macro recorders.
Abstract base class for macro player.
Definition: YMacroPlayer.h:35
static void deletePlayer()
Delete the current macro player if there is one.
Definition: YMacro.cc:105
static YMacroRecorder * recorder()
Return the current macro recorder or 0 if there is none.
Definition: YMacro.h:101
static YMacroPlayer * player()
Return the current macro player or 0 if there is none.
Definition: YMacro.h:106
static void endRecording()
End macro recording.
Definition: YMacro.cc:59
static bool recording()
Return &#39;true&#39; if a macro is currently being recorded.
Definition: YMacro.cc:66
Simple access to macro recording and playing.
Definition: YMacro.h:44
static void setRecorder(YMacroRecorder *recorder)
Set a macro recorder.
Definition: YMacro.cc:34
static void play(const std::string &macroFile)
Play a macro from the specified macro file.
Definition: YMacro.cc:75
static void playNextBlock()
Play the next block from the current macro, if there is one playing.
Definition: YMacro.cc:82
static void record(const std::string &macroFile)
Record a macro to the specified macro file.
Definition: YMacro.cc:52
static bool playing()
Return &#39;true&#39; if a macro is currently being played.
Definition: YMacro.cc:89
static void deleteRecorder()
Delete the current macro recorder if there is one.
Definition: YMacro.cc:98