Changeset 2539 for code/branches/presentation/src/core/XMLPort.h
- Timestamp:
- Dec 28, 2008, 7:32:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.