]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Resource.cc
extreme refactoring
[chaz/yoink] / src / Moof / Resource.cc
similarity index 81%
rename from src/resource.cc
rename to src/Moof/Resource.cc
index 16b5f213489ae39ed9448901e5f06d0b2a901160..5efe8f53f43c4ae0ebdb98102d5870df8deb27a7 100644 (file)
 
 #include <unistd.h>
 
-#include "resource.hh"
+#include "Resource.hh"
 
 
-namespace dc {
+namespace Mf {
 
 
-std::vector<std::string> resource::searchPaths_;
+// static member
+std::vector<std::string> Resource::searchPaths_;
 
 
-resource::~resource() {}
+Resource::~Resource() {}
 
 
-void resource::addSearchPath(const std::string& directory)
+void Resource::addSearchPath(const std::string& directory)
 {
        // add a slash if there isn't one already
        if (directory[directory.length() - 1] != '/')
@@ -53,16 +54,16 @@ void resource::addSearchPath(const std::string& directory)
        }
 }
 
-std::string resource::getPathToResource(const std::string& name)
+std::string Resource::getPathToResource(const std::string& name)
 {
-       std::vector<std::string>::iterator i;
+       std::vector<std::string>::iterator it;
 
-       for (i = searchPaths_.begin(); i != searchPaths_.end(); i++)
+       for (it = searchPaths_.begin(); it != searchPaths_.end(); it++)
        {
-               std::string fullPath(*i);
+               std::string fullPath(*it);
                fullPath += name;
 
-               // TODO access(2) is not all that portable
+               // TODO this could be more portable
                if (access(fullPath.c_str(), R_OK) == 0)
                {
                        return fullPath;
@@ -74,7 +75,7 @@ std::string resource::getPathToResource(const std::string& name)
 }
 
 
-} // namespace dc
+} // namespace Mf
 
 /** vim: set ts=4 sw=4 tw=80: *************************************************/
 
This page took 0.021241 seconds and 4 git commands to generate.