This class produces produces a dump of the InputParameters that appears like the normal input file syntax. More...
#include <JsonInputFileFormatter.h>
Public Member Functions | |
JsonInputFileFormatter () | |
std::string | toString (const nlohmann::json &root) |
Returns a string representation of the tree in input file format. More... | |
Protected Member Functions | |
void | addLine (const std::string &line, size_t max_line_len=0, const std::string &comment="") |
Adds a line to the output. More... | |
void | addBlock (const std::string &name, const nlohmann::json &block, bool top=false) |
Adds a new block to the output. More... | |
void | addParameters (const nlohmann::json ¶ms) |
Add a comment to the block. More... | |
void | addTypes (const std::string &key, const nlohmann::json &block) |
Add a dictionary of type blocks to the output. More... | |
Protected Attributes | |
const int | _spaces |
int | _level |
std::ostringstream | _stream |
This class produces produces a dump of the InputParameters that appears like the normal input file syntax.
It is different from InputFileFormatter in that it takes its input from JsonSyntaxTree.
Definition at line 19 of file JsonInputFileFormatter.h.
JsonInputFileFormatter::JsonInputFileFormatter | ( | ) |
Definition at line 15 of file JsonInputFileFormatter.C.
|
protected |
Adds a new block to the output.
name | Name of the block. |
block | Json holding data for the block. |
top | Whether this is a top level block. |
Definition at line 72 of file JsonInputFileFormatter.C.
Referenced by addTypes(), and toString().
|
protected |
Adds a line to the output.
This will put in the proper indentation automatically.
line | The line to add. |
max_line_len | Used to determine where to start inline comments. comment Comment to add to the line. It will automatically be broken up over multiple lines if too long. |
Definition at line 28 of file JsonInputFileFormatter.C.
Referenced by addBlock(), addParameters(), and addTypes().
|
protected |
Add a comment to the block.
It will add the proper indentation and #.
comment | The comment to add. |
Definition at line 144 of file JsonInputFileFormatter.C.
Referenced by addBlock().
|
protected |
Add a dictionary of type blocks to the output.
key | This will be used to get the dictionary of types from block. |
block | The Json data that is the parent of the types data. |
Definition at line 126 of file JsonInputFileFormatter.C.
Referenced by addBlock().
std::string JsonInputFileFormatter::toString | ( | const nlohmann::json & | root | ) |
Returns a string representation of the tree in input file format.
root | The root node of the tree to output. |
Definition at line 18 of file JsonInputFileFormatter.C.
Referenced by MooseApp::setupOptions().
|
protected |
Definition at line 62 of file JsonInputFileFormatter.h.
Referenced by addBlock(), addLine(), and addTypes().
|
protected |
Definition at line 61 of file JsonInputFileFormatter.h.
Referenced by addLine().
|
protected |
Definition at line 63 of file JsonInputFileFormatter.h.
Referenced by addLine(), and toString().