Nemo  2.3.46
FileParser Class Reference

Text input parameter file parser. More...

#include <fileparser.h>

+ Inheritance diagram for FileParser:
+ Collaboration diagram for FileParser:

Public Member Functions

 FileParser (const char *stream)
virtual ~FileParser ()
virtual bool read (const char *stream)
- Public Member Functions inherited from StreamParser
 StreamParser (const char *stream)
virtual ~StreamParser ()
virtual bool readArguments (istream &IN, int &l_count, string &args)
void replaceCR (string &stream, const char rpl= '\n')
- Public Member Functions inherited from ParamsParser
 ParamsParser (const char *name)
virtual ~ParamsParser ()
void setName (const char *name)
map< string, string > get_inputParams ()
map< string, vector< string > > & getParsedParameters (const char *stream_name)
map< string, vector< string > > & getParsedParameters ()
map< string, string > & getParameters (const char *stream_name)
map< string, string > & getParameters ()
void parse ()
 Builds the _parsedParams from the _inputParams. More...

Additional Inherited Members

- Static Public Member Functions inherited from StreamParser
static bool removeComment (istream &IN, int &l_count)
 Recusively removes comments until the end of a line/of the file, or of a block comment is reached. More...
static bool removeSpaceAndComment (istream &IN, int &l_count, bool keepLast=false)
 Removes whitespace char on a line until a non-ws or EOL is reached. More...
static string readUntilCharacter (istream &IN, int &l_count, char &start_c, const char end_c)
static void eatLine (istream &IN, int &l_count)
- Static Public Member Functions inherited from ParamsParser
static void getBlockArgument (istream &IN, char &c, string &arg)
static void getArguments (string &arg_str, vector< string > &arg_vect)
- Protected Member Functions inherited from ParamsParser
void reset_inputParams ()
void add_inputParam (string &param, const string &arg)

Detailed Description

Text input parameter file parser.

This class provides the StreamParser with the whole content of the input file.

Constructor & Destructor Documentation

FileParser::FileParser ( const char *  stream)
40 : StreamParser(stream) {}
StreamParser(const char *stream)
Definition: paramsparser.h:83
virtual FileParser::~FileParser ( )
41 {}

Member Function Documentation

bool FileParser::read ( const char *  stream)

Reimplemented from StreamParser.

References fatal(), message(), and StreamParser::read().

39 {
40 // message("FileParser::read\n");
41  ifstream FILE(stream);
42  ostringstream OUT;
44  if( !(FILE) )
45  fatal("\"%s\": %s\n***ERROR*** Nemo couldn't find an input file (default is `Nemo2.ini')\n",
46  stream,
47  strerror(errno));
49  message("reading parameters from \"%s\"\n",stream);
51  OUT << FILE.rdbuf();
53  FILE.close();
55  return StreamParser::read(OUT.str().c_str());
56 }
void message(const char *message,...)
virtual bool read(const char *stream)
void fatal(const char *str,...)

The documentation for this class was generated from the following files:

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR