PH Logo
Logo intepreter modeled after UCB Logo.
/Users/paul/Documents/phlogo/core/Scope.h
00001 /*
00002  *  Scope.h
00003  *
00004  *  Author: Paul Hamilton
00005  *      Date: 6 Jun 2011
00006  *
00007  */
00008 #ifndef _SCOPE_H
00009 #define _SCOPE_H
00010 
00011 #include "Types.h"
00012 
00013 #include <string>
00014 #include <map>
00015 
00016 namespace phlogo {
00017 
00018 class World;
00019 class Thing;
00020 
00025 class Scope {
00026                 
00027 public:
00028         Scope();
00029         Scope(World *world);
00030         ~Scope();
00031         
00035         void setThing(const std::string &name, const std::string &value, bool local);
00036         void setThing(const std::string &name,  pThing value, bool local);
00037         
00041         pThing getThing(const std::string &name);
00042 
00046     void removeThing(const std::string &name);
00047     void removeThings();
00048     
00049     // iterate
00050     std::map<std::string, pThing >::const_iterator begin() { return _things.begin(); }
00051     std::map<std::string, pThing >::const_iterator end() { return _things.end(); }
00052 
00053 private:
00054         World *_world;
00055         Scope *_parent;
00056         std::map<std::string, pThing > _things;
00057 };
00058 
00059 }
00060 
00061 #endif // _SCOPE_H
 All Classes Functions