]> Shamusworld >> Repos - architektonas/blob - src/base/rs_filterinterface.cpp
0b6c9b465492376bc17837946c5e2c8db2c7d29e
[architektonas] / src / base / rs_filterinterface.cpp
1 // rs_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 // (C) 2010 Underground Software
7 //
8 // JLH = James L. Hammons <jlhamm@acm.org>
9 //
10 // Who  When        What
11 // ---  ----------  -----------------------------------------------------------
12 // JLH  05/05/2010  Moved implementation from header to this file. :-)
13 //
14
15 #include "rs_filterinterface.h"
16
17 #include "rs_debug.h"
18
19 /**
20  * Constructor.
21  */
22 RS_FilterInterface::RS_FilterInterface()
23 {
24         //std::cout << "RS_FilterInterface\n";
25         //graphic = NULL;
26 }
27
28 /**
29  * Destructor.
30  */
31 /*virtual*/ RS_FilterInterface::~RS_FilterInterface()
32 {
33 }
34
35 /**
36  * Checks if this filter can import the given file type.
37  *
38  * @retval true if the filter can import the file type
39  * @retval false otherwise.
40  */
41 /*virtual*/ bool RS_FilterInterface::canImport(RS2::FormatType t)
42 {
43 //      return !(importFormats.find(t) == importFormats.end());
44         return (importFormats.indexOf(t) != -1);
45 }
46
47 /**
48  * Checks if this filter can export the given file type.
49  *
50  * @return true if the filter can export the file type,
51  *         false otherwise.
52  */
53 /*virtual*/ bool RS_FilterInterface::canExport(RS2::FormatType t)
54 {
55 //      return !(exportFormats.find(t) == exportFormats.end());
56         return (exportFormats.indexOf(t) != -1);
57 }
58
59 /**
60  * Adds a file extension which can be imported by this filter.
61  */
62 void RS_FilterInterface::addImportFormat(RS2::FormatType type)
63 {
64         RS_DEBUG->print("Filter can import %d", (int)type);
65         importFormats += type;
66 }
67
68 /**
69  * Adds a file extension which can be exported by this filter.
70  */
71 void RS_FilterInterface::addExportFormat(RS2::FormatType type)
72 {
73         RS_DEBUG->print("Filter can export %d", (int)type);
74         exportFormats += type;
75 }