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 const Property * getProperty(const char * name) const; 00043 00045 virtual void startIteration() const; 00048 virtual const Property * nextEntry() const; 00050 virtual bool hasMore() const; 00051 00052 00058 virtual void setProperty(const Property * property); 00059 00063 virtual void removeProperty(const 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(const char * name) const; 00075 00076 // need this mutable for iteration 00077 mutable plist::iterator iterator; 00078 mutable plist properties; 00079 00080 plist cache; 00081 00082 // We copy values into this property when returning 00083 // property objects. This allows control to 00084 // the linked property list only. 00085 mutable Property returnProp; 00086 00087 00088 00089 }; 00090 00091 #endif //_LINKEDPROPERTYLIST_HPP