UtiLite  0.3.1
A lite utilities library
Public Member Functions | Static Public Member Functions
UFile Class Reference

#include <UFile.h>

List of all members.

Public Member Functions

 UFile (const std::string &path)
bool isValid ()
bool exists ()
long length ()
int rename (const std::string &newName)
std::string getName ()
std::string getExtension ()
void copy (const std::string &to)

Static Public Member Functions

static bool exists (const std::string &filePath)
static long length (const std::string &filePath)
static int erase (const std::string &filePath)
static int rename (const std::string &oldFilePath, const std::string &newFilePath)
static std::string getName (const std::string &filePath)
static std::string getExtension (const std::string &filePath)
static void copy (const std::string &from, const std::string &to)

Detailed Description

Class UFile.

This class can be used to modify/erase files on hard drive.


Constructor & Destructor Documentation

UFile::UFile ( const std::string &  path) [inline]

Create a UFile object with path initialized to an existing file .

Parameters:
paththe path to an existing file

Member Function Documentation

void UFile::copy ( const std::string &  from,
const std::string &  to 
) [static]

Copy a file.

Parameters:
fromthe file path
todestination file path
void UFile::copy ( const std::string &  to) [inline]

Copy a file.

Parameters:
todestination file path
int UFile::erase ( const std::string &  filePath) [static]

Erase a file.

Parameters:
filePaththe file path
Returns:
0 if success.
bool UFile::exists ( const std::string &  filePath) [static]

Check if a file exists.

Parameters:
filePaththe file path
Returns:
true if the file exists, otherwise false.
bool UFile::exists ( ) [inline]

Check if the file exists.

Returns:
true if the path exits
std::string UFile::getExtension ( const std::string &  filePath) [static]

Get the file extension.

Returns:
the file extension
std::string UFile::getExtension ( ) [inline]

Get the file extension.

Returns:
the file extension
std::string UFile::getName ( const std::string &  filePath) [static]

Get the file name from a file path (with extension).

Parameters:
filePaththe file path
Returns:
the file name.
std::string UFile::getName ( ) [inline]

Get the file name without the path.

Returns:
the file name
bool UFile::isValid ( ) [inline]

Check if the file exists. Same as exists().

Returns:
true if the path exits
long UFile::length ( const std::string &  filePath) [static]

Get the file length.

Parameters:
filePaththe file path
Returns:
long the length of the file in bytes. Return -1 if the file doesn't exist.
long UFile::length ( ) [inline]

Get the length of the file.

Returns:
long the length of the file in bytes. Return -1 if the file doesn't exist.
int UFile::rename ( const std::string &  oldFilePath,
const std::string &  newFilePath 
) [static]

Rename a file.

Parameters:
oldFilePaththe old file path
newFilePaththe new file path
Returns:
0 if success.
int UFile::rename ( const std::string &  newName) [inline]

Rename the file name. The path stays the same.

Parameters:
thenew name

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