Class for parsing input files. More...
#include <Parser.h>
Public Member Functions | |
Parser (const std::vector< std::string > &input_filenames, const std::optional< std::vector< std::string >> &input_text={}) | |
Constructor given a list of input files, given in input_filenames . More... | |
Parser (const std::string &input_filename, const std::optional< std::string > &input_text={}) | |
Constructor, given a file in input_filename . More... | |
void | parse () |
Parses the inputs. More... | |
void | extractParams (const std::string &prefix, InputParameters &p) |
This function attempts to extract values from the input file based on the contents of the passed parameters objects. More... | |
hit::Node * | root () |
const std::vector< std::string > & | getInputFileNames () const |
const std::string & | getAppType () const |
void | setAppType (const std::string &app_type) |
const std::string & | getLastInputFileName () const |
std::filesystem::path | getLastInputFilePath () const |
Private Attributes | |
std::unique_ptr< hit::Node > | _root |
The root node, which owns the whole tree. More... | |
const std::vector< std::string > | _input_filenames |
The input file names. More... | |
const std::optional< std::vector< std::string > > | _input_text |
The optional input text contents (to support not reading by file) More... | |
std::string | _app_type |
The application types extracted from [Application] block. More... | |
Class for parsing input files.
This class utilizes the GetPot library for actually tokenizing and parsing files. It is not currently designed for extensibility. If you wish to build your own parser, please contact the MOOSE team for guidance.
Parser::Parser | ( | const std::vector< std::string > & | input_filenames, |
const std::optional< std::vector< std::string >> & | input_text = {} |
||
) |
Constructor given a list of input files, given in input_filenames
.
Optionally, the file contents can be provided via text in input_text
.
Definition at line 154 of file Parser.C.
Parser::Parser | ( | const std::string & | input_filename, |
const std::optional< std::string > & | input_text = {} |
||
) |
Constructor, given a file in input_filename
.
Optionally, the file contents can be provided via text in input_text
.
Definition at line 163 of file Parser.C.
void Parser::extractParams | ( | const std::string & | prefix, |
InputParameters & | p | ||
) |
This function attempts to extract values from the input file based on the contents of the passed parameters objects.
It handles a number of various types with dynamic casting including vector types
|
inline |
Definition at line 156 of file Parser.h.
|
inline |
Definition at line 151 of file Parser.h.
Referenced by parse().
const std::string & Parser::getLastInputFileName | ( | ) | const |
Definition at line 284 of file Parser.C.
Referenced by getLastInputFilePath().
|
inline |
Definition at line 171 of file Parser.h.
void Parser::parse | ( | ) |
Parses the inputs.
Definition at line 292 of file Parser.C.
|
inline |
If this is null, it means that we haven't parsed yet
Definition at line 146 of file Parser.h.
Referenced by ActionFactory::create(), and parse().
|
inline |
Definition at line 161 of file Parser.h.
|
private |
The application types extracted from [Application] block.
Definition at line 184 of file Parser.h.
Referenced by getAppType(), parse(), and setAppType().
|
private |
The input file names.
Definition at line 178 of file Parser.h.
Referenced by getInputFileNames(), and getLastInputFileName().
|
private |
|
private |