Changeset 902 for code/branches/core2/src/orxonox/core
- Timestamp:
- Mar 19, 2008, 8:43:36 PM (17 years ago)
- Location:
- code/branches/core2/src/orxonox/core
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/BaseObject.cc
r878 r902 79 79 @return The XML-element 80 80 */ 81 void BaseObject::XMLPort(Element& xmlelement, bool loading)81 void BaseObject::XMLPort(Element& xmlelement, XMLPort::Mode mode) 82 82 { 83 XMLPortParam(BaseObject, "name", setName, getName, xmlelement, loading);83 XMLPortParam(BaseObject, "name", setName, getName, xmlelement, mode); 84 84 } 85 85 -
code/branches/core2/src/orxonox/core/BaseObject.h
r879 r902 50 50 virtual ~BaseObject(); 51 51 virtual void loadParams(TiXmlElement* xmlElem); 52 virtual void XMLPort(Element& xmlelement, bool loading);52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 53 53 54 54 /** @brief Sets the name of the object. @param name The name */ -
code/branches/core2/src/orxonox/core/CorePrereqs.h
r895 r902 65 65 namespace orxonox 66 66 { 67 #ifndef _XMLPort_Mode__ 68 #define _XMLPort_Mode__ 69 namespace XMLPort 70 { 71 enum Mode 72 { 73 LoadObject, 74 SaveObject 75 }; 76 } 77 #endif 78 67 79 typedef std::string LanguageEntryLabel; 68 80 -
code/branches/core2/src/orxonox/core/Loader.cc
r901 r902 129 129 rootNamespace->setNamespace(rootNamespace); 130 130 rootNamespace->setRoot(true); 131 rootNamespace->XMLPort(rootElement, true);131 rootNamespace->XMLPort(rootElement, XMLPort::LoadObject); 132 132 133 133 COUT(0) << "Finished loading " << level->getFile() << "." << std::endl; -
code/branches/core2/src/orxonox/core/Namespace.cc
r901 r902 58 58 @return The XML-element 59 59 */ 60 void Namespace::XMLPort(Element& xmlelement, bool loading)60 void Namespace::XMLPort(Element& xmlelement, XMLPort::Mode mode) 61 61 { 62 BaseObject::XMLPort(xmlelement, loading);62 BaseObject::XMLPort(xmlelement, mode); 63 63 64 64 std::string name = this->getName(); … … 89 89 } 90 90 91 XMLPortParam(Namespace, "operator", setOperator, getOperator, xmlelement, loading);92 XMLPortParam(Namespace, "bAutogenerated", setAutogenerated, isAutogenerated, xmlelement, loading);91 XMLPortParam(Namespace, "operator", setOperator, getOperator, xmlelement, mode); 92 XMLPortParam(Namespace, "bAutogenerated", setAutogenerated, isAutogenerated, xmlelement, mode); 93 93 94 94 if (this->bAutogeneratedFileRootNamespace_) … … 101 101 } 102 102 103 XMLPortObject(Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, loading, true, false);103 XMLPortObject(Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, mode, true, false); 104 104 } 105 105 -
code/branches/core2/src/orxonox/core/Namespace.h
r901 r902 44 44 virtual ~Namespace(); 45 45 46 virtual void XMLPort(Element& xmlelement, bool loading);46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 47 48 48 void loadObjects(BaseObject* object); -
code/branches/core2/src/orxonox/core/XMLPort.h
r901 r902 75 75 namespace orxonox 76 76 { 77 78 #ifndef _XMLPort_Mode__ 79 #define _XMLPort_Mode__ 80 namespace XMLPort 81 { 82 enum Mode 83 { 84 LoadObject, 85 SaveObject 86 }; 87 } 88 #endif 89 77 90 // ############################### 78 91 // ### XMLPortParamContainer ### … … 123 136 } 124 137 125 XMLPortParamContainer& port(T* object, Element& xmlelement, bool loading)126 { 127 if ( loading)138 XMLPortParamContainer& port(T* object, Element& xmlelement, XMLPort::Mode mode) 139 { 140 if (mode == XMLPort::LoadObject) 128 141 { 129 142 try … … 227 240 } 228 241 229 XMLPortObjectContainer& port(T* object, Element& xmlelement, bool loading)230 { 231 if ( loading)242 XMLPortObjectContainer& port(T* object, Element& xmlelement, XMLPort::Mode mode) 243 { 244 if (mode == XMLPort::LoadObject) 232 245 { 233 246 try … … 257 270 if (this->bLoadBefore_) 258 271 { 259 newObject->XMLPort(*child, true);272 newObject->XMLPort(*child, XMLPort::LoadObject); 260 273 COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->classname_ << " (objectname " << object->getName() << ")" << std::endl; 261 274 } … … 266 279 (*object.*this->loadfunction_)(newObject); 267 280 if (!this->bLoadBefore_) 268 newObject->XMLPort(*child, true);281 newObject->XMLPort(*child, XMLPort::LoadObject); 269 282 COUT(5) << object->getLoaderIndentation() << "...fabricated " << child->Value() << " (objectname " << newObject->getName() << ")." << std::endl; 270 283 }
Note: See TracChangeset
for help on using the changeset viewer.