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)
inline
40 : StreamParser(stream) {}
StreamParser(const char *stream)
Definition: paramsparser.h:83
virtual FileParser::~FileParser ( )
inlinevirtual
41 {}

Member Function Documentation

bool FileParser::read ( const char *  stream)
virtual

Reimplemented from StreamParser.

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

39 {
40 // message("FileParser::read\n");
41  ifstream FILE(stream);
42  ostringstream OUT;
43 
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));
48 
49  message("reading parameters from \"%s\"\n",stream);
50 
51  OUT << FILE.rdbuf();
52 
53  FILE.close();
54 
55  return StreamParser::read(OUT.str().c_str());
56 }
void message(const char *message,...)
Definition: output.cc:40
virtual bool read(const char *stream)
Definition: paramsparser.cc:179
void fatal(const char *str,...)
Definition: output.cc:90

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