dune-common  2.4.1
parametertreeparser.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_PARAMETER_PARSER_HH
4 #define DUNE_PARAMETER_PARSER_HH
5 
10 #include <istream>
11 #include <string>
12 #include <vector>
13 
16 
17 namespace Dune {
18 
26  class HelpRequest : public Exception {};
27 
33  {
34 
35  static std::string ltrim(const std::string& s);
36  static std::string rtrim(const std::string& s);
37 
38  public:
39 
83 
98  static void readINITree(std::istream& in, ParameterTree& pt,
99  bool overwrite);
100 
101 
114  static void readINITree(std::istream& in, ParameterTree& pt,
115  const std::string srcname = "stream",
116  bool overwrite = true);
117 
118 
129  static void readINITree(std::string file, ParameterTree& pt, bool overwrite = true);
130 
132 
144  static void readOptions(int argc, char* argv [], ParameterTree& pt);
145 
163  static void readNamedOptions(int argc, char* argv[],
164  ParameterTree& pt,
165  std::vector<std::string> keywords,
166  unsigned int required = std::numeric_limits<unsigned int>::max(),
167  bool allow_more = true,
168  bool overwrite = true,
169  std::vector<std::string> help = std::vector<std::string>());
170 
171  private:
172  static std::string generateHelpString(std::string progname, std::vector<std::string> keywords, unsigned int required, std::vector<std::string> help);
173  };
174 
175 } // end namespace Dune
176 
177 #endif // DUNE_PARAMETER_PARSER_HH
A hierarchical structure of string parameters.
Base class for Dune-Exceptions.
Definition: exceptions.hh:91
Parsers to set up a ParameterTree from various input sources.
Definition: parametertreeparser.hh:32
A few common exception classes.
report parser error while reading ParameterTree
Definition: parametertreeparser.hh:20
Hierarchical structure of string parameters.
Definition: parametertree.hh:34
Default exception class for range errors.
Definition: exceptions.hh:279
Dune namespace.
Definition: alignment.hh:9
exception thrown if the user wants to see help string
Definition: parametertreeparser.hh:26