libyui  3.0.10
/usr/src/RPM/BUILD/libyui-3.0.10/src/YMacro.h
00001 /*
00002   Copyright (C) 2000-2012 Novell, Inc
00003   This library is free software; you can redistribute it and/or modify
00004   it under the terms of the GNU Lesser General Public License as
00005   published by the Free Software Foundation; either version 2.1 of the
00006   License, or (at your option) version 3.0 of the License. This library
00007   is distributed in the hope that it will be useful, but WITHOUT ANY
00008   WARRANTY; without even the implied warranty of MERCHANTABILITY or 
00009   FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00010   License for more details. You should have received a copy of the GNU
00011   Lesser General Public License along with this library; if not, write
00012   to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
00013   Floor, Boston, MA 02110-1301 USA
00014 */
00015 
00016 
00017 /*-/
00018 
00019   File:         YMacro.h
00020 
00021   Author:       Stefan Hundhammer <sh@suse.de>
00022 
00023 /-*/
00024 
00025 #ifndef YMacro_h
00026 #define YMacro_h
00027 
00028 #include <string>
00029 
00030 class YMacroRecorder;
00031 class YMacroPlayer;
00032 
00033 
00034 /**
00035  * Simple access to macro recording and playing.
00036  *
00037  * This class stores an instance of a macro recorder and a macro player.
00038  * Since both YMacroRecorder and YMacroPlayer are abstract base classes,
00039  * derived classes from either of them have to be instantiated and set
00040  * (setRecorder(), setPlayer()) from the outside for anything to happen. Until
00041  * that point, none of the macro operations here do anything (but also don't
00042  * throw any error or exception).
00043  **/
00044 class YMacro
00045 {
00046 private:
00047     YMacro() {}
00048     ~YMacro() {}
00049 
00050 public:
00051 
00052     /**
00053      * Set a macro recorder.
00054      *
00055      * This needs to be done from the outside since YMacroRecorder is an
00056      * abstract base class, i.e., it needs to be derived to be instantiated.
00057      **/
00058     static void setRecorder( YMacroRecorder * recorder );
00059 
00060     /**
00061      * Set a macro player.
00062      *
00063      * This needs to be done from the outside since YMacroRecorder is an
00064      * abstract base class, i.e., it needs to be derived to be instantiated.
00065      **/
00066     static void setPlayer( YMacroPlayer * player );
00067 
00068     /**
00069      * Record a macro to the specified macro file.
00070      **/
00071     static void record( const std::string & macroFile );
00072 
00073     /**
00074      * End macro recording.
00075      **/
00076     static void endRecording();
00077 
00078     /**
00079      * Return 'true' if a macro is currently being recorded.
00080      **/
00081     static bool recording();
00082 
00083     /**
00084      * Play a macro from the specified macro file.
00085      **/
00086     static void play( const std::string & macroFile );
00087 
00088     /**
00089      * Play the next block from the current macro, if there is one playing.
00090      **/
00091     static void playNextBlock();
00092 
00093     /**
00094      * Return 'true' if a macro is currently being played.
00095      **/
00096     static bool playing();
00097 
00098     /**
00099      * Return the current macro recorder or 0 if there is none.
00100      **/
00101     static YMacroRecorder * recorder() { return _recorder; }
00102 
00103     /**
00104      * Return the current macro player or 0 if there is none.
00105      **/
00106     static YMacroPlayer * player() { return _player; }
00107 
00108     /**
00109      * Delete the current macro recorder if there is one.
00110      **/
00111     static void deleteRecorder();
00112 
00113     /**
00114      * Delete the current macro player if there is one.
00115      **/
00116     static void deletePlayer();
00117 
00118 private:
00119 
00120     static YMacroRecorder * _recorder;
00121     static YMacroPlayer   * _player;
00122 };
00123 
00124 
00125 
00126 #endif // YMacro_h
 All Classes Functions Variables Enumerations Friends