]> Shamusworld >> Repos - architektonas/blob - src/base/filterdxf1.h
Fixed problem with MDI activation.
[architektonas] / src / base / filterdxf1.h
1 #ifndef __FILTERDXF1_H__
2 #define __FILTERDXF1_H__
3
4 #include <fstream>
5
6 #include "filterinterface.h"
7 //#include "file.h"
8
9 /**
10  * This format filter class can import and export old DXF files
11  * from QCad 1.x.
12  *
13  * This is legacy code from QCad 1.x.
14  *
15  * @author Andrew Mustun
16  */
17 class FilterDXF1 : public FilterInterface
18 {
19 public:
20     FilterDXF1();
21     ~FilterDXF1() {}
22
23         /**
24          * @return RS2::FormatDXF1.
25          */
26         //RS2::FormatType rtti() {
27         //      return RS2::FormatDXF1;
28         //}
29
30         /*
31     virtual bool canImport(RS2::FormatType t) {
32                 return (t==RS2::FormatDXF1);
33         }
34
35     virtual bool canExport(RS2::FormatType t) {
36                 return false;
37         }*/
38
39     virtual bool fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/);
40
41     virtual bool fileExport(Drawing& /*g*/, const QString& /*file*/,
42                 RS2::FormatType /*type*/) {
43         DEBUG->print(Debug::D_WARNING,
44                         "Exporting of QCad 1.x file not implemented");
45                 return false;
46     }
47
48     bool readFromBuffer();
49
50     void    reset();
51     void    resetBufP();
52
53     void    setBufP(int _fBufP);
54     int     getBufP() {
55         return fBufP;
56     }
57     void    delBuffer();
58     void    dos2unix();
59
60     QString getBufLine();
61     char*   getBufLineCh();
62     char*   getBuf() {
63         return fBuf;
64     }
65     void    setBuf(char* _buf) {
66         fBuf=_buf;
67     }
68     void    setFSize(uint _s) {
69         fSize=_s;
70     }
71     void    copyBufFrom(const char* _buf);
72     bool    gotoBufLine(char* _lstr);
73     bool    gotoBufLineString(char* _lstr);
74
75     void    replaceBinaryBytesBy(char _c);
76     void    separateBuf(char _c1=13,
77                         char _c2=10,
78                         char _c3=0,
79                         char _c4=0);
80     void    removeComment(char _fc='(',
81                           char _lc=')');
82
83     bool    readFileInBuffer(char* _name, int _bNum=-1);
84     bool    readFileInBuffer(int _bNum=-1);
85
86     void     strDecodeDxfString(QString& str);
87     bool     mtCompFloat(double _v1, double _v2, double _tol=1.0e-6);
88
89 protected:
90     /** Pointer to the graphic we currently operate on. */
91     Drawing* graphic;
92     FILE*   fPointer;         // File pointer
93     char*   fBuf;             // Filebuffer
94     int     fBufP;            // Filebuffer-Pointer (walks through 'fBuf')
95     uint    fSize;            // Filesize
96     bool    dosFile;          // File is in DOS-format
97     int       numElements;
98     QString name;
99     QFile  file;
100 }
101 ;
102
103 #endif