LoadSaveInterface.hh 6.09 KB
Newer Older
1
/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
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 <http://www.gnu.org/licenses/>.                                       *
*                                                                            *
33 34 35
\*===========================================================================*/

/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
36 37 38 39 40
*                                                                            *
*   $Revision$                                                       *
*   $LastChangedBy$                                                *
*   $Date$                     *
*                                                                            *
41
\*===========================================================================*/
42 43 44 45 46 47 48




//
// C++ Interface: Load/Save Interface
//
49
// Description:
50 51 52 53 54
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//

55 56
#ifndef LOADSAVEINTERFACE_HH
#define LOADSAVEINTERFACE_HH
57 58 59 60

#include <OpenFlipper/common/Types.hh>

/** \brief Interface for all plugins which want to load or save files
61
  *
62
  * Using this interface you can instruct the core to open/save objects or
63 64
  * create new empty objects.
 */
65
class LoadSaveInterface {
66 67

   public:
68

69 70
      /// Destructor
      virtual ~LoadSaveInterface() {};
71

72 73
   signals :
      /** Tries to load the file as a given type
74
       *
75
       * @param _filename Filename of the File to load
76
       * @param _type Type to be loaded
77 78
       * @param _id Here the id of the loaded object is returned. id its -1 something went wrong
       */
Dirk Wilden's avatar
Dirk Wilden committed
79
      virtual void load(QString /*_filename*/, DataType /*_type*/, int& /*_id*/) {};
80

81
      /** Add an empty object of the given type
82
       *
83 84 85
       * @param _type Type to be created
       * @param _id Here the id of the loaded object is returned. id its -1 something went wrong
       */
Dirk Wilden's avatar
Dirk Wilden committed
86
      virtual void addEmptyObject( DataType /*_type*/, int& /*_id*/) {};
87

88 89 90 91 92 93 94
      /** Create a copy of an existing object
       *
       * @param _oldId id of the object to copy
       * @param _newId id of the new object created
       */
      virtual void copyObject( int /*_oldId*/, int& /*_newId*/) {};

95
      /**
96
       *
97 98 99
       * @param _id Object to Save
       * @param _filename Filename to save it to (Leave as "" to automatically determine filename)
       */
Dirk Wilden's avatar
Dirk Wilden committed
100
      virtual void save(int /*_id*/ , QString /*_filename*/ ) {};
101

102 103 104
      /** \brief file has been opened
       * @param _id Id of the opened object
       */
Dirk Wilden's avatar
Dirk Wilden committed
105
      virtual void openedFile( int /*_id*/ ) {};
106

107 108
      /** \brief Emit this signal if an empty object has been created
       * @param _id Id of the added object
109
       */
Dirk Wilden's avatar
Dirk Wilden committed
110
      virtual void emptyObjectAdded( int /*_id*/ ) {};
111

112 113 114 115
     /** \brief get a list of all Filters
       *
       *  request a list of all Filters
       *
116
       *  @param _list StringList where the filters should be put into
117
       */
Dirk Wilden's avatar
Dirk Wilden committed
118
      virtual void getAllFilters( QStringList& /*_list*/ ) {};
119 120 121 122 123 124 125 126


      /** \brief Delete an object
       *
       * @param _id Id of the object
       */
      virtual void deleteObject( int /*_id*/ ){};

127 128 129 130 131
      /** \brief Delete all Objects
       *
       */
      virtual void deleteAllObjects(){};

132
  private slots :
133

134
    /**  \brief A file has been opened
135
     *
136 137 138
     *  This slot is called if a file has been opened by the core.\n
     *  @param _id Id of the new object
     */
Dirk Wilden's avatar
Dirk Wilden committed
139
    virtual void fileOpened( int /*_id*/ ) {};
Dirk Wilden's avatar
Dirk Wilden committed
140 141

    /**  \brief An empty object has been added
142
     *
Dirk Wilden's avatar
Dirk Wilden committed
143 144 145 146 147
     *  This slot is called if an empty object has been added by the core.\n
     *  @param _id Id of the new object
     */
    virtual void addedEmptyObject( int /*_id*/ ) {};

148 149 150 151 152 153
    /** \brief An object was deleted
      *
      * @param _id Id of the object
      */
    virtual void objectDeleted( int /*_id*/ ){};

154 155 156
};

Q_DECLARE_INTERFACE(LoadSaveInterface,"OpenFlipper.LoadSaveInterface/1.0")
157

158
#endif // LOADSAVEINTERFACE_HH