]> Shamusworld >> Repos - architektonas/blob - src/base/filterinterface.cpp
Fixed thumbnail rendering in LibraryWidget and DXF detection.
[architektonas] / src / base / filterinterface.cpp
1 // filterinterface.cpp
2 //
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  05/05/2010  Moved implementation from header to this file. :-)
15 //
16
17 #include "filterinterface.h"
18
19 #include "debug.h"
20
21 /**
22  * Constructor.
23  */
24 RS_FilterInterface::RS_FilterInterface()
25 {
26         //std::cout << "RS_FilterInterface\n";
27         //graphic = NULL;
28 }
29
30 /**
31  * Destructor.
32  */
33 /*virtual*/ RS_FilterInterface::~RS_FilterInterface()
34 {
35 }
36
37 /**
38  * Checks if this filter can import the given file type.
39  *
40  * @retval true if the filter can import the file type
41  * @retval false otherwise.
42  */
43 /*virtual*/ bool RS_FilterInterface::canImport(RS2::FormatType t)
44 {
45 //      return !(importFormats.find(t) == importFormats.end());
46         return (importFormats.indexOf(t) != -1);
47 }
48
49 /**
50  * Checks if this filter can export the given file type.
51  *
52  * @return true if the filter can export the file type,
53  *         false otherwise.
54  */
55 /*virtual*/ bool RS_FilterInterface::canExport(RS2::FormatType t)
56 {
57 //      return !(exportFormats.find(t) == exportFormats.end());
58         return (exportFormats.indexOf(t) != -1);
59 }
60
61 /**
62  * Adds a file extension which can be imported by this filter.
63  */
64 void RS_FilterInterface::addImportFormat(RS2::FormatType type)
65 {
66         RS_DEBUG->print("Filter can import %d", (int)type);
67         importFormats += type;
68 }
69
70 /**
71  * Adds a file extension which can be exported by this filter.
72  */
73 void RS_FilterInterface::addExportFormat(RS2::FormatType type)
74 {
75         RS_DEBUG->print("Filter can export %d", (int)type);
76         exportFormats += type;
77 }