https://mooseframework.inl.gov
Loading...
Searching...
No Matches
JsonInputFileFormatter.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include <sstream>
13#include "nlohmann/json.h"
14
21{
22public:
24
29 std::string toString(const nlohmann::json & root);
30
31protected:
39 void addLine(const std::string & line, size_t max_line_len = 0, const std::string & comment = "");
40
47 void addBlock(const std::string & name, const nlohmann::json & block, bool top = false);
48
53 void addParameters(const nlohmann::json & params);
54
60 void addTypes(const std::string & key, const nlohmann::json & block);
61
62 const int _spaces;
63 int _level;
64 std::ostringstream _stream;
65};
This class produces produces a dump of the InputParameters that appears like the normal input file sy...
std::string toString(const nlohmann::json &root)
Returns a string representation of the tree in input file format.
void addParameters(const nlohmann::json &params)
Add a comment to the block.
void addBlock(const std::string &name, const nlohmann::json &block, bool top=false)
Adds a new block to the output.
void addLine(const std::string &line, size_t max_line_len=0, const std::string &comment="")
Adds a line to the output.
void addTypes(const std::string &key, const nlohmann::json &block)
Add a dictionary of type blocks to the output.