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 155 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 164 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 144 of file Parser.h.
|
inline |
Definition at line 139 of file Parser.h.
Referenced by parse().
const std::string & Parser::getLastInputFileName | ( | ) | const |
Definition at line 291 of file Parser.C.
Referenced by getLastInputFilePath().
|
inline |
Definition at line 159 of file Parser.h.
void Parser::parse | ( | ) |
Parses the inputs.
Definition at line 299 of file Parser.C.
|
inline |
If this is null, it means that we haven't parsed yet
Definition at line 134 of file Parser.h.
Referenced by ActionFactory::create(), and parse().
|
inline |
Definition at line 149 of file Parser.h.
Referenced by parse().
|
private |
The application types extracted from [Application] block.
Definition at line 172 of file Parser.h.
Referenced by getAppType(), and setAppType().
|
private |
The input file names.
Definition at line 166 of file Parser.h.
Referenced by getInputFileNames(), and getLastInputFileName().
|
private |
|
private |