Changeset 8858 for code/trunk/src/libraries/core/Loader.cc
- Timestamp:
- Aug 23, 2011, 12:45:53 AM (13 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore
-
old new 1 1 build 2 2 codeblocks 3 vs 3 4 dependencies
-
- Property svn:mergeinfo changed
/code/branches/output (added) merged: 8739-8740,8765,8771-8772,8774-8780,8787-8789,8794-8799,8801,8803-8812,8814,8816-8817,8820,8822,8825-8837,8840,8844,8846,8848-8850,8853-8854
- Property svn:ignore
-
code/trunk/src/libraries/core/Loader.cc
r8108 r8858 33 33 #include <boost/scoped_ptr.hpp> 34 34 35 #include "util/ Debug.h"35 #include "util/Output.h" 36 36 #include "util/Exception.h" 37 37 #include "util/StringUtils.h" … … 49 49 ClassTreeMask Loader::currentMask_s; 50 50 51 bool Loader::open(const XMLFile* file, const ClassTreeMask& mask )51 bool Loader::open(const XMLFile* file, const ClassTreeMask& mask, bool bVerbose) 52 52 { 53 53 Loader::add(file, mask); 54 return Loader::load(file, mask );54 return Loader::load(file, mask, bVerbose); 55 55 } 56 56 … … 93 93 @param mask 94 94 A ClassTreeMask, which defines which types of classes are loaded and which aren't. 95 @param verbose95 @param bVerbose 96 96 Whether the loader is verbose (prints its progress in a low output level) or not. 97 97 @return 98 98 Returns true if successful. 99 99 */ 100 bool Loader::load(const ClassTreeMask& mask, bool verbose)100 bool Loader::load(const ClassTreeMask& mask, bool bVerbose) 101 101 { 102 102 bool success = true; 103 103 for (std::vector<std::pair<const XMLFile*, ClassTreeMask> >::iterator it = Loader::files_s.begin(); it != Loader::files_s.end(); ++it) 104 if (!Loader::load(it->first, it->second * mask, verbose))104 if (!Loader::load(it->first, it->second * mask, bVerbose)) 105 105 success = false; 106 106 … … 124 124 @param mask 125 125 A ClassTreeMask, which defines which types of classes are reloaded and which aren't. 126 @param verbose126 @param bVerbose 127 127 Whether the loader is verbose (prints its progress in a low output level) or not. 128 128 @return 129 129 Returns true if successful. 130 130 */ 131 bool Loader::reload(const ClassTreeMask& mask, bool verbose)131 bool Loader::reload(const ClassTreeMask& mask, bool bVerbose) 132 132 { 133 133 Loader::unload(mask); 134 return Loader::load(mask, verbose);134 return Loader::load(mask, bVerbose); 135 135 } 136 136 … … 142 142 @param mask 143 143 A ClassTreeMask, which defines which types of classes are loaded and which aren't. 144 @param verbose144 @param bVerbose 145 145 Whether the loader is verbose (prints its progress in a low output level) or not. 146 146 @param bRemoveLuaTags … … 149 149 Returns true if successful. 150 150 */ 151 bool Loader::load(const XMLFile* file, const ClassTreeMask& mask, bool verbose, bool bRemoveLuaTags)151 bool Loader::load(const XMLFile* file, const ClassTreeMask& mask, bool bVerbose, bool bRemoveLuaTags) 152 152 { 153 153 if (!file) … … 170 170 if (info == NULL) 171 171 { 172 COUT(1) << "Error: Could not find XML file '" << file->getFilename() << "'." << std::endl;172 orxout(user_error, context::loader) << "Could not find XML file '" << file->getFilename() << "'." << endl; 173 173 return false; 174 174 } … … 187 187 try 188 188 { 189 if( verbose)190 { 191 COUT(0) << "Start loading " << file->getFilename() << "..." << std::endl;192 COUT(3) << "Mask: " << Loader::currentMask_s << std::endl;193 } 194 else 195 { 196 COUT(4) << "Start loading " << file->getFilename() << "..." << std::endl;197 COUT(4) << "Mask: " << Loader::currentMask_s << std::endl;189 if(bVerbose) 190 { 191 orxout(user_info) << "Start loading " << file->getFilename() << "..." << endl; 192 orxout(internal_info, context::loader) << "Mask: " << Loader::currentMask_s << endl; 193 } 194 else 195 { 196 orxout(verbose, context::loader) << "Start loading " << file->getFilename() << "..." << endl; 197 orxout(verbose_more, context::loader) << "Mask: " << Loader::currentMask_s << endl; 198 198 } 199 199 … … 208 208 rootElement.InsertEndChild(*child); 209 209 210 COUT(4) << " creating root-namespace..." << std::endl;210 orxout(verbose, context::loader) << " creating root-namespace..." << endl; 211 211 Namespace* rootNamespace = new Namespace(0); 212 212 rootNamespace->setLoaderIndentation(" "); … … 216 216 rootNamespace->XMLPort(rootElement, XMLPort::LoadObject); 217 217 218 if( verbose)219 COUT(0) << "Finished loading " << file->getFilename() << '.' << std::endl;220 else 221 COUT(4) << "Finished loading " << file->getFilename() << '.' << std::endl;222 223 COUT(4) << "Namespace-tree:" << std::endl << rootNamespace->toString(" ") << std::endl;218 if(bVerbose) 219 orxout(user_info) << "Finished loading " << file->getFilename() << '.' << endl; 220 else 221 orxout(verbose, context::loader) << "Finished loading " << file->getFilename() << '.' << endl; 222 223 orxout(verbose, context::loader) << "Namespace-tree:" << '\n' << rootNamespace->toString(" ") << endl; 224 224 225 225 return true; … … 227 227 catch (ticpp::Exception& ex) 228 228 { 229 COUT(1) << std::endl;230 COUT(1) << "An XML-error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl;231 COUT(1) << ex.what() << std::endl;232 COUT(1) << "Loading aborted." << std::endl;229 orxout(user_error, context::loader) << endl; 230 orxout(user_error, context::loader) << "An XML-error occurred in Loader.cc while loading " << file->getFilename() << ':' << endl; 231 orxout(user_error, context::loader) << ex.what() << endl; 232 orxout(user_error, context::loader) << "Loading aborted." << endl; 233 233 return false; 234 234 } 235 235 catch (Exception& ex) 236 236 { 237 COUT(1) << std::endl;238 COUT(1) << "A loading-error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl;239 COUT(1) << ex.what() << std::endl;240 COUT(1) << "Loading aborted." << std::endl;237 orxout(user_error, context::loader) << endl; 238 orxout(user_error, context::loader) << "A loading-error occurred in Loader.cc while loading " << file->getFilename() << ':' << endl; 239 orxout(user_error, context::loader) << ex.what() << endl; 240 orxout(user_error, context::loader) << "Loading aborted." << endl; 241 241 return false; 242 242 } 243 243 catch (...) 244 244 { 245 COUT(1) << std::endl;246 COUT(1) << "An error occurred in Loader.cc while loading " << file->getFilename() << ':' << std::endl;247 COUT(1) << Exception::handleMessage() << std::endl;248 COUT(1) << "Loading aborted." << std::endl;245 orxout(user_error, context::loader) << endl; 246 orxout(user_error, context::loader) << "An error occurred in Loader.cc while loading " << file->getFilename() << ':' << endl; 247 orxout(user_error, context::loader) << Exception::handleMessage() << endl; 248 orxout(user_error, context::loader) << "Loading aborted." << endl; 249 249 return false; 250 250 } … … 271 271 @param mask 272 272 A ClassTreeMask, which defines which types of classes are reloaded and which aren't. 273 @param verbose273 @param bVerbose 274 274 Whether the loader is verbose (prints its progress in a low output level) or not. 275 275 @return 276 276 Returns true if successful. 277 277 */ 278 bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask, bool verbose)278 bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask, bool bVerbose) 279 279 { 280 280 Loader::unload(file, mask); 281 return Loader::load(file, mask, verbose);281 return Loader::load(file, mask, bVerbose); 282 282 } 283 283 … … 337 337 if (!expectedValue) 338 338 { 339 COUT(2) << "Warning: Error in level file" << std::endl;339 orxout(internal_error, context::loader) << "Error in level file" << endl; 340 340 // TODO: error handling 341 return false; 341 return false; 342 342 } 343 343 }
Note: See TracChangeset
for help on using the changeset viewer.