FileInterface Class Reference

Interface class for file and object handling. More...

#include <OpenFlipper/BasePlugin/FileInterface.hh>

List of all members.

Public Slots

Load Save Implementation

virtual int addEmpty ()
 Create an empty object.
virtual int loadObject (QString)=0
 Load an object from the given file.
virtual int loadObject (QString, DataType)
 Load an object from the given file.
virtual bool saveObject (int, QString)=0
 Save an object from the given file.
virtual bool saveObjects (IdList, QString)
 Save multiple objects to one file.

Public Member Functions

Widgets

virtual ~FileInterface ()
 Destructor.
virtual QWidget * saveOptionsWidget (QString)=0
virtual QWidget * loadOptionsWidget (QString)=0
Supported types

virtual DataType supportedType ()=0
 Return your supported object type( e.g. DATA_TRIANGLE_MESH ).
virtual QString getLoadFilters ()=0
virtual QString getSaveFilters ()=0

Detailed Description

Interface class for file and object handling.

This interface class has to be fully implemented. When you want to support save and load for an object type you have to implement all functions in this class. The core manages the load and save interaction and gives the load and save actions to your plugin. The decision which plugin is called for saving an object depends on your supportedTypes() and the filters defined by your plugin.

Definition at line 70 of file FileInterface.hh.


Member Function Documentation

virtual int FileInterface::addEmpty (  )  [inline, virtual, slot]

Create an empty object.

When this slot is called you have to create an object of your supported type.

Returns:
Id of the new Object
Todo:
Add an addEmpty function with a given type as an attribute. The plugin should then create only an empty object of the given type. It can be assumed that there is only one type given at a time.

Definition at line 143 of file FileInterface.hh.

virtual QString FileInterface::getLoadFilters (  )  [pure virtual]

Return the Qt Filters for Filedialogs when loading files (e.g. "Off files ( *.off )" )

Referenced by Core::loadPlugin().

virtual QString FileInterface::getSaveFilters (  )  [pure virtual]

Get the Qt Filters for Filedialogs when saving files (e.g. "Off files ( *.off )" )

Referenced by Core::loadPlugin().

virtual int FileInterface::loadObject ( QString  ,
DataType   
) [inline, virtual, slot]

Load an object from the given file.

The Core will call this slot if you should load a file. The core will check if you support the given file type depending on the provided filters and dataTypes ( see supportedType and getLoadFilters )

if you just opened a file and did not create any object, return 0 here, telling the core that it was successfully loaded but no new object has been created!

If the Plugin is able to open the file in different DataTypes one of these DataTypes can be forced here

Definition at line 171 of file FileInterface.hh.

virtual int FileInterface::loadObject ( QString   )  [pure virtual, slot]

Load an object from the given file.

The Core will call this slot if you should load a file. The core will check if you support the given file type depending on the provided filters and dataTypes ( see supportedType and getLoadFilters )

if you just opened a file and did not create any object, return 0 here, telling the core that it was successfully loaded but no new object has been created!

virtual QWidget* FileInterface::loadOptionsWidget ( QString   )  [pure virtual]

You can provide a special widget showing options for loading your file types depending on the current filter

_currentFilter: one filter from loadFilters

Return 0 when you dont need one

virtual bool FileInterface::saveObject ( int  ,
QString   
) [pure virtual, slot]

Save an object from the given file.

The Core will call this slot if you should save an object to a file. The core will check if you support the given object depending on the provided dataTypes ( see supportedType ). Additionally to the filename you get the id of the object to save

virtual bool FileInterface::saveObjects ( IdList  ,
QString   
) [inline, virtual, slot]

Save multiple objects to one file.

The Core will call this slot if the user wants to save multiple files in one file. The core will check if you support the given object depending on the provided dataTypes ( see supportedType ). Additionally to the filename you get ids of the objects to save

Definition at line 189 of file FileInterface.hh.

virtual QWidget* FileInterface::saveOptionsWidget ( QString   )  [pure virtual]

You can provide a special widget showing options for saving your file types depending on the current filter

_currentFilter: one filter from saveFilters

Return 0 when you dont need one

virtual DataType FileInterface::supportedType (  )  [pure virtual]

Return your supported object type( e.g. DATA_TRIANGLE_MESH ).

If you support multiple datatypes you can use the bitwise or to combine them here. The function is used from addEmpty to check if your plugin can create an object of a given dataType.

Referenced by Core::loadPlugin().


The documentation for this class was generated from the following file:
Generated on Wed Jun 23 11:35:59 2010 for DeveloperDocumentation by  doxygen 1.6.3