INIInterface.hh 7.63 KB
 Jan Möbius committed Aug 05, 2009 1 /*===========================================================================*\  Jan Möbius committed Nov 25, 2010 2 3 * * * OpenFlipper *  Martin Schultz committed Jul 16, 2015 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 33 34 35 36 37 38  * Copyright (c) 2001-2015, RWTH-Aachen University * * Department of Computer Graphics and Multimedia * * All rights reserved. * * www.openflipper.org * * * *---------------------------------------------------------------------------* * This file is part of OpenFlipper. * *---------------------------------------------------------------------------* * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted provided that the following conditions * * are met: * * * * 1. Redistributions of source code must retain the above copyright notice, * * this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * 3. Neither the name of the copyright holder nor the names of its * * contributors may be used to endorse or promote products derived from * * this software without specific prior written permission. * * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *  Jan Möbius committed Nov 25, 2010 39 * *  Jan Möbius committed Aug 05, 2009 40 41 42 \*===========================================================================*/ /*===========================================================================*\  Jan Möbius committed Nov 25, 2010 43 44 45 46 47 * * * $Revision$ * * $LastChangedBy$ * * $Date$ * * *  Jan Möbius committed Aug 05, 2009 48 \*===========================================================================*/  Jan Möbius committed Aug 29, 2008 49 50   Jan Möbius committed Jan 27, 2009 51 52 #ifndef INIINTERFACE_HH #define INIINTERFACE_HH  Jan Möbius committed Aug 29, 2008 53   Matthias Möller committed Aug 25, 2014 54 55  #include  Matthias Möller committed Jul 19, 2013 56 57 58 59 60 61 #if QT_VERSION >= 0x050000 #include #else #include #endif  Jan Möbius committed Aug 29, 2008 62  #include  Matthias Möller committed Aug 25, 2014 63   Jan Möbius committed Jan 27, 2009 64   Jan Möbius committed Aug 29, 2008 65  #include  Jan Möbius committed Jan 27, 2009 66 67 68  /** \brief Interface class for Plugins which have to store information in ini files *  Jan Möbius committed Feb 03, 2009 69 70 71 72  * Using this interface you can store or load additional information to an ini file on a * per object basis or settings for your plugin. After basic information is written to the * ini file by the core ( or loaded by the core ) the corresponding functions in this * Interface will be executed.  Jan Möbius committed Aug 29, 2008 73 74  * You get the object id for the object which has to be used. For every object the functions * will get called and you have to save your data only for the given object!\n  Jan Möbius committed Feb 03, 2009 75 76 77  * The ini file in the functions is already open. You may not close it! * Additionally there are two slots which are called once per plugin when writing a settings * file. These slots should be used to store information which is used by your plugin.  Mike Kremer committed Feb 04, 2009 78 79  * * See \ref dataFlow for a detailed overview of OpenFlipper's data flow and interface function calls.  Jan Möbius committed Aug 29, 2008 80 81  */ class INIInterface {  Jan Möbius committed Jan 27, 2009 82 83  public :  Jan Möbius committed Aug 29, 2008 84 85  /// Destructor virtual ~INIInterface() {};  Jan Möbius committed Jan 27, 2009 86   Jan Möbius committed Aug 29, 2008 87  private slots:  Jan Möbius committed Feb 03, 2009 88 89 90 91 92 93 94 95 96 97 98 99  //======================================= /** @name Per object settings * @{ */ //======================================= /** \brief Load per object settings * * Every time the core opens a settings file containing objects * the core will call this slot for each object it finds. * The object itself is loaded before the slot is called. Therefore * the object is available from within your plugin. *  Jan Möbius committed Aug 29, 2008 100 101 102  * @param _ini ini file * @param _id Id of the object to load data for */  Jan Möbius committed Mar 20, 2012 103  virtual void loadIniFile( INIFile& _ini ,int _id ) {};  Jan Möbius committed Jan 27, 2009 104   Jan Möbius committed Feb 03, 2009 105 106 107 108 109 110  /** \brief Save per object settings * * Every time a settings file is created this slot is called * once per object. Here you can write additional information * handled by your plugin which is attached to the object. *  Jan Möbius committed Aug 29, 2008 111  * @param _ini ini file  Jan Möbius committed Feb 03, 2009 112  * @param _id Identifier of the object to save  Jan Möbius committed Aug 29, 2008 113  */  Jan Möbius committed Mar 20, 2012 114  virtual void saveIniFile( INIFile& _ini ,int _id) {};  Jan Möbius committed Jan 27, 2009 115   Jan Möbius committed Feb 03, 2009 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133  /** @} */ //======================================= /** @name Plugin Options and Settings * @{ */ //======================================= private slots: /** \brief Load per Plugin settings * * When the core loads an ini file and it contains settings for * Plugin or the core itself this slot will be * called once per Plugin. * This Slot will be called after loading the core settings and * before objects are loaded *  Jan Möbius committed Aug 29, 2008 134 135  * @param _ini ini file */  Jan Möbius committed Mar 20, 2012 136  virtual void loadIniFileOptions( INIFile& _ini ) {};  Jan Möbius committed Jan 27, 2009 137   Jan Möbius committed Feb 03, 2009 138 139 140 141 142 143 144 145 146  /** \brief Load per Plugin settings after objects are loaded * * When the core loads an ini file and it contains settings for * Plugin or the core itself this slot will be * called once per Plugin. In contrast to loadIniFileOptions * this slot will be called after all objects are loaded * * @param _ini ini file */  Jan Möbius committed Mar 20, 2012 147  virtual void loadIniFileOptionsLast( INIFile& _ini ) {};  Jan Möbius committed Feb 03, 2009 148 149  /** \brief Save Plugin Options  Jan Möbius committed May 18, 2009 150  * When the core is about to save an ini file this slot will be  Jan Möbius committed Feb 03, 2009 151 152 153 154  * called once per Plugin. * This Slot will be called after saving the core settings and * before objects are saved to the file *  Jan Möbius committed Aug 29, 2008 155 156  * @param _ini ini file */  Jan Möbius committed Mar 20, 2012 157  virtual void saveIniFileOptions( INIFile& _ini ) {};  Jan Möbius committed Jan 27, 2009 158   Jan Möbius committed May 18, 2009 159 160 161 162 163 164 165  /** \brief Save per Plugin settings when application is about to quit * * Before the Core is closed, this slot will be called per plugin to * save per plugin settings. * * @param _ini ini file */  Jan Möbius committed Mar 20, 2012 166  virtual void saveOnExit( INIFile& _ini ) {};  Jan Möbius committed May 18, 2009 167 168   Jan Möbius committed Feb 03, 2009 169 170 171  /** @} */  Jan Möbius committed Aug 29, 2008 172 173 174 }; Q_DECLARE_INTERFACE(INIInterface,"OpenFlipper.INIInterface/1.2")  Jan Möbius committed Jan 27, 2009 175   Jan Möbius committed Aug 29, 2008 176 #endif // INIINTERFACE_HH