]> Shamusworld >> Repos - architektonas/blob - src/base/rs_fileio.h
5359df3faa08e42fc313c415f70681028677e127
[architektonas] / src / base / rs_fileio.h
1 #ifndef RS_FILEIO_H
2 #define RS_FILEIO_H
3
4 #include <QtCore>
5 #include "rs.h"
6
7 #define RS_FILEIO RS_FileIO::instance()
8
9 class Drawing;
10 class RS_FilterInterface;
11
12 /**
13  * API Class for importing files.
14  *
15  * @author Andrew Mustun
16  */
17 class RS_FileIO
18 {
19         protected:
20                 RS_FileIO();
21
22         public:
23                 static RS_FileIO * instance();
24                 void registerFilter(RS_FilterInterface * f);
25                 QList<RS_FilterInterface *> getFilterList();
26                 RS_FilterInterface * getImportFilter(RS2::FormatType t);
27                 RS_FilterInterface * getExportFilter(RS2::FormatType t);
28
29                 bool fileImport(Drawing & graphic, const QString & file,
30                         RS2::FormatType type = RS2::FormatUnknown);
31
32                 bool fileExport(Drawing & graphic, const QString & file,
33                         RS2::FormatType type = RS2::FormatUnknown);
34
35                 RS2::FormatType detectFormat(const QString & file);
36
37         protected:
38                 static RS_FileIO * uniqueInstance;
39                 QList<RS_FilterInterface *> filterList;
40 };
41
42 #endif