Public Member Functions

CxUtils::FileFinder Class Reference

Class used for standardizing the retrieval of resource files. More...

#include <filefinder.h>

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

FileFinder::FileFinder (  )

Default Constructor.

Definition at line 53 of file filefinder.cpp.

FileFinder::FileFinder ( const std::string &  iniFile )

Constructor.

Parameters:
[in]iniFileString 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.


Member Function Documentation

bool FileFinder::AddResourcePath ( const std::string &  path )

Adds a resource path to the class's path list.

Parameters:
[in]pathString of the path.
Returns:
True if valid path, false otherwise.

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.

Parameters:
[in]fileNameString of the file name.
Returns:
string containing the full path if successful, "" otherwise.

Definition at line 190 of file filefinder.cpp.

bool FileFinder::GetRecursionFlag (  ) const
Returns:
The value of the recursion flag.

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.

Parameters:
[in]iniFileString 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.

Parameters:
[in]pathString of the path.
Returns:
True if valid path, false otherwise.

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.

Parameters:
[in]recursionFlagBool value of flag.

Definition at line 175 of file filefinder.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines