LoadSaveInterface.hh 4.02 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  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.
// 
//  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 Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision$
//   $Author$
//   $Date$
//
//=============================================================================




//
// C++ Interface: Load/Save Interface
//
// Description: 
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//

#ifndef LOADSAVEINTERFACE_HH 
#define LOADSAVEINTERFACE_HH 

#include <OpenFlipper/common/Types.hh>

/** \brief Interface for all plugins which want to load or save files
  * 
  * Using this interface you can instruct the core to open/save objects or
  * create new empty objects. 
 */ 
class LoadSaveInterface {
55 56 57 58 59

   public:
      
      /// Destructor
      virtual ~LoadSaveInterface() {};
Jan Möbius's avatar
 
Jan Möbius committed
60 61 62 63 64 65 66 67
  
   signals :
      /** Tries to load the file as a given type
       * 
       * @param _filename Filename of the File to load
       * @param _type Type to be loaded 
       * @param _id Here the id of the loaded object is returned. id its -1 something went wrong
       */
Dirk Wilden's avatar
Dirk Wilden committed
68
      virtual void load(QString /*_filename*/, DataType /*_type*/, int& /*_id*/) {};
Jan Möbius's avatar
 
Jan Möbius committed
69 70 71 72 73 74
      
      /** Add an empty object of the given type
       * 
       * @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
75
      virtual void addEmptyObject( DataType /*_type*/, int& /*_id*/) {};
Jan Möbius's avatar
 
Jan Möbius committed
76 77 78 79 80 81
      
      /**
       * 
       * @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
82
      virtual void save(int /*_id*/ , QString /*_filename*/ ) {};
Jan Möbius's avatar
 
Jan Möbius committed
83 84 85 86
    
      /** \brief file has been opened
       * @param _id Id of the opened object
       */
Dirk Wilden's avatar
Dirk Wilden committed
87
      virtual void openedFile( int /*_id*/ ) {};
Jan Möbius's avatar
 
Jan Möbius committed
88 89 90
      
      /** \brief Emit this signal if an empty object has been created
       * @param _id Id of the added object
91
       */
Dirk Wilden's avatar
Dirk Wilden committed
92
      virtual void emptyObjectAdded( int /*_id*/ ) {};
Jan Möbius's avatar
 
Jan Möbius committed
93

94 95 96 97
     /** \brief get a list of all Filters
       *
       *  request a list of all Filters
       *
Jan Möbius's avatar
 
Jan Möbius committed
98
       *  @param _list StringList where the filters should be put into
99
       */
Dirk Wilden's avatar
Dirk Wilden committed
100
      virtual void getAllFilters( QStringList& /*_list*/ ) {};
101 102 103 104 105 106 107 108


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

Jan Möbius's avatar
 
Jan Möbius committed
109 110 111 112 113 114 115
  private slots :
  
    /**  \brief A file has been opened
     * 
     *  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
116
    virtual void fileOpened( int /*_id*/ ) {};
Dirk Wilden's avatar
Dirk Wilden committed
117 118 119 120 121 122 123 124

    /**  \brief An empty object has been added
     * 
     *  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*/ ) {};

125 126 127 128 129 130
    /** \brief An object was deleted
      *
      * @param _id Id of the object
      */
    virtual void objectDeleted( int /*_id*/ ){};

Jan Möbius's avatar
 
Jan Möbius committed
131 132 133 134 135
};

Q_DECLARE_INTERFACE(LoadSaveInterface,"OpenFlipper.LoadSaveInterface/1.0")
      
#endif // LOADSAVEINTERFACE_HH