00001 #include <mattribute.h>
00002 #include <mmap.h>
00003
00004 Attributed::Attributed () : mAttributes (NULL) {
00005 }
00006
00007 Attributed::~Attributed () {
00008 delete mAttributes;
00009 }
00010
00011 void Attributed::setAttribute (const String& key, Object* value) {
00012 if (!mAttributes)
00013 mAttributes = new Map<String,Object> ();
00014 mAttributes->set (key, value);
00015 }
00016
00017 const Object& Attributed::getAttribute (const String& key) const {
00018 return mAttributes? (*mAttributes)[key] : *(Object*)NULL;
00019 }
00020
00021 Object& Attributed::getAttribute (const String& key) {
00022 return mAttributes? (*mAttributes)[key] : *(Object*)NULL;
00023 }
00024
00025 const Object* Attributed::getAttributep (const String& key) const {
00026 return mAttributes? mAttributes->getp(key) : NULL;
00027 }