00001 00008 /* Copyright, 2004 Werewolf 00009 * 00010 * This file is part of Werewolf. 00011 * Werewolf is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2, or (at your option) 00014 * any later version. 00015 00016 * Werewolf is distributed in the hope that it will be useful, but 00017 * WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * General Public License for more details. 00020 00021 * You should have received a copy of the GNU General Public License 00022 * along with Werewolf; see the file COPYING. If not, write to the 00023 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00024 * MA 02111-1307, USA. 00025 */ 00026 00027 // 00028 // Standard Includes 00029 // 00030 #include "stdpch.h" 00031 00032 // 00033 // System Includes 00034 // 00035 #include <stdio.h> 00036 00037 // 00038 // NeL Includes 00039 // 00040 00041 // 00042 // Werewolf Includes 00043 // 00044 #include "wwscript/GlobalProperty/PropertyManager.h" 00045 00046 // 00047 // Namespaces 00048 // 00049 00050 namespace WWSCRIPT { 00051 00052 PropertyManager::PropertyManager() { 00053 // do nothing 00054 } 00055 00056 PropertyManager::~PropertyManager() { 00057 /* propertyMapMap::iterator iter; 00058 for(iter = m_maps.begin(); iter != m_maps.end(); iter++) { 00059 delete iter->second; 00060 } 00061 m_maps.clear(); 00062 */ 00063 } 00064 00065 void PropertyManager::registerProperty(const char* map, IProperty* property) { 00066 PropertyMap* m = getPropertyMap(map); 00067 if(m == NULL) // TODO throw an exception here. 00068 return; 00069 m->registerProperty(property); 00070 } 00071 00072 IProperty* PropertyManager::getProperty(const char* map, const char* property) { 00073 PropertyMap* m = getPropertyMap(map); 00074 if(m == NULL) { // TODO throw an exception ehre. 00075 nlwarning("Unable to find property map '%s'", map); 00076 return NULL; 00077 } 00078 return m->getProperty(property); 00079 } 00080 00081 PropertyMap* PropertyManager::getPropertyMap(const char* name) { 00082 propertyMapMap::iterator iter = m_maps.find(name); 00083 if(iter == m_maps.end()) 00084 return NULL; // throw an exception here? 00085 return iter->second; 00086 } 00087 00088 void PropertyManager::setPropertyMap(const char* name, PropertyMap* map) { 00089 m_maps[name] = map; 00090 } 00091 00092 }; // END OF NAMESPACE WWSCRIPT
1.6.1