BackupInterface.hh 11 KB
 Jan Möbius committed Aug 05, 2009 1 /*===========================================================================*\  Jan Möbius committed Nov 25, 2010 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 * * * OpenFlipper * * Copyright (C) 2001-2010 by Computer Graphics Group, RWTH Aachen * * www.openflipper.org * * * *--------------------------------------------------------------------------- * * This file is part of OpenFlipper. * * * * OpenFlipper is free software: you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of * * the License, or (at your option) any later version with the * * following exceptions: * * * * If other files instantiate templates or use macros * * or inline functions from this file, or you compile this file and * * link it with other files to produce an executable, this file does * * not by itself cause the resulting executable to be covered by the * * GNU Lesser General Public License. This exception does not however * * invalidate any other reasons why the executable file might be * * covered by the GNU Lesser General Public License. * * * * OpenFlipper is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Lesser General Public License for more details. * * * * You should have received a copy of the GNU LesserGeneral Public * * License along with OpenFlipper. If not, * * see . * * *  Jan Möbius committed Aug 05, 2009 33 34 35 \*===========================================================================*/ /*===========================================================================*\  Jan Möbius committed Nov 25, 2010 36 37 38 39 40 * * * $Revision$ * * $LastChangedBy$ * * $Date$ * * *  Jan Möbius committed Aug 05, 2009 41 \*===========================================================================*/  Jan Möbius committed Aug 29, 2008 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64  // // C++ Interface: Backup Interface // // Description: // // // Author: Jan Moebius , (C) 2007 // #ifndef BACKUPPLUGININTERFACE_HH #define BACKUPPLUGININTERFACE_HH #include #include #include /** \brief Create or restore backups * * Interface Class for Backup Plugins. The Backup Interface can be used to communicate with or write a backup plugin.  Mike Kremer committed Jul 19, 2010 65 66  * * See tutorial \ref ex6 for detailed information on how to use this plugin interface.  Jan Möbius committed Aug 29, 2008 67 68 69  * */ class BackupInterface {  Jan Möbius committed Jun 14, 2010 70 71 72 73 74 75 76  //=========================================================================== /** @name Interface definition for general Plugins * @{ */ //=========================================================================== signals:  Dirk Wilden committed Sep 01, 2010 77 78 79 80 81 82 83 84 85 86 87  /** \brief Tell Backup Plugin to create a backup group * * A backup group can be used to combine multiple object backups into * one backup group and undo all of them at once * * @param _name Name of the Backup group, to show the user what can be recovered * @param _groupId A unique identifier for the created backup group */ virtual void createBackupGroup(QString /*_name*/, int& /*_groupId*/) {};  Jan Möbius committed Jun 14, 2010 88 89 90 91 92 93 94 95  /** \brief Tell Backup Plugin to create a backup * * Plugins which supports backups can call this function if they want to create backups.\n * A Backup control Plugin will do the rest. * @param _objectid Identifier of the object to create the backup * @param _name Name of the Backup, to show the user what can be recovered * @param _internalId A unique identifier for the created backup */  Dirk Wilden committed Sep 01, 2010 96  virtual void createBackup( int /*_objectid*/, QString /*_name*/, int& /*_internalId*/, int /*_groupId*/ = -1) {};  Jan Möbius committed Jun 14, 2010 97 98 99 100 101 102 103 104  /** \brief Tell Backup Plugin to create a backup but don't get the id of the object ( if you don't care ) * * Plugins which supports backups can call this function if they want to create backups.\n * A Backup control Plugin will do the rest. * @param _objectid Identifier of the object to create the backup * @param _name Name of the Backup, to show the user what can be recovered */  Dirk Wilden committed Sep 01, 2010 105  virtual void createBackup( int /*_objectid*/, QString /*_name*/) {};  Jan Möbius committed Jun 14, 2010 106   Jan Möbius committed Jun 14, 2010 107 108 109 110 111 112 113 114  /** \brief Make a backup persistent. * * A persistent backup will not be removed automatically by the backup plugin. * You have to remove it by yourself by calling removeBackup! */ virtual void makeBackupPersistent(int /*_objectid*/, int /*_internalId*/){};  Jan Möbius committed Jun 14, 2010 115 116  /** \brief Tell Backup Plugin to restore a backup *  Mike Kremer committed Jul 19, 2010 117  * Plugins which supports backups can call this function if they want to restore backups.\n  Jan Möbius committed Jun 14, 2010 118 119 120 121 122  * A Backup control Plugin will do the rest. * @param _objectid Identifier of the object to restore * @param _internalId The unique identifier of the restore set (-1 for last backup) */ virtual void restoreObject( int /*_objectid*/, int _internalId =-1) {};  Dirk Wilden committed Sep 01, 2010 123 124 125 126 127 128 129 130 131  /** \brief Tell Backup Plugin to restore a backup group * * Plugins which supports backups can call this function if they want to restore backups.\n * A Backup control Plugin will do the rest. * @param _groupId Identifier of the group to restore */ virtual void restoreGroup( int /*_groupId*/ ) {};  Jan Möbius committed Jun 14, 2010 132 133 134 135 136 137 138 139 140  private slots: /** \brief Backup for an object requested * * This function will be called if a plugin requests a backup. You can * also react on this event if you reimplement this function in your plugin. * @param _id Identifier of the object to create the backup * @param _name Name of the Backup, to show the user what can be recovered * @param _internalId Unique identifier of the backup. This number is generated by the core and returned by the original signal. */  Dirk Wilden committed Sep 01, 2010 141 142 143 144 145 146 147 148 149 150 151  virtual void slotBackup( int /*_objectid*/ , QString /*_name*/ , int /*_internalId*/, int /*_groupId*/ = -1) {}; /** \brief Backup group requested * * This function will be called if a plugin requests a backup group. You can * also react on this event if you reimplement this function in your plugin. * * @param _name Name of the Backup group, to show the user what can be recovered * @param _groupId Unique identifier of the backup group. This number is generated by the core and returned by the original signal. */ virtual void slotBackupGroup( QString /*_name*/ , int /*_groupId*/) {};  Jan Möbius committed Jun 14, 2010 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175  /** \brief A given object will be restored. * * This function is called before an object is restored from a backup. * perObjectDatas and the object will be reset to the backup state * after this function is called for all plugins. * If you have any pointers or references to the given object you have to * clean them up here. * @param _id Identifier of the object which is about to be restored * @param _internalId Unique Number of the Restore set */ virtual void slotAboutToRestore( int /*_objectid*/ , int /*_internalId*/) {}; /** \brief Restore Object * * This function is called after the main object is restored from a backup. * perObjectDatas and the object have been reset to the backup state.\n * * Here you can restore additional data which is not managed in perObjectDatas but * in your local plugin.\n * * @param _objectid Identifier of the object which is about to be restored * @param _internalId Unique Number of the Restore set */  Dirk Wilden committed Sep 01, 2010 176  virtual void slotRestore( int /*_objectid*/ , int /*_internalId*/) {};  Jan Möbius committed Jun 14, 2010 177 178 179 180 181 182 183 184 185 186  /** \brief Object fully restored * * This function is called after an object and all data from other plugins * is restored from a backup. * perObjectDatas and the object have been reset to the backup state. * @param _objectid Identifier of the object which is about to be restored * @param _internalId Unique Number of the Restore set */ virtual void slotRestored( int /*_objectid*/, int /*_internalId*/) {};  Dirk Wilden committed Sep 01, 2010 187   Jan Möbius committed Aug 29, 2008 188 189 190 191  public : /// Destructor virtual ~BackupInterface() {};  Jan Möbius committed Jun 14, 2010 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228  //=========================================================================== /** @name Interface definition for Backup Plugins * * These signals and slots have to be implemented if you create a plugin managing * Backups ( A Backup plugin is already provided by OpenFlipper so you don't need * to use these funcions). * @{ */ //=========================================================================== signals: /** \brief Backup Plugin tells other Plugins that a restore will happen * */ virtual void aboutToRestore(int /*_objectid*/ , int /*_internalId*/) {}; /** \brief Backup Plugin tells other Plugins that they should restore their own data * */ virtual void restore(int /*_objectid*/ , int /*_internalId*/) {}; /** \brief Backup Plugin tells other Plugins that a restore has happened * */ virtual void restored( int /*_objectid*/ , int /*_internalId*/) {}; private slots: /** \brief Restore the core object * * This function has to be implemented in the backup management plugin. Normally * this function is provided by the default backup plugin and should not be used! * To restore data in your plugin use the slotRestore above. * * @param _objectId Object to restore * */  Dirk Wilden committed Sep 01, 2010 229 230 231 232 233 234 235 236 237 238 239 240  virtual void slotRestoreObject(int /*_objectid*/, int /*_internalId*/) {}; /** \brief Restore the a group * * This function has to be implemented in the backup management plugin. Normally * this function is provided by the default backup plugin and should not be used! * To restore data in your plugin use the slotRestore above. * * @param _groupId group to restore * */ virtual void slotRestoreGroup(int /*_groupid*/) {};  Jan Möbius committed Jun 14, 2010 241 242  virtual void slotMakeBackupPersistent(int /*_objectid*/, int /*_internalId*/) {};  Jan Möbius committed Jun 14, 2010 243 244   Jan Möbius committed Aug 29, 2008 245 246 };  Jan Möbius committed Jun 14, 2010 247 Q_DECLARE_INTERFACE(BackupInterface,"GUI.BackupInterface/1.0")  Jan Möbius committed Aug 29, 2008 248 249  #endif // BACKUPPLUGININTERFACE_HH