All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ProgressiveColumnFileReader.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 
33 /**
34  \file ProgressiveColumnFileReader.hpp
35  \brief Header of ...
36 
37  \author Jean-Christophe FABRE <fabrejc@supagro.inra.fr>
38  */
39 
40 
41 #ifndef __PROGRESSIVECOLUMNFILEREADER_HPP__
42 #define __PROGRESSIVECOLUMNFILEREADER_HPP__
43 
44 
45 #include <fstream>
46 #include <vector>
47 
48 #include <openfluid/dllexport.hpp>
49 
50 
51 namespace openfluid { namespace tools {
52 
53 /**
54  Progressive reader for column text files
55 */
57 {
58  private:
59 
60  std::ifstream m_File;
61 
62  std::string m_ColSeparators;
63 
64 
65  protected:
66 
67  std::string m_FileName;
68 
69 
70  public:
71 
72  /**
73  Constructor
74  @param[in] FileName the file to open
75  @param[in] ColSeparators a list of columns separators. Default value is " \t\r\n"
76  */
77  ProgressiveColumnFileReader(const std::string& FileName,
78  const std::string& ColSeparators = " \t\r\n");
79 
81  { };
82 
83  /**
84  Gets the next line of data in the file, as a single string
85  @param[out] Line the read line
86  @return true if the next line has been read, false otherwise
87  */
88  bool getNextLine(std::string& Line);
89 
90  /**
91  Gets the next line of data in the file, as a vector of strings
92  @param[out] Values the vector of read values
93  @return true if the next line has been read and splitted into a vector of strings,
94  false otherwise
95  */
96  bool getNextLine(std::vector<std::string>& Values);
97 
98  /**
99  Resets the internal iterator of the file
100  */
101  void reset();
102 
103  /**
104  Returns the file name
105  @return the file name
106  */
107  std::string getFileName() const { return m_FileName; };
108 
109 };
110 
111 
112 } } // namespaces
113 
114 
115 #endif /* __PROGRESSIVECOLUMNFILEREADER_HPP__ */
virtual ~ProgressiveColumnFileReader()
Definition: ProgressiveColumnFileReader.hpp:80
Definition: ProgressiveColumnFileReader.hpp:56
std::string getFileName() const
Definition: ProgressiveColumnFileReader.hpp:107
std::string m_FileName
Definition: ProgressiveColumnFileReader.hpp:67
#define DLLEXPORT
Definition: dllexport.hpp:51