LoadSaveInterface.hh 4.29 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
//=============================================================================
//
//                               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.
15
//
Jan Möbius's avatar
 
Jan Möbius committed
16
17
18
19
//  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.
20
//
Jan Möbius's avatar
 
Jan Möbius committed
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//  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
//
38
// Description:
Jan Möbius's avatar
 
Jan Möbius committed
39
40
41
42
43
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//

44
45
#ifndef LOADSAVEINTERFACE_HH
#define LOADSAVEINTERFACE_HH
Jan Möbius's avatar
 
Jan Möbius committed
46
47
48
49

#include <OpenFlipper/common/Types.hh>

/** \brief Interface for all plugins which want to load or save files
50
  *
Jan Möbius's avatar
 
Jan Möbius committed
51
  * Using this interface you can instruct the core to open/save objects or
52
53
  * create new empty objects.
 */
Jan Möbius's avatar
 
Jan Möbius committed
54
class LoadSaveInterface {
55
56

   public:
57

58
59
      /// Destructor
      virtual ~LoadSaveInterface() {};
60

Jan Möbius's avatar
 
Jan Möbius committed
61
62
   signals :
      /** Tries to load the file as a given type
63
       *
Jan Möbius's avatar
 
Jan Möbius committed
64
       * @param _filename Filename of the File to load
65
       * @param _type Type to be loaded
Jan Möbius's avatar
 
Jan Möbius committed
66
67
       * @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*/) {};
69

Jan Möbius's avatar
 
Jan Möbius committed
70
      /** Add an empty object of the given type
71
       *
Jan Möbius's avatar
 
Jan Möbius committed
72
73
74
       * @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*/) {};
76

77
78
79
80
81
82
83
      /** 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*/) {};

Jan Möbius's avatar
 
Jan Möbius committed
84
      /**
85
       *
Jan Möbius's avatar
 
Jan Möbius committed
86
87
88
       * @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
89
      virtual void save(int /*_id*/ , QString /*_filename*/ ) {};
90

Jan Möbius's avatar
 
Jan Möbius committed
91
92
93
      /** \brief file has been opened
       * @param _id Id of the opened object
       */
Dirk Wilden's avatar
Dirk Wilden committed
94
      virtual void openedFile( int /*_id*/ ) {};
95

Jan Möbius's avatar
 
Jan Möbius committed
96
97
      /** \brief Emit this signal if an empty object has been created
       * @param _id Id of the added object
98
       */
Dirk Wilden's avatar
Dirk Wilden committed
99
      virtual void emptyObjectAdded( int /*_id*/ ) {};
Jan Möbius's avatar
 
Jan Möbius committed
100

101
102
103
104
     /** \brief get a list of all Filters
       *
       *  request a list of all Filters
       *
Jan Möbius's avatar
 
Jan Möbius committed
105
       *  @param _list StringList where the filters should be put into
106
       */
Dirk Wilden's avatar
Dirk Wilden committed
107
      virtual void getAllFilters( QStringList& /*_list*/ ) {};
108
109
110
111
112
113
114
115


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

116
117
118
119
120
      /** \brief Delete all Objects
       *
       */
      virtual void deleteAllObjects(){};

Jan Möbius's avatar
 
Jan Möbius committed
121
  private slots :
122

Jan Möbius's avatar
 
Jan Möbius committed
123
    /**  \brief A file has been opened
124
     *
Jan Möbius's avatar
 
Jan Möbius committed
125
126
127
     *  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
128
    virtual void fileOpened( int /*_id*/ ) {};
Dirk Wilden's avatar
Dirk Wilden committed
129
130

    /**  \brief An empty object has been added
131
     *
Dirk Wilden's avatar
Dirk Wilden committed
132
133
134
135
136
     *  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*/ ) {};

137
138
139
140
141
142
    /** \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
143
144
145
};

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

Jan Möbius's avatar
 
Jan Möbius committed
147
#endif // LOADSAVEINTERFACE_HH