PH Logo
Logo intepreter modeled after UCB Logo.
/Users/paul/Documents/phlogo/core/Array.h
00001 /*
00002  *  Array.h
00003  *
00004  *  Author: Paul Hamilton
00005  *      Date: 18 Jun 2011
00006  *
00007  */
00008 #ifndef _ARRAY_H
00009 #define _ARRAY_H
00010 
00011 #include "Types.h"
00012 
00013 #include <deque>
00014 
00015 namespace phlogo {
00016 
00017 class Thing;
00018 class StringTokenStream;
00019 
00024 class Array {
00025                 
00026 public:
00027         Array(tListArray *array, int length);
00028         Array(tListArray *array);
00029         
00030         std::string str();
00031         void set(int i, pThing thing);
00032         void clear();
00033         unsigned int size();
00034         pThing operator[](const size_t idx);
00035         pThing get(const size_t idx);
00036         void push_front(pThing thing);
00037         
00041         void fromWord(StringTokenStream *sts);
00042         
00046         static bool isArray(char c);
00047 
00048         tListArray::iterator begin() { return _array->begin(); }
00049         tListArray::iterator end() { return _array->end(); }
00050         tListArray::reverse_iterator rend() { return _array->rend(); }
00051         tListArray::reverse_iterator rbegin() { return _array->rbegin(); }
00052 
00053         tListArray *getVector() { return _array; }
00054 
00055 private:
00056 
00057         friend class ListArrayParser;
00058 
00059         tListArray *_array;
00060 };
00061 
00062 }
00063 
00064 #endif // _ARRAY_H
 All Classes Functions