Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members

FileManager Class Reference

File management. More...

#include <FileManager.h>

List of all members.

Public Member Functions

bool isDirectory (const std::string &aDir)
 Check if a directory exists.
bool isFile (const std::string &aFilePath)
 Check if a file exists.
bool createDirectory (const std::string &aDir)
 Create a directory if it doesn't exists.
bool copyFileToDir (const std::string &aFrom, const std::string &aDir)
 Copy a file to a directory.
bool copyFile (const std::string &aFrom, const std::string &aTo)
 Copy a file from a path to another.
bool deleteFile (const std::string &aPath)
 Delete a file.
bool moveFile (const std::string &aFrom, const std::string &aTo)
 Move a file from a path to another.
bool displayFile (const std::string &aPath)
 Display the content of file.
std::string getFileNameFromPath (const std::string &aPath)
 Extract the fileName of a path.
std::string removeFirstDirFromPath (std::string &aPath)
 Extract the first dir of the directory path.
int noCaseComp (const std::string &s1, const std::string &s2)
 Compare 2 string case insensitive.
bool isTheSameFile (const std::string &aFile, const std::string &aAnotherFile)
 Check if a file is the same than an other.
bool fileExistsInDirectory (const std::string &aFileName, const std::string &aDirPath)
 Check if the same file already exists in a specified directory.


Detailed Description

File management.

Author:
Vincent JOUSSE
Version:
1.0
This class is a wrapper of the NSPR C functions. Only needed methods are implemented


Member Function Documentation

bool FileManager::copyFile const std::string &  aFrom,
const std::string &  aTo
 

Copy a file from a path to another.

Parameters:
aFrom The source path
aTo The destination path
Returns:
True if success, false otherwise

bool FileManager::copyFileToDir const std::string &  aFrom,
const std::string &  aDir
 

Copy a file to a directory.

Parameters:
aFrom The file source path
aDir The destination directory
Returns:
True if success, false otherwise

bool FileManager::createDirectory const std::string &  aDir  ) 
 

Create a directory if it doesn't exists.

Parameters:
aDir The path of the directory to create
Returns:
True if success, false otherwise

bool FileManager::deleteFile const std::string &  aPath  ) 
 

Delete a file.

Parameters:
aPath Path of the file to delete
Returns:
True if success, false otherwise

bool FileManager::displayFile const std::string &  aPath  ) 
 

Display the content of file.

Just used for tests

bool FileManager::fileExistsInDirectory const std::string &  aFileName,
const std::string &  aDirPath
 

Check if the same file already exists in a specified directory.

Parameters:
aFilePath Path of the file to check
aDirPath Name of the directory in wich we check if the file exists

std::string FileManager::getFileNameFromPath const std::string &  aPath  ) 
 

Extract the fileName of a path.

Returns:
The name of the file

bool FileManager::isDirectory const std::string &  aDir  ) 
 

Check if a directory exists.

Parameters:
aDir The path of the directory to check
Returns:
True if it exists, false otherwise

bool FileManager::isFile const std::string &  aFilePath  ) 
 

Check if a file exists.

Parameters:
aFilePath The path of the file to check
Returns:
True if it exists, false otherwise

bool FileManager::isTheSameFile const std::string &  aFile,
const std::string &  aAnotherFile
 

Check if a file is the same than an other.

The comparison is based on the name (case sensitive or not) and the size of the file

Parameters:
aFile First file to compare
aAnotherFile Second file to compare to

bool FileManager::moveFile const std::string &  aFrom,
const std::string &  aTo
 

Move a file from a path to another.

Parameters:
aFrom The source path
aTo The destination path
Returns:
True if success, false otherwise

int FileManager::noCaseComp const std::string &  s1,
const std::string &  s2
 

Compare 2 string case insensitive.

Parameters:
s1 A string to compare
21 The second string to compare
Returns:
0 if the strings are equal, -1 if size1<size2, 1 if size1>size2

std::string FileManager::removeFirstDirFromPath std::string &  aPath  ) 
 

Extract the first dir of the directory path.

Becareful, the aPath string is modified, the dir returned is erase from it

Returns:
The dir extracted


The documentation for this class was generated from the following file:
Generated on Fri May 19 23:15:28 2006 for k10-agent by  doxygen 1.4.4