00001 00002 /*========================================================================== 00003 * 00004 * Original source copyright (c) 2003, Carnegie Mellon University. 00005 * See copyright.cmu for details. 00006 * 00007 *========================================================================== 00008 */ 00009 00010 #ifndef _LINKEDPROPERTYLIST_HPP 00011 #define _LINKEDPROPERTYLIST_HPP 00012 00013 #include "PropertyList.hpp" 00014 00015 #include <list> 00016 00017 using namespace std; 00018 00031 typedef list<Property *> plist; 00032 00033 class LinkedPropertyList : public PropertyList { 00034 00035 public: 00036 LinkedPropertyList(); 00037 ~LinkedPropertyList(); 00038 00042 virtual Property * getProperty(char * name); 00043 00045 virtual void startIteration(); 00048 virtual Property * nextEntry(); 00050 virtual bool hasMore(); 00051 00052 00058 virtual void setProperty(Property * property); 00059 00063 virtual void removeProperty(char * name); 00065 virtual void clear(); 00066 00067 protected: 00068 00069 // checks the cache for a property that 00070 // can be reused, otherwise creates a new 00071 // property 00072 virtual Property * getAProperty(); 00073 // finds the property with the given name 00074 virtual Property * getPropertyInternal(char * name); 00075 00076 plist::iterator iterator; 00077 plist properties; 00078 00079 plist cache; 00080 00081 // We copy values into this property when returning 00082 // property objects. This allows control to 00083 // the linked property list only. 00084 Property returnProp; 00085 00086 00087 00088 }; 00089 00090 #endif //_LINKEDPROPERTYLIST_HPP