Caelum
TypeDescriptor.cpp
1 /*
2 This file is part of Caelum.
3 See http://www.ogre3d.org/wiki/index.php/Caelum
4 
5 Copyright (c) 2008 Caelum team. See Contributors.txt for details.
6 
7 Caelum is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Caelum is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License
18 along with Caelum. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #include "CaelumPrecompiled.h"
22 #include "TypeDescriptor.h"
23 
24 #if CAELUM_TYPE_DESCRIPTORS
25 
26 using namespace Ogre;
27 
28 namespace Caelum
29 {
30  DefaultTypeDescriptor::DefaultTypeDescriptor ()
31  {
32  }
33 
34  DefaultTypeDescriptor::~DefaultTypeDescriptor () {
35  for (TypeDescriptor::PropertyMap::const_iterator it = mPropertyMap.begin(), end = mPropertyMap.end(); it != end; ++it) {
36  delete it->second;
37  }
38  }
39 
40  const ValuePropertyDescriptor* DefaultTypeDescriptor::getPropertyDescriptor (const Ogre::String& name) const
41  {
42  PropertyMap::const_iterator it = mPropertyMap.find(name);
43  if (it != mPropertyMap.end()) {
44  return it->second;
45  } else {
46  return 0;
47  }
48  }
49 
50  const std::vector<String> DefaultTypeDescriptor::getPropertyNames () const
51  {
52  std::vector<String> result;
53  for (TypeDescriptor::PropertyMap::const_iterator it = mPropertyMap.begin(), end = mPropertyMap.end(); it != end; ++it) {
54  result.push_back(it->first);
55  }
56  return result;
57  }
58 
59  const TypeDescriptor::PropertyMap DefaultTypeDescriptor::getFullPropertyMap () const {
60  return mPropertyMap;
61  }
62 
63  void DefaultTypeDescriptor::add (const Ogre::String& name, const ValuePropertyDescriptor* descriptor)
64  {
65  mPropertyMap.insert(make_pair(name, descriptor));
66  }
67 }
68 
69 #endif
Caelum namespace.
Definition: Astronomy.cpp:24