Class used for standardizing the retrieval of resource files. More...
#include <filefinder.h>
Public Member Functions | |
FileFinder () | |
Default Constructor. | |
FileFinder (const std::string &iniFile) | |
Constructor. | |
~FileFinder () | |
Default Destructor. | |
bool | AddResourcePath (const std::string &path) |
Adds a resource path to the class's path list. | |
void | LoadIniFile (const std::string &iniFile="resource_paths.ini") |
Adds resource paths to the class's path list read in from an ini file. | |
bool | RemoveResourcePath (const std::string &path) |
Removes a resource path from the class's path list. | |
bool | GetRecursionFlag () const |
void | SetRecursionFlag (const bool recursionFlag) |
Set's the recursion flag. If enabled, the finder will search recursively for a file. Recursion is on by default. | |
std::string | GetFilePath (const std::string &fileName) const |
Using the file name, returns the full path of the file. |
Class used for standardizing the retrieval of resource files.
The FileFinder class reads in a "resource_paths.ini" file when instantiated. This file contains path directories that the FileFinder will use (recursively) to search for files, given a file name.
The FileFinder does not open files, it simply returns the correct path of the file requested. Resource paths may be read in from a specified file or entered manually.
Definition at line 63 of file filefinder.h.
FileFinder::FileFinder | ( | ) |
Default Constructor.
Definition at line 53 of file filefinder.cpp.
FileFinder::FileFinder | ( | const std::string & | iniFile ) |
Constructor.
[in] | iniFile | String of the path to ini file. |
Definition at line 66 of file filefinder.cpp.
FileFinder::~FileFinder | ( | ) |
Default Destructor.
Definition at line 78 of file filefinder.cpp.
bool FileFinder::AddResourcePath | ( | const std::string & | path ) |
Adds a resource path to the class's path list.
[in] | path | String of the path. |
Definition at line 92 of file filefinder.cpp.
std::string FileFinder::GetFilePath | ( | const std::string & | fileName ) | const |
Using the file name, returns the full path of the file.
[in] | fileName | String of the file name. |
Definition at line 190 of file filefinder.cpp.
bool FileFinder::GetRecursionFlag | ( | ) | const |
Definition at line 160 of file filefinder.cpp.
void FileFinder::LoadIniFile | ( | const std::string & | iniFile = "resource_paths.ini" ) |
Adds resource paths to the class's path list read in from an ini file.
[in] | iniFile | String of the path to the ini file. |
Definition at line 114 of file filefinder.cpp.
bool FileFinder::RemoveResourcePath | ( | const std::string & | path ) |
Removes a resource path from the class's path list.
[in] | path | String of the path. |
Definition at line 143 of file filefinder.cpp.
void FileFinder::SetRecursionFlag | ( | const bool | recursionFlag ) |
Set's the recursion flag. If enabled, the finder will search recursively for a file. Recursion is on by default.
[in] | recursionFlag | Bool value of flag. |
Definition at line 175 of file filefinder.cpp.