00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "CaelumPrecompiled.h"
00022 #include "TypeDescriptor.h"
00023
00024 #if CAELUM_TYPE_DESCRIPTORS
00025
00026 using namespace Ogre;
00027
00028 namespace Caelum
00029 {
00030 DefaultTypeDescriptor::DefaultTypeDescriptor ()
00031 {
00032 }
00033
00034 DefaultTypeDescriptor::~DefaultTypeDescriptor () {
00035 for (TypeDescriptor::PropertyMap::const_iterator it = mPropertyMap.begin(), end = mPropertyMap.end(); it != end; ++it) {
00036 delete it->second;
00037 }
00038 }
00039
00040 const ValuePropertyDescriptor* DefaultTypeDescriptor::getPropertyDescriptor (const Ogre::String& name) const
00041 {
00042 PropertyMap::const_iterator it = mPropertyMap.find(name);
00043 if (it != mPropertyMap.end()) {
00044 return it->second;
00045 } else {
00046 return 0;
00047 }
00048 }
00049
00050 const std::vector<String> DefaultTypeDescriptor::getPropertyNames () const
00051 {
00052 std::vector<String> result;
00053 for (TypeDescriptor::PropertyMap::const_iterator it = mPropertyMap.begin(), end = mPropertyMap.end(); it != end; ++it) {
00054 result.push_back(it->first);
00055 }
00056 return result;
00057 }
00058
00059 const TypeDescriptor::PropertyMap DefaultTypeDescriptor::getFullPropertyMap () const {
00060 return mPropertyMap;
00061 }
00062
00063 void DefaultTypeDescriptor::add (const Ogre::String& name, const ValuePropertyDescriptor* descriptor)
00064 {
00065 mPropertyMap.insert(make_pair(name, descriptor));
00066 }
00067 }
00068
00069 #endif