00001 /*************************************************************************** 00002 ** 00003 ** This file is part of pointage. 00004 ** 00005 ** This file may be distributed and/or modified under the terms of the 00006 ** GNU General Public License version 2 or 3 as published by the Free 00007 ** Software Foundation and appearing in the file LICENSE.GPL included 00008 ** in the packaging of this file. 00009 ** 00010 ** This file is distributed in the hope that it will be useful, but WITHOUT 00011 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 ** more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 ** 00018 ** See http://www.geopsy.org for more information. 00019 ** 00020 ** Created: 2013-01-22 00021 ** Authors: 00022 ** Marc Wathelet (ISTerre, Grenoble, France) 00023 ** 00024 ***************************************************************************/ 00025 00026 #ifndef FILEREADER_H 00027 #define FILEREADER_H 00028 00029 #include <QGpCoreTools.h> 00030 00031 #include "RecordList.h" 00032 00033 class FileReader : public Thread 00034 { 00035 public: 00036 FileReader(); 00037 ~FileReader(); 00038 00039 const QString& fileName() const {return _fileName;} 00040 void setFileName(const QString& f) {_fileName=f;} 00041 00042 void setMode(Mode m) {_mode=m;} 00043 Mode mode() const {return _mode;} 00044 00045 void setSupplierEquivalences(const QString& fileName) {_suppliers=fileName;} 00046 00047 RecordList & list() {return _list;} 00048 00049 void terminate() {_terminate.setValue(true);} 00050 bool terminated() const {return _terminate.value();} 00051 bool ready() const {return _ready.value();} 00052 void setWarning(bool w) {_warning=w;} 00053 00054 void clear(); 00055 protected: 00056 virtual void run(); 00057 private: 00058 Mode _mode; 00059 QString _fileName, _suppliers; 00060 RecordList _list; 00061 bool _warning; 00062 AtomicBoolean _ready, _terminate; 00063 }; 00064 00065 #endif // FILEREADER_H 00066