PH Logo
Logo intepreter modeled after UCB Logo.
/Users/paul/Documents/phlogo/core/FileProcessor.h
00001 /*
00002  *  FileProcessor.h
00003  *
00004  *  Author: Paul Hamilton
00005  *      Date: 11 Aug 2011
00006  *
00007  */
00008 #ifndef _FILEPROCESSOR_H
00009 #define _FILEPROCESSOR_H
00010 
00011 #include <fstream>
00012 #include <boost/filesystem/path.hpp>
00013 
00014 namespace phlogo {
00015 
00016 class Interpreter;
00017 class World;
00018     
00022 class LineProcessor {
00023     
00024 public:
00025     
00026     // process the line in the file.
00027     virtual void process(const std::string &line) = 0;
00028 };
00029 
00033 class LogoLineProcessor : public LineProcessor {
00034     
00035 public:
00036     LogoLineProcessor(Interpreter *itp, World *world) : _itp(itp), _world(world) {}
00037     
00038     // LineProcessor overrides
00039     virtual void process(const std::string &line);
00040     
00041 private:
00042     Interpreter *_itp;
00043     World *_world;
00044 };
00045 
00049 class FileProcessor {
00050                 
00051 public:
00052     
00056     static boost::filesystem::path locateFile(boost::filesystem::path p, boost::filesystem::path fn);
00057     
00061     static void parseFile(boost::filesystem::path f, LineProcessor *processor);
00062     
00066     static void parseLine(const std::string &s, Interpreter *itp, World *world);
00067 };
00068 
00069 }
00070 
00071 #endif // _FILEPROCESSOR_H
 All Classes Functions