Changeset 10508 for code/branches/core7/src
- Timestamp:
- May 30, 2015, 10:18:07 AM (9 years ago)
- Location:
- code/branches/core7/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/GraphicsManager.cc
r10479 r10508 117 117 resources_.reset(new XMLFile("DefaultResources.oxr")); 118 118 resources_->setLuaSupport(false); 119 Loader::getInstance(). open(resources_.get(), ClassTreeMask(), false);119 Loader::getInstance().load(resources_.get(), ClassTreeMask(), false); 120 120 121 121 // Only for runs in the build directory (not installed) … … 125 125 extResources_.reset(new XMLFile("resources.oxr")); 126 126 extResources_->setLuaSupport(false); 127 Loader::getInstance(). open(extResources_.get(), ClassTreeMask(), false);127 Loader::getInstance().load(extResources_.get(), ClassTreeMask(), false); 128 128 129 129 if (bLoadRenderer) … … 330 330 orxout(internal_info) << "Loading Debug Overlay..." << endl; 331 331 debugOverlay_.reset(new XMLFile("debug.oxo")); 332 Loader::getInstance(). open(debugOverlay_.get(), ClassTreeMask(), false);332 Loader::getInstance().load(debugOverlay_.get(), ClassTreeMask(), false); 333 333 } 334 334 -
code/branches/core7/src/libraries/core/Loader.cc
r10392 r10508 49 49 { 50 50 Loader* Loader::singletonPtr_s = 0; 51 52 bool Loader::open(const XMLFile* file, const ClassTreeMask& mask, bool bVerbose)53 {54 this->add(file, mask);55 return this->load(file, mask, bVerbose);56 }57 58 void Loader::close()59 {60 this->unload();61 this->files_.clear();62 }63 64 void Loader::close(const XMLFile* file)65 {66 this->unload(file);67 this->remove(file);68 }69 70 void Loader::add(const XMLFile* file, const ClassTreeMask& mask)71 {72 if (!file)73 return;74 this->files_.insert(this->files_.end(), std::pair<const XMLFile*, ClassTreeMask>(file, mask));75 }76 77 void Loader::remove(const XMLFile* file)78 {79 if (!file)80 return;81 for (std::vector<std::pair<const XMLFile*, ClassTreeMask> >::iterator it = this->files_.begin(); it != this->files_.end(); ++it)82 {83 if (it->first == file)84 {85 this->files_.erase(it);86 break;87 }88 }89 }90 91 /**92 @brief93 Loads all opened files, while conforming to the restrictions given by the input ClassTreeMask.94 @param mask95 A ClassTreeMask, which defines which types of classes are loaded and which aren't.96 @param bVerbose97 Whether the loader is verbose (prints its progress in a low output level) or not.98 @return99 Returns true if successful.100 */101 bool Loader::load(const ClassTreeMask& mask, bool bVerbose)102 {103 bool success = true;104 for (std::vector<std::pair<const XMLFile*, ClassTreeMask> >::iterator it = this->files_.begin(); it != this->files_.end(); ++it)105 if (!this->load(it->first, it->second * mask, bVerbose))106 success = false;107 108 return success;109 }110 111 void Loader::unload(const ClassTreeMask& mask)112 {113 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); )114 {115 if (mask.isIncluded(it->getIdentifier()))116 (it++)->destroy();117 else118 ++it;119 }120 }121 122 /**123 @brief124 Reloads all opened files, while conforming to the restrictions given by the input ClassTreeMask.125 @param mask126 A ClassTreeMask, which defines which types of classes are reloaded and which aren't.127 @param bVerbose128 Whether the loader is verbose (prints its progress in a low output level) or not.129 @return130 Returns true if successful.131 */132 bool Loader::reload(const ClassTreeMask& mask, bool bVerbose)133 {134 this->unload(mask);135 return this->load(mask, bVerbose);136 }137 51 138 52 /** … … 302 216 ++it; 303 217 } 304 }305 306 /**307 @brief308 Reloads the input file, while conforming to the restrictions given by the input ClassTreeMask.309 @param file310 The file to be reloaded.311 @param mask312 A ClassTreeMask, which defines which types of classes are reloaded and which aren't.313 @param bVerbose314 Whether the loader is verbose (prints its progress in a low output level) or not.315 @return316 Returns true if successful.317 */318 bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask, bool bVerbose)319 {320 this->unload(file, mask);321 return this->load(file, mask, bVerbose);322 218 } 323 219 -
code/branches/core7/src/libraries/core/Loader.h
r10392 r10508 55 55 56 56 public: 57 bool open(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);58 void close();59 void close(const XMLFile* file);60 61 void add(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());62 void remove(const XMLFile* file);63 64 bool load(const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);65 void unload(const ClassTreeMask& mask = ClassTreeMask());66 bool reload(const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);67 68 57 bool load(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), 69 58 bool bVerbose = true, bool bRemoveLuaTags = false); 70 59 void unload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask()); 71 bool reload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);72 60 73 61 static std::string replaceLuaTags(const std::string& text); -
code/branches/core7/src/orxonox/Level.cc
r10392 r10508 95 95 this->xmlfile_ = new XMLFile(mask, this->xmlfilename_); 96 96 97 Loader::getInstance(). open(this->xmlfile_);97 Loader::getInstance().load(this->xmlfile_); 98 98 } 99 99 -
code/branches/core7/src/orxonox/gamestates/GSLevel.cc
r10479 r10508 168 168 // call the loader 169 169 startFile_ = new XMLFile(LevelManager::getInstance().getDefaultLevel()); 170 bool loaded = Loader::getInstance(). open(startFile_);170 bool loaded = Loader::getInstance().load(startFile_); 171 171 172 172 Core::getInstance().getConfig()->updateLastLevelTimestamp();
Note: See TracChangeset
for help on using the changeset viewer.