2000-03-22 22:01:33 +00:00
|
|
|
#ifndef _PARSE_FILE_H_
|
|
|
|
#define _PARSE_FILE_H_
|
|
|
|
|
2000-10-02 21:49:04 +00:00
|
|
|
#include <simgear/compiler.h>
|
|
|
|
|
2000-03-22 22:01:33 +00:00
|
|
|
#include <string>
|
|
|
|
#include <list>
|
2008-07-25 18:38:29 +00:00
|
|
|
#include <fstream>
|
2000-03-22 22:01:33 +00:00
|
|
|
|
2008-07-27 16:25:13 +00:00
|
|
|
using std::list;
|
|
|
|
using std::string;
|
|
|
|
using std::getline;
|
|
|
|
using std::ifstream;
|
2000-09-21 22:59:27 +00:00
|
|
|
|
2000-03-22 22:01:33 +00:00
|
|
|
#define DELIMITERS " \t"
|
|
|
|
#define COMMENT "#"
|
|
|
|
|
2002-11-08 17:03:49 +00:00
|
|
|
#define MAXLINE 400 // Max size of the line of the input file
|
2000-03-22 22:01:33 +00:00
|
|
|
|
|
|
|
typedef list<string> stack; //list to contain the input file "command_lines"
|
|
|
|
|
|
|
|
class ParseFile
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
stack commands;
|
|
|
|
ifstream file;
|
|
|
|
void readFile();
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ParseFile() {}
|
|
|
|
ParseFile(const string fileName);
|
|
|
|
~ParseFile();
|
|
|
|
|
|
|
|
|
|
|
|
void removeComments(string& inputLine);
|
|
|
|
string getToken(string inputLine, int tokenNo);
|
|
|
|
void storeCommands(string inputLine);
|
|
|
|
stack getCommands();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _PARSE_FILE_H_
|