Public Member Functions | Static Public Member Functions

CdcFileUtil Class Reference

This class defines some file utilities. More...

#include <DcFileUtil.h>

List of all members.

Public Member Functions

 CdcFileUtil ()
 Constructor - empty.
virtual ~CdcFileUtil ()
 Destructor - empty.
bool OpenFile (const CdcString &file_name)
 Load File info from file system.
CdcHttpTime GetFileLastModified (bool gmt)
 Returns the file last-modified time.
int GetFileSize ()
 Returns the file size in bytes.

Static Public Member Functions

static CdcString GetProgramPath ()
 Static function to return the path where the application is running.
static CdcString GetWorkPath (const CdcString &path)
 Returns the working path of this program.
static t_files_vector GetAllFilesInDir (const CdcString &dir_path, const CdcString &file_ext)
 This static function return a vector with all files (with specific extension) in a directory.

Detailed Description

This class defines some file utilities.

I need it to be OS Independent. Getting information about the file is a non-static operation. The first query about file info will get the file info from the file system. Then any query will just returns info from the same structure.

In addition I have here: Get a list of files in a directory - static. Get the run-time path - static.

Author:
Erez Bibi
Version:
1.0

Definition at line 47 of file DcFileUtil.h.


Constructor & Destructor Documentation

CdcFileUtil::CdcFileUtil (  ) [inline]

Constructor - empty.

Definition at line 64 of file DcFileUtil.h.

virtual CdcFileUtil::~CdcFileUtil (  ) [inline, virtual]

Destructor - empty.

Definition at line 69 of file DcFileUtil.h.


Member Function Documentation

t_files_vector CdcFileUtil::GetAllFilesInDir ( const CdcString dir_path,
const CdcString file_ext 
) [static]

This static function return a vector with all files (with specific extension) in a directory.

Parameters:
dir_pathThe path to the directory to scan.
file_extThe extension of the files to get. '*' will return all files.

Definition at line 76 of file DcFileUtil.cpp.

CdcHttpTime CdcFileUtil::GetFileLastModified ( bool  gmt )

Returns the file last-modified time.

Parameters:
gmtTrue if need time in GMT form.

Definition at line 36 of file DcFileUtil.cpp.

int CdcFileUtil::GetFileSize (  )

Returns the file size in bytes.

Definition at line 45 of file DcFileUtil.cpp.

CdcString CdcFileUtil::GetProgramPath (  ) [static]

Static function to return the path where the application is running.

This function will check for the program path just once!

Definition at line 55 of file DcFileUtil.cpp.

CdcString CdcFileUtil::GetWorkPath ( const CdcString path ) [static]

Returns the working path of this program.

If the path supplied as parameter is not an absolute path, it returns the base path + the parameter path. Otherwise it just returns the path without changing it.

Parameters:
pathThe path to add the work path to.
Returns:
(CdcString) The compleate absolute path.

Definition at line 67 of file DcFileUtil.cpp.

bool CdcFileUtil::OpenFile ( const CdcString file_name )

Load File info from file system.

Parameters:
file_nameThe file name and path.

Definition at line 29 of file DcFileUtil.cpp.


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