libyui  3.0.10
 All Classes Functions Variables Enumerations Friends
YMacro.cc
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.cc
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 
26 #include "YMacro.h"
27 #include "YMacroRecorder.h"
28 #include "YMacroPlayer.h"
29 
30 
31 YMacroRecorder * YMacro::_recorder = 0;
32 YMacroPlayer * YMacro::_player = 0;
33 
35 {
36  if ( _recorder )
37  delete _recorder;
38 
39  _recorder = recorder;
40 }
41 
42 
44 {
45  if ( _player )
46  delete _player;
47 
48  _player = player;
49 }
50 
51 
52 void YMacro::record( const std::string & macroFile )
53 {
54  if ( _recorder )
55  _recorder->record( macroFile );
56 }
57 
58 
60 {
61  if ( _recorder )
62  _recorder->endRecording();
63 }
64 
65 
67 {
68  if ( _recorder )
69  return _recorder->recording();
70  else
71  return false;
72 }
73 
74 
75 void YMacro::play( const std::string & macroFile )
76 {
77  if ( _player )
78  _player->play( macroFile );
79 }
80 
81 
83 {
84  if ( _player && _player->playing() )
85  _player->playNextBlock();
86 }
87 
88 
90 {
91  if ( _player )
92  return _player->playing();
93  else
94  return false;
95 }
96 
97 
99 {
100  if ( _recorder )
101  delete _recorder;
102 }
103 
104 
106 {
107  if ( _player )
108  delete _player;
109 }
static void setPlayer(YMacroPlayer *player)
Definition: YMacro.cc:43
virtual void playNextBlock()=0
virtual void record(const std::string &macroFileName)=0
virtual void play(const std::string &macroFile)=0
static void deletePlayer()
Definition: YMacro.cc:105
static YMacroRecorder * recorder()
Definition: YMacro.h:101
virtual void endRecording()=0
static YMacroPlayer * player()
Definition: YMacro.h:106
static void endRecording()
Definition: YMacro.cc:59
static bool recording()
Definition: YMacro.cc:66
static void setRecorder(YMacroRecorder *recorder)
Definition: YMacro.cc:34
virtual bool recording() const =0
static void play(const std::string &macroFile)
Definition: YMacro.cc:75
static void playNextBlock()
Definition: YMacro.cc:82
static void record(const std::string &macroFile)
Definition: YMacro.cc:52
virtual bool playing() const =0
static bool playing()
Definition: YMacro.cc:89
static void deleteRecorder()
Definition: YMacro.cc:98