www.mooseframework.org
YAMLFormatter.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 YAMLFORMATTER_H
16 #define YAMLFORMATTER_H
17 
18 #include "SyntaxTree.h"
19 #include <sstream>
20 #include <iterator>
21 
26 class YAMLFormatter : public SyntaxTree
27 {
28 public:
29  YAMLFormatter(bool dump_mode);
30 
31  virtual std::string preamble() const override;
32  virtual std::string postscript() const override;
33 
34  virtual std::string preTraverse(short depth) const override;
35  virtual std::string
36  printBlockOpen(const std::string & name, short depth, const std::string & doc) override;
37  virtual std::string printBlockClose(const std::string & name, short depth) const override;
38  virtual std::string printParams(const std::string & prefix,
39  const std::string & fully_qualified_name,
40  InputParameters & params,
41  short depth,
42  const std::string & search_string,
43  bool & found) override;
44 
45 protected:
46  bool _dump_mode;
47 
53  void buildOutputString(std::ostringstream & output,
54  const std::iterator_traits<InputParameters::iterator>::value_type & p);
55 };
56 
57 #endif /* YAMLFORMATTER_H */
virtual std::string printBlockClose(const std::string &name, short depth) const override
This method is called at the end of of each Node in the tree.
void buildOutputString(std::ostringstream &output, const std::iterator_traits< InputParameters::iterator >::value_type &p)
Method for building an output string that accounts for specific types (e.g., Point) ...
This class produces produces a yaml dump of the InputFileParameters that is machine parsable by any Y...
Definition: YAMLFormatter.h:26
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual std::string printBlockOpen(const std::string &name, short depth, const std::string &doc) override
This method is called at the beginning of each Node in the tree.
virtual std::string preTraverse(short depth) const override
This method is called once at each node in the syntax tree before traversing child nodes...
YAMLFormatter(bool dump_mode)
Definition: YAMLFormatter.C:26
virtual std::string preamble() const override
This method is called once at the beginning of the tree traversal and can be used to build up header ...
Definition: YAMLFormatter.C:29
virtual std::string printParams(const std::string &prefix, const std::string &fully_qualified_name, InputParameters &params, short depth, const std::string &search_string, bool &found) override
This function is called for each InputParameters object stored at a particular node.
Definition: YAMLFormatter.C:42
virtual std::string postscript() const override
This method is called once at the end of the tree traversal and can be used to add any necessary trai...
Definition: YAMLFormatter.C:36