Changeset 2539 for code/branches/presentation/src
- Timestamp:
- Dec 28, 2008, 7:32:17 PM (16 years ago)
- Location:
- code/branches/presentation/src/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/core/BaseObject.cc
r2485 r2539 61 61 this->oldGametype_ = 0; 62 62 63 this->lastLoadedXMLElement_ = 0; 64 63 65 this->functorSetMainState_ = 0; 64 66 this->functorGetMainState_ = 0; -
code/branches/presentation/src/core/BaseObject.h
r2485 r2539 62 62 class _CoreExport BaseObject : virtual public OrxonoxClass 63 63 { 64 template <class T> friend class XMLPortClassParamContainer; 65 64 66 public: 65 67 BaseObject(BaseObject* creator); … … 173 175 174 176 protected: 175 std::string name_; //!< The name of the object176 std::string oldName_; //!< The old name of the object177 mbool bActive_; //!< True = the object is active178 mbool bVisible_; //!< True = the object is visible177 std::string name_; //!< The name of the object 178 std::string oldName_; //!< The old name of the object 179 mbool bActive_; //!< True = the object is active 180 mbool bVisible_; //!< True = the object is visible 179 181 std::string mainStateName_; 180 182 Functor* functorSetMainState_; … … 185 187 Template* getTemplate(unsigned int index) const; 186 188 187 bool bInitialized_; //!< True if the object was initialized (passed the object registration) 188 const XMLFile* file_; //!< The XMLFile that loaded this object 189 std::string loaderIndentation_; //!< Indentation of the debug output in the Loader 189 bool bInitialized_; //!< True if the object was initialized (passed the object registration) 190 const XMLFile* file_; //!< The XMLFile that loaded this object 191 Element* lastLoadedXMLElement_; //!< Non 0 if the TinyXML attributes have already been copied to our own lowercase map 192 std::map<std::string, std::string> xmlAttributes_; //!< Lowercase XML attributes 193 std::string loaderIndentation_; //!< Indentation of the debug output in the Loader 190 194 Namespace* namespace_; 191 195 BaseObject* creator_; -
code/branches/presentation/src/core/XMLIncludes.h
r2500 r2539 64 64 namespace orxonox 65 65 { 66 typedef ticpp::DocumentDocument;67 typedef ticpp::ElementElement;68 typedef ticpp::DeclarationDeclaration;69 typedef ticpp::StylesheetReferenceStylesheetReference;70 typedef ticpp::TextText;71 typedef ticpp::CommentComment;72 typedef ticpp::AttributeAttribute;66 using ticpp::Document; 67 using ticpp::Element; 68 using ticpp::Declaration; 69 using ticpp::StylesheetReference; 70 using ticpp::Text; 71 using ticpp::Comment; 72 using ticpp::Attribute; 73 73 } -
code/branches/presentation/src/core/XMLPort.h
r2536 r2539 182 182 ClassIdentifier<classname>::getIdentifier()->addXMLPortParamContainer(paramname, containername); \ 183 183 } \ 184 containername->port( (BaseObject*)this, object, xmlelement, mode)184 containername->port(static_cast<BaseObject*>(this), object, xmlelement, mode) 185 185 186 186 // -------------------- … … 360 360 XMLPortParamContainer& port(BaseObject* owner, T* object, Element& xmlelement, XMLPort::Mode mode) 361 361 { 362 OrxAssert(owner, "XMLPortParamContainer must have a BaseObject as owner."); 362 363 this->owner_ = owner; 363 364 this->parseParams_.object = object; … … 369 370 try 370 371 { 371 std::string attribute = xmlelement.GetAttribute(this->paramname_); 372 if ((attribute.size() > 0) || ((mode != XMLPort::ExpandObject) && this->loadexecutor_->allDefaultValuesSet())) 372 if (this->owner_->lastLoadedXMLElement_ != &xmlelement) 373 { 374 this->owner_->xmlAttributes_.clear(); 375 // Iterate through the attributes manually in order to make them case insensitive 376 Attribute* attribute = xmlelement.FirstAttribute(false); 377 while (attribute != 0) 378 { 379 this->owner_->xmlAttributes_[getLowercase(attribute->Name())] = attribute->Value(); 380 attribute = attribute->Next(false); 381 } 382 this->owner_->lastLoadedXMLElement_ = &xmlelement; 383 } 384 std::map<std::string, std::string>::const_iterator it = this->owner_->xmlAttributes_.find(getLowercase(this->paramname_)); 385 std::string attributeValue(""); 386 if (it != this->owner_->xmlAttributes_.end()) 387 attributeValue = it->second; 388 389 // TODO: Checking the iterator would be better since then we can have strings with value "" as well. 390 // Unfortunately this does not seem to work with the Executor parser yet. 391 if ((!attributeValue.empty()) || ((mode != XMLPort::ExpandObject) && this->loadexecutor_->allDefaultValuesSet())) 373 392 { 374 393 COUT(5) << this->owner_->getLoaderIndentation() << "Loading parameter " << this->paramname_ << " in " << this->identifier_->getName() << " (objectname " << this->owner_->getName() << ")." << std::endl << this->owner_->getLoaderIndentation(); 375 if (this->loadexecutor_->parse(object, attribute , ",") || (mode == XMLPort::ExpandObject))394 if (this->loadexecutor_->parse(object, attributeValue, ",") || (mode == XMLPort::ExpandObject)) 376 395 this->parseResult_ = PR_finished; 377 396 else
Note: See TracChangeset
for help on using the changeset viewer.