PH Logo
Logo intepreter modeled after UCB Logo.
/Users/paul/Documents/phlogo/core/Console.h
00001 /*
00002  *  Console.h
00003  *
00004  *  Author: Paul Hamilton
00005  *      Date: 6 Jun 2011
00006  *
00007  */
00008 #ifndef _CONSOLE_H
00009 #define _CONSOLE_H
00010 
00011 #include <string>
00012 
00013 namespace phlogo {
00014         
00019 class Console {
00020                 
00021 public:
00022         
00023         virtual void reset() = 0;
00024         virtual void outputLine(const std::string &s) = 0;
00025         virtual void outputError(const std::string &s) = 0;
00026         virtual bool isError() = 0;
00027         virtual std::string getString() = 0;
00028 };
00029 
00034 class StringConsole : public Console {
00035                 
00036 public:
00037         StringConsole() : _error(false) {}
00038         
00039         std::string getString() { return _s; }
00040 
00041         // Console overrides
00042         void reset() { _s = ""; _error = false; }
00043         void outputLine(const std::string &s);
00044         void outputError(const std::string &s);
00045         bool isError() { return _error; }
00046         
00047 private:
00048         std::string _s;
00049         bool _error;
00050 };
00051 
00052 }
00053 
00054 #endif // _CONSOLE_H
 All Classes Functions