|
PH Logo
Logo intepreter modeled after UCB Logo.
|
00001 /* 00002 * List.h 00003 * 00004 * Author: Paul Hamilton 00005 * Date: 8 Jun 2011 00006 * 00007 */ 00008 #ifndef _LLIST_H 00009 #define _LLIST_H 00010 00011 #include "Types.h" 00012 00013 #include <string> 00014 #include <deque> 00015 #include <iterator> 00016 00017 namespace phlogo { 00018 00019 class Thing; 00020 class StringTokenStream; 00021 00026 class List { 00027 00028 public: 00029 List(tListArray *list); 00030 00031 std::string str(); 00032 void add(pThing thing); 00033 void addString(const std::string &s); 00034 void clear(); 00035 unsigned int size(); 00036 pThing operator[](const size_t idx); 00037 pThing get(const size_t idx); 00038 void set(const size_t idx, pThing thing); 00039 void push_front(pThing thing); 00040 void push_back(pThing thing); 00041 pThing pop_front(); 00042 pThing pop_back(); 00043 00047 void fromWord(StringTokenStream *sts); 00048 00052 static bool isList(char c); 00053 00054 tListArray::iterator begin() { return _list->begin(); } 00055 tListArray::iterator end() { return _list->end(); } 00056 tListArray::reverse_iterator rend() { return _list->rend(); } 00057 tListArray::reverse_iterator rbegin() { return _list->rbegin(); } 00058 00059 tListArray *getVector() { return _list; } 00060 00061 private: 00062 friend class ListArrayParser; 00063 00064 tListArray *_list; 00065 00066 }; 00067 00068 } 00069 00070 #endif // _LLIST_H
1.7.4