STIRA  0.1
Public Member Functions | Static Public Member Functions | List of all members
stira::common::FileAccess Class Reference

class to facilitate file access in directories. More...

#include <FileAccess.h>

Public Member Functions

 FileAccess ()
 
 ~FileAccess ()
 

Static Public Member Functions

static std::vector< std::string > ListFilesInSubFoldersInFolder (std::string pathToAccess, std::string prefix, std::string extension, bool separatorIsUnderscore=false)
 Gets a list of subdirectories with given prefix in a directory References: http://www.linuxquestions.org/questions/programming-9/c-list-files-in-directory-379323/ http://www.gnu.org/software/libc/manual/html_node/File-System-Interface.html#File-System-Interface http://en.wikipedia.org/wiki/Dirent.h http://www.gnu.org/software/libc/manual/html_node/Simple-Directory-Lister.html#Simple-Directory-Lister. More...
 
static std::vector< std::string > ListFilesOfType (std::string pathToAccess, std::string prefix, std::string extension, bool usePrefix, bool separatorIsUnderscore=false, int startNrImage=-1, int maxNrFiles=-1)
 Gets a list of files in a directory with given extension References: http://www.linuxquestions.org/questions/programming-9/c-list-files-in-directory-379323/ http://www.gnu.org/software/libc/manual/html_node/File-System-Interface.html#File-System-Interface http://en.wikipedia.org/wiki/Dirent.h http://www.gnu.org/software/libc/manual/html_node/Simple-Directory-Lister.html#Simple-Directory-Lister. More...
 
static std::string FindFileName (std::vector< std::string > fileList, int frameNr)
 finds file name from that contains a given index number in a list of file names More...
 
static bool CheckIfDirectoryExists (const std::string dirName)
 checks if a given directory name exists More...
 
static bool CheckIfFileExists (const std::string &name)
 
static bool CreateNewDirectory (std::string dirName)
 creates a directory with given name Reference: http://www.go4expert.com/forums/showthread.php?t=9031 (create a directory) More...
 
static bool CreateSymbolicLink2File (std::string sourcePathAndFileName, std::string linkPathAndFileName)
 creates a directory with given name Reference: http://www.dreamincode.net/forums/topic/200281-creating-a-symbolic-link-from-c-program/ More...
 

Detailed Description

class to facilitate file access in directories.

Constructor & Destructor Documentation

stira::common::FileAccess::FileAccess ( )

constructor

stira::common::FileAccess::~FileAccess ( )

destructor

Member Function Documentation

bool stira::common::FileAccess::CheckIfDirectoryExists ( const std::string  dirName)
static

checks if a given directory name exists

Parameters
dirNamethe directory name to check if it exists
bool stira::common::FileAccess::CreateNewDirectory ( std::string  dirName)
static

creates a directory with given name Reference: http://www.go4expert.com/forums/showthread.php?t=9031 (create a directory)

Parameters
dirNamethe directory name to create
bool stira::common::FileAccess::CreateSymbolicLink2File ( std::string  sourcePathAndFileName,
std::string  linkPathAndFileName 
)
static

creates a directory with given name Reference: http://www.dreamincode.net/forums/topic/200281-creating-a-symbolic-link-from-c-program/

Parameters
sourcePathAndFileNamethe source file and its path
linkPathAndFileNamethe path and name for the symbolic link
std::string stira::common::FileAccess::FindFileName ( std::vector< std::string >  fileList,
int  frameNr 
)
static

finds file name from that contains a given index number in a list of file names

Parameters
fileListthe list of files in which to search;
frameNrthe frame number for which to find the full file name
std::vector< std::string > stira::common::FileAccess::ListFilesInSubFoldersInFolder ( std::string  pathToAccess,
std::string  prefix,
std::string  extension,
bool  separatorIsUnderscore = false 
)
static

Gets a list of subdirectories with given prefix in a directory References: http://www.linuxquestions.org/questions/programming-9/c-list-files-in-directory-379323/ http://www.gnu.org/software/libc/manual/html_node/File-System-Interface.html#File-System-Interface http://en.wikipedia.org/wiki/Dirent.h http://www.gnu.org/software/libc/manual/html_node/Simple-Directory-Lister.html#Simple-Directory-Lister.

Parameters
pathToAccessthe path to the directory containing the subdirectories
prefixthe wanted subdirectory prefix
extensionthe wanted file extension
Returns
a vector of file names found in the given directory with the given file extension
std::vector< std::string > stira::common::FileAccess::ListFilesOfType ( std::string  pathToAccess,
std::string  prefix,
std::string  extension,
bool  usePrefix,
bool  separatorIsUnderscore = false,
int  startNrImage = -1,
int  maxNrFiles = -1 
)
static

Gets a list of files in a directory with given extension References: http://www.linuxquestions.org/questions/programming-9/c-list-files-in-directory-379323/ http://www.gnu.org/software/libc/manual/html_node/File-System-Interface.html#File-System-Interface http://en.wikipedia.org/wiki/Dirent.h http://www.gnu.org/software/libc/manual/html_node/Simple-Directory-Lister.html#Simple-Directory-Lister.

Parameters
pathToAccessthe path to the directory containing the files
extensionthe wanted file extension
startNrImageto restrict which files are taken, we can set a certain start number; if set to -1, the smallest possible file index will be taken
maxNrFilesto restrict which files are taken, we can set a certain maximum number of files; if set to -1, all available files will be taken
Returns
a vector of file names found in the given directory with the given file extension

The documentation for this class was generated from the following files: