laura is hosted by Hepforge, IPPP Durham
Laura++  v2r1
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauTextFileParser.hh
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2008 - 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
21 #ifndef LAU_TEXT_FILE_PARSER_HH
22 #define LAU_TEXT_FILE_PARSER_HH
23 
24 #include "TString.h"
25 
26 #include <iostream>
27 #include <string>
28 #include <sstream>
29 #include <vector>
30 #include <map>
31 
33 
34  public:
36 
39  LauTextFileParser(const char* s);
40 
42 
45  LauTextFileParser(const std::string& s);
46 
48 
51  LauTextFileParser(const TString& s);
52 
54  virtual ~LauTextFileParser();
55 
57  void processFile();
58 
60 
64  std::vector<std::string> getLine(int lineNo);
65 
67 
70  std::vector<std::string> getNextLine();
71 
73 
76  void resetLineNumber(int lineNo) {lineNumber_ = lineNo;}
77 
78  protected:
79 
80  private:
82  typedef std::map<int, std::vector<std::string> > LineMap;
83 
85  std::string theFile_;
86 
89 
92 
95 
96 };
97 
98 #endif
Class for parsing text files.
virtual ~LauTextFileParser()
Destructor.
std::vector< std::string > getNextLine()
Retrieve the next line.
std::map< int, std::vector< std::string > > LineMap
The type used to contain the parsed text.
int lineNumber_
The current line number.
void resetLineNumber(int lineNo)
Set the line number.
LineMap lineMap_
The parsed text.
std::vector< std::string > getLine(int lineNo)
Retrieve the specified line.
std::string theFile_
The name of the file.
LauTextFileParser(const char *s)
Constructor.
int totalLines_
The total number of lines in the file.
void processFile()
Parse the file.