Changeset 6417 for code/trunk/src/libraries/core/XMLPort.h
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/XMLPort.h
r5929 r6417 51 51 #include "util/MultiType.h" 52 52 #include "util/OrxAssert.h" 53 #include "util/StringUtils.h" 53 54 #include "Identifier.h" 54 55 #include "Executor.h" … … 184 185 ClassIdentifier<classname>::getIdentifier()->addXMLPortParamContainer(paramname, containername); \ 185 186 } \ 186 containername->port( static_cast<BaseObject*>(this), object, xmlelement, mode)187 containername->port(dynamic_cast<BaseObject*>(this), object, xmlelement, mode) 187 188 188 189 // -------------------- … … 316 317 { return this->paramname_; } 317 318 318 virtual XMLPortParamContainer& description(const std::string description) = 0;319 virtual XMLPortParamContainer& description(const std::string& description) = 0; 319 320 virtual const std::string& getDescription() = 0; 320 321 … … 344 345 345 346 public: 346 XMLPortClassParamContainer(const std::string paramname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor)347 XMLPortClassParamContainer(const std::string& paramname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor) 347 348 { 348 349 this->paramname_ = paramname; … … 385 386 } 386 387 std::map<std::string, std::string>::const_iterator it = this->owner_->xmlAttributes_.find(getLowercase(this->paramname_)); 387 std::string attributeValue ("");388 std::string attributeValue; 388 389 if (it != this->owner_->xmlAttributes_.end()) 389 390 attributeValue = it->second; … … 407 408 { 408 409 COUT(1) << std::endl; 409 COUT(1) << "An error occurred in XMLPort.h while loading attribute '" << this->paramname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << this->owner_->getName() << ") in " << this->owner_->getFilename() << ":"<< std::endl;410 COUT(1) << "An error occurred in XMLPort.h while loading attribute '" << this->paramname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << this->owner_->getName() << ") in " << this->owner_->getFilename() << ':' << std::endl; 410 411 COUT(1) << ex.what() << std::endl; 411 412 } … … 435 436 } 436 437 437 virtual XMLPortParamContainer& description(const std::string description)438 virtual XMLPortParamContainer& description(const std::string& description) 438 439 { this->loadexecutor_->setDescription(description); return (*this); } 439 440 virtual const std::string& getDescription() … … 497 498 { return this->sectionname_; } 498 499 499 virtual XMLPortObjectContainer& description(const std::string description) = 0;500 virtual XMLPortObjectContainer& description(const std::string& description) = 0; 500 501 virtual const std::string& getDescription() = 0; 501 502 … … 513 514 { 514 515 public: 515 XMLPortClassObjectContainer(const std::string sectionname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor, bool bApplyLoaderMask, bool bLoadBefore)516 XMLPortClassObjectContainer(const std::string& sectionname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>* saveexecutor, bool bApplyLoaderMask, bool bLoadBefore) 516 517 { 517 518 this->sectionname_ = sectionname; … … 538 539 { 539 540 Element* xmlsubelement; 540 if ( (this->sectionname_ != "") && (this->sectionname_.size() > 0))541 if (!this->sectionname_.empty()) 541 542 xmlsubelement = xmlelement.FirstChildElement(this->sectionname_, false); 542 543 else … … 570 571 { 571 572 newObject->XMLPort(*child, XMLPort::LoadObject); 572 COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ")"<< std::endl;573 COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << std::endl; 573 574 } 574 575 else 575 576 { 576 COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ")"<< std::endl;577 COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ')' << std::endl; 577 578 } 578 579 … … 609 610 else 610 611 { 611 if ( this->sectionname_ != "")612 if (!this->sectionname_.empty()) 612 613 { 613 614 COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a valid classname." << std::endl; … … 624 625 { 625 626 COUT(1) << std::endl; 626 COUT(1) << "An error occurred in XMLPort.h while loading a '" << ClassIdentifier<O>::getIdentifier()->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ":"<< std::endl;627 COUT(1) << "An error occurred in XMLPort.h while loading a '" << ClassIdentifier<O>::getIdentifier()->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ':' << std::endl; 627 628 COUT(1) << ex.what() << std::endl; 628 629 } … … 635 636 } 636 637 637 virtual XMLPortObjectContainer& description(const std::string description)638 virtual XMLPortObjectContainer& description(const std::string& description) 638 639 { this->loadexecutor_->setDescription(description); return (*this); } 639 640 virtual const std::string& getDescription()
Note: See TracChangeset
for help on using the changeset viewer.