www.mooseframework.org
JsonInputFileFormatter.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 JSONINPUTFILEFORMATTER_H
16 #define JSONINPUTFILEFORMATTER_H
17 
18 #include "json/json.h"
19 
26 {
27 public:
29 
34  std::string toString(const moosecontrib::Json::Value & root);
35 
36 protected:
44  void addLine(const std::string & line, size_t max_line_len = 0, const std::string & comment = "");
45 
52  void
53  addBlock(const std::string & name, const moosecontrib::Json::Value & block, bool top = false);
54 
59  void addParameters(const moosecontrib::Json::Value & params);
60 
66  void addTypes(const std::string & key, const moosecontrib::Json::Value & block);
67 
68  const int _spaces;
69  int _level;
70  std::ostringstream _stream;
71 };
72 
73 #endif /* JSONINPUTFILEFORMATTER_H */
std::string toString(const moosecontrib::Json::Value &root)
Returns a string representation of the tree in input file format.
This class produces produces a dump of the InputFileParameters that appears like the normal input fil...
void addLine(const std::string &line, size_t max_line_len=0, const std::string &comment="")
Adds a line to the output.
void addBlock(const std::string &name, const moosecontrib::Json::Value &block, bool top=false)
Adds a new block to the output.
void addParameters(const moosecontrib::Json::Value &params)
Add a comment to the block.
void addTypes(const std::string &key, const moosecontrib::Json::Value &block)
Add a dictionary of type blocks to the output.