Changeset 9788 in orxonox.OLD for branches/new_class_id/src/lib/util/loading/resource.cc
- Timestamp:
- Sep 22, 2006, 6:55:52 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/loading/resource.cc
r9787 r9788 19 19 #include "filesys/file.h" 20 20 21 ObjectListDefinition( Resource);21 ObjectListDefinition(NewResource); 22 22 23 23 24 std::vector< Resource::Type*>Resource::_resourceTypes;24 std::vector<NewResource::Type*> NewResource::_resourceTypes; 25 25 26 26 //! GLOBALS 27 Directory Resource::_mainGlobalPath;28 std::vector<Directory> Resource::_globalPaths;27 Directory NewResource::_mainGlobalPath; 28 std::vector<Directory> NewResource::_globalPaths; 29 29 30 30 … … 32 32 * standard constructor 33 33 */ 34 Resource::Resource (Resource::Type* type)34 NewResource::NewResource (NewResource::Type* type) 35 35 : _pointer(NULL), _type(type) 36 36 { 37 this->registerObject(this, Resource::_objectList);37 this->registerObject(this, NewResource::_objectList); 38 38 39 39 if(this->_type->id() == -1) 40 40 { 41 Resource::_resourceTypes.push_back(this->_type);42 this->_type->setID( Resource::_resourceTypes.size()-1);41 NewResource::_resourceTypes.push_back(this->_type); 42 this->_type->setID(NewResource::_resourceTypes.size()-1); 43 43 } 44 44 … … 48 48 * standard deconstructor 49 49 */ 50 Resource::~Resource ()50 NewResource::~NewResource () 51 51 { 52 52 // delete what has to be deleted here … … 54 54 55 55 56 std::string Resource::locateFile(const std::string& fileName)56 std::string NewResource::locateFile(const std::string& fileName) 57 57 { 58 58 if (File(fileName).exists()) 59 59 return fileName; 60 else if (( Resource::_mainGlobalPath+File(fileName)) . exists() )61 return ( Resource::_mainGlobalPath + File(fileName)).name();60 else if ((NewResource::_mainGlobalPath+File(fileName)) . exists() ) 61 return (NewResource::_mainGlobalPath + File(fileName)).name(); 62 62 63 63 return std::string("/home/bensch/svn/orxonox/data/") + fileName; … … 66 66 67 67 68 Resource::Pointer*Resource::acquireResource(const std::string& loadString)68 NewResource::Pointer* NewResource::acquireResource(const std::string& loadString) 69 69 { 70 //const Resource::Type* const type =Resource::_resourceTypes[this->_type->id()];70 //const NewResource::Type* const type = NewResource::_resourceTypes[this->_type->id()]; 71 71 72 72 for (unsigned int i = 0; i < _type->storedResources().size(); ++i) … … 79 79 } 80 80 81 void Resource::setMainGlobalPath(const Directory& directory)81 void NewResource::setMainGlobalPath(const Directory& directory) 82 82 { 83 Resource::_mainGlobalPath = directory;84 Resource::_mainGlobalPath.open();83 NewResource::_mainGlobalPath = directory; 84 NewResource::_mainGlobalPath.open(); 85 85 } 86 86 87 void Resource::addGlobalPath(const Directory& directory)87 void NewResource::addGlobalPath(const Directory& directory) 88 88 { 89 std::vector<Directory>::const_iterator it = std::find( Resource::_globalPaths.begin(),Resource::_globalPaths.end(), directory);90 if (it == Resource::_globalPaths.end())91 Resource::_globalPaths.push_back(directory);89 std::vector<Directory>::const_iterator it = std::find(NewResource::_globalPaths.begin(), NewResource::_globalPaths.end(), directory); 90 if (it == NewResource::_globalPaths.end()) 91 NewResource::_globalPaths.push_back(directory); 92 92 } 93 93 94 94 95 95 96 void Resource::addResource(Resource::Pointer* pointer)96 void NewResource::addResource(NewResource::Pointer* pointer) 97 97 { 98 98 this->_type->addResource(pointer); … … 108 108 109 109 110 void Resource::KeepLevel::setKeepLevelName(unsigned int level, const std::string& name)110 void NewResource::KeepLevel::setKeepLevelName(unsigned int level, const std::string& name) 111 111 { 112 112 if (_keepLevelName.size() <= level) … … 117 117 118 118 119 void Resource::Type::addResource(Resource::Pointer* resource)119 void NewResource::Type::addResource(NewResource::Pointer* resource) 120 120 { 121 121 this->_storedResources.push_back(resource); … … 124 124 125 125 126 Resource::Pointer::Pointer(const std::string& loadString, constResource::KeepLevel& keeplevel)126 NewResource::Pointer::Pointer(const std::string& loadString, const NewResource::KeepLevel& keeplevel) 127 127 : _loadString(loadString), _keepLevel(keeplevel) 128 128 {} 129 129 130 130 131 void Resource::Type::setID(int id)131 void NewResource::Type::setID(int id) 132 132 { 133 133 this->_id = id;
Note: See TracChangeset
for help on using the changeset viewer.