Minor const-related code cleanup.
parent
6215d145c8
commit
d8b97ddc2f
|
@ -32,13 +32,13 @@ MeshManager::~MeshManager()
|
|||
}
|
||||
|
||||
|
||||
bool MeshManager::find(string name, Mesh** mesh)
|
||||
bool MeshManager::find(const string& name, Mesh** mesh)
|
||||
{
|
||||
return findResource(name, (void**) mesh);
|
||||
}
|
||||
|
||||
|
||||
Mesh* MeshManager::load(string name)
|
||||
Mesh* MeshManager::load(const string& name)
|
||||
{
|
||||
DPRINTF("Loading mesh: %s\n", name.c_str());
|
||||
ContentType fileType = DetermineFileType(name);
|
||||
|
|
|
@ -24,8 +24,8 @@ class MeshManager : public ResourceManager
|
|||
MeshManager(char* _baseDir) : ResourceManager(_baseDir) {};
|
||||
~MeshManager();
|
||||
|
||||
bool find(string name, Mesh**);
|
||||
Mesh* load(string name);
|
||||
bool find(const string& name, Mesh**);
|
||||
Mesh* load(const string& name);
|
||||
};
|
||||
|
||||
#endif // _MESHMANAGER_H_
|
||||
|
|
|
@ -37,7 +37,7 @@ ResourceManager::~ResourceManager()
|
|||
// in res and return true. Otherwise, leave res untouched and return false.
|
||||
// find() can be safely called with res == NULL just to test whether or not
|
||||
// the resource is resident.
|
||||
bool ResourceManager::findResource(string name, void** res)
|
||||
bool ResourceManager::findResource(const string& name, void** res)
|
||||
{
|
||||
ResourceTable::iterator iter = resources.find(name);
|
||||
if (iter != resources.end())
|
||||
|
@ -53,7 +53,7 @@ bool ResourceManager::findResource(string name, void** res)
|
|||
}
|
||||
|
||||
|
||||
void ResourceManager::addResource(string name, void* res)
|
||||
void ResourceManager::addResource(const string& name, void* res)
|
||||
{
|
||||
resources.insert(ResourceTable::value_type(name, res));
|
||||
}
|
||||
|
|
|
@ -19,17 +19,17 @@ class ResourceManager
|
|||
{
|
||||
public:
|
||||
ResourceManager();
|
||||
ResourceManager(string _baseDir);
|
||||
ResourceManager(std::string _baseDir);
|
||||
ResourceManager(char* _baseDir);
|
||||
~ResourceManager();
|
||||
|
||||
protected:
|
||||
bool findResource(string name, void**);
|
||||
void addResource(string name, void*);
|
||||
string baseDir;
|
||||
bool findResource(const std::string& name, void**);
|
||||
void addResource(const std::string& name, void*);
|
||||
std::string baseDir;
|
||||
|
||||
private:
|
||||
typedef std::map<string, void*> ResourceTable;
|
||||
typedef std::map<std::string, void*> ResourceTable;
|
||||
|
||||
ResourceTable resources;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue