MINT2
ParsedParameterLine.h
Go to the documentation of this file.
1 #ifndef PARSED_PARAMETER_LINE_HH
2 #define PARSED_PARAMETER_LINE_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:17:56 GMT
5 
6 #include <string>
7 #include <iostream>
8 #include <vector>
9 // note: valide parameter names start with a letter (isalpha())
10 
11 namespace MINT{
12 
14  // mainly for string handling.
15  protected:
16  static const std::string _commentStart;
17  static const std::string _testString;
18  static const std::string _testName;
19 
20  std::string _name;
21  std::vector<std::string> _parsedStrings;
22 
23 
24  static int makeParsedStrings(const std::string& line
25  , std::vector<std::string>& fillThisList);
26 
27  virtual bool makeParsedStrings(const std::string& line);
28 
29  public:
30  static bool isBlank(char c);
31  static std::string removeLeadingBlanks(const std::string& s);
32  static std::string removeTrailingBlanks(const std::string& s);
33  static std::string removeLeadingAndTrailingBlanks(const std::string& s);
34  static std::string removeComment(const std::string& line);
35  static std::string removeCommentAndLeadingBlanks(const std::string& line);
36 
37  ParsedParameterLine(const std::string& line=""){
38  makeParsedStrings(line);
39  if(_parsedStrings.empty()){
40  _parsedStrings.push_back("");
41  }
42  }
44  : _name(other._name)
46  {}
47 
48  virtual ~ParsedParameterLine(){};
49 
50  bool isValid() const;
51 
52  virtual const std::string& name() const{
53  return _parsedStrings[0];
54  }
55  const std::vector<std::string>& parsedStrings() const{
56  return _parsedStrings;
57  }
58 
59  virtual void print(std::ostream& os = std::cout) const;
60  virtual void stringParsingTest(std::ostream& os=std::cout) const;
61 };
62 }//namespace MINT
63 std::ostream& operator<<(std::ostream& os, const MINT::ParsedParameterLine& ppl);
64 
65 #endif
66 //
static std::string removeCommentAndLeadingBlanks(const std::string &line)
std::vector< std::string > _parsedStrings
static std::string removeComment(const std::string &line)
static int makeParsedStrings(const std::string &line, std::vector< std::string > &fillThisList)
virtual const std::string & name() const
static const double s
const std::vector< std::string > & parsedStrings() const
static std::string removeLeadingAndTrailingBlanks(const std::string &s)
ParsedParameterLine(const std::string &line="")
static std::string removeTrailingBlanks(const std::string &s)
static std::string removeLeadingBlanks(const std::string &s)
static const std::string _testName
std::ostream & operator<<(std::ostream &os, const MINT::ParsedParameterLine &ppl)
static const std::string _commentStart
virtual void stringParsingTest(std::ostream &os=std::cout) const
ParsedParameterLine(const ParsedParameterLine &other)
virtual void print(std::ostream &os=std::cout) const
static const std::string _testString