simplified
[engrid-github.git] / src / libengrid / iooperation.h
blob1d65f9be36f797eb3ee60198c6798a0e668d7f6d
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008-2013 enGits GmbH +
7 // + +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
12 // + +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
17 // + +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 //
23 #ifndef iooperation_H
24 #define iooperation_H
26 class IOOperation;
28 #include "operation.h"
29 // #include "guimainwindow.h"
31 #include <QString>
32 #include <QFile>
33 #include <QTextStream>
34 #include <QFileInfo>
36 #include <vtkLongArray.h>
37 #include <vtkIntArray.h>
38 #include <vtkDoubleArray.h>
39 #include <vtkPointData.h>
40 #include <vtkCellData.h>
42 #include <vector>
44 class IOOperation : public Operation
47 private: // attributes
49 bool m_Valid; ///< flag to determine if a valid file has been selected
50 QString m_FileName; ///< file name to read -- normally set by inputReadFileName()
51 char m_FileName_cc[1024]; ///< "const char *" copy version of file name to read -- only used by getCFileName()
52 QString m_FormatTxt; ///< file format string (e.g. *.stl, *.vtu, ...)
53 QString m_ExtensionTxt; ///< file extension for write operations
54 bool m_FileNameSet; ///< has the file name been set already (batch operation)?
56 protected: // methods
58 /**
59 * Set the file format string for this Reader.
60 * @param format the file name extension (e.g. *.stl, *.vtu, ...)
62 void setFormat(QString format);
64 /**
65 * Set the file extension string for write operations.
66 * @param extension the file name extension (e.g. *.stl, *.vtu, ...)
68 void setExtension(QString format);
70 /**
71 * Get a standard C string representing the file name.
72 * @return the file name
74 const char* getCFileName();
76 /**
77 * Get the file name.
78 * @return the file name (as QString)
80 QString getFileName();
82 /**
83 * Access to the valid flag (true if a valid file name has been selected)
84 * @return the valid flag
86 bool isValid();
88 public: // methods
90 IOOperation();
91 virtual ~IOOperation() {}
93 void readInputFileName(QString default_filename, bool reset = true); ///< Open a QFileDialog and make the user input a file name for opening or importing.
94 void readOutputFileName(QString default_filename); ///< Open a QFileDialog and make the user input a file name for saving or exporting.
95 void readOutputDirectory(); ///< Open a QFileDialog and make the user input a directory name for exporting.
96 void readInputDirectory(QString title_txt = "select input directory"); ///< Open a QFileDialog and make the user input a directory name for importing.
97 void setFileName(QString file_name); ///< set the file name for batch operation
101 #endif