www.mooseframework.org
JsonSyntaxTree.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef JSONSYNTAXTREE_H
16 #define JSONSYNTAXTREE_H
17 
18 #include "InputParameters.h"
19 #include "FileLineInfo.h"
20 #include "json/json.h"
21 #include <string>
22 #include <vector>
23 
28 {
29 public:
30  JsonSyntaxTree(const std::string & search_string);
31  virtual ~JsonSyntaxTree() {}
32 
44  bool addParameters(const std::string & parent_path,
45  const std::string & path,
46  bool is_type,
47  const std::string & action,
48  bool is_action,
49  InputParameters * params,
50  const FileLineInfo & lineinfo,
51  const std::string & classname);
52 
60  void addActionTask(const std::string & path,
61  const std::string & action,
62  const std::string & task,
63  const FileLineInfo & lineinfo);
68  const moosecontrib::Json::Value & getRoot() const { return _root; }
69 
75  void addSyntaxType(const std::string & path, const std::string type);
76 
80  void addGlobal();
81 
82 protected:
83  std::string buildOptions(const std::iterator_traits<InputParameters::iterator>::value_type & p,
84  bool & out_of_range_allowed);
85 
86  std::string prettyCppType(const std::string & cpp_type);
87  std::string basicCppType(const std::string & cpp_type);
88  size_t
89  setParams(InputParameters * params, bool search_match, moosecontrib::Json::Value & all_params);
90 
91  std::string
92  buildOutputString(const std::iterator_traits<InputParameters::iterator>::value_type & p);
93  static std::vector<std::string> splitPath(const std::string & path);
94  moosecontrib::Json::Value &
95  getJson(const std::string & parent, const std::string & path, bool is_type);
96  moosecontrib::Json::Value & getJson(const std::string & path);
97  moosecontrib::Json::Value _root;
98  std::string _search;
99 };
100 
101 #endif // JSONSYNTAXTREE_H
void addSyntaxType(const std::string &path, const std::string type)
Add an associated type to a block.
const moosecontrib::Json::Value & getRoot() const
Get the root of the tree.
void addActionTask(const std::string &path, const std::string &action, const std::string &task, const FileLineInfo &lineinfo)
Add a task to the tree.
size_t setParams(InputParameters *params, bool search_match, moosecontrib::Json::Value &all_params)
static std::vector< std::string > splitPath(const std::string &path)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::string buildOptions(const std::iterator_traits< InputParameters::iterator >::value_type &p, bool &out_of_range_allowed)
std::string prettyCppType(const std::string &cpp_type)
Holds the syntax in a Json::Value tree.
std::string buildOutputString(const std::iterator_traits< InputParameters::iterator >::value_type &p)
JsonSyntaxTree(const std::string &search_string)
moosecontrib::Json::Value _root
bool addParameters(const std::string &parent_path, const std::string &path, bool is_type, const std::string &action, bool is_action, InputParameters *params, const FileLineInfo &lineinfo, const std::string &classname)
Add parameters to the tree.
std::string basicCppType(const std::string &cpp_type)
Holds file and line information.
Definition: FileLineInfo.h:24
virtual ~JsonSyntaxTree()
MatType type
std::string _search
void addGlobal()
Add the global section to the output.
moosecontrib::Json::Value & getJson(const std::string &parent, const std::string &path, bool is_type)