File indexing completed on 2024-05-12 16:23:27
0001 /*************************************************************************** 0002 * Copyright (C) 2013-2017 by Linuxstopmotion contributors; * 0003 * see the AUTHORS file for details. * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 0021 0022 #ifndef COMMANDLOGGER_H_ 0023 #define COMMANDLOGGER_H_ 0024 0025 /** 0026 * For receiving the command's string representation during calls to Make 0027 * methods. 0028 */ 0029 class CommandLogger { 0030 protected: 0031 virtual ~CommandLogger() = 0; 0032 public: 0033 /** 0034 * Records text representing the command about to be executed. 0035 * If any command, undo or redo has previously been recorded but not 0036 * committed, it is discarded. 0037 * @par 0038 * This function is allowed to throw an exception. The written command is 0039 * not to be committed to the log until the @ref commit method is called. 0040 * @par 0041 * @ref commit needs to be called later, when the command has been 0042 * successfully executed. 0043 * @param text The text of the command to be written to the log. Should 0044 * not contain any nulls or line delimiters. 0045 */ 0046 virtual void writePendingCommand(const char* text) = 0; 0047 /** 0048 * Records that an undo is about to happen. Any previous uncommitted 0049 * command or undo or redo is discarded. The undo is not committed until 0050 * @ref commit is called later. 0051 */ 0052 virtual void writePendingUndo() = 0; 0053 /** 0054 * Records that a redo is about to happen. Any previous uncommitted 0055 * command or undo or redo is discarded. The redo is not committed until 0056 * @ref commit is called later. 0057 */ 0058 virtual void writePendingRedo() = 0; 0059 /** 0060 * Indicates that the command, undo or redo has been successfully executed. 0061 */ 0062 virtual void commit() = 0; 0063 /** 0064 * Writes committed commands to the file. This will only have an effect if 0065 * a previous call to commit() threw an exception. 0066 */ 0067 virtual void flush() = 0; 0068 }; 0069 0070 #endif /* COMMANDLOGGER_H_ */