TC::File Namespace Reference
[IO Classes and Functions]

Provides functions to get/create/set file information. More...


Classes

struct  FileInfo
class  Progress

Enumerations

enum  FileAttributes {
  FILEATTR_OWNER_WRITE = 0x00000001,
  FILEATTR_OWNER_READ = 0x00000002,
  FILEATTR_OWNER_EXEC = 0x00000004,
  FILEATTR_GROUP_WRITE = 0x00000008,
  FILEATTR_GROUP_READ = 0x00000010,
  FILEATTR_GROUP_EXEC = 0x00000020,
  FILEATTR_EVERYONE_WRITE = 0x00000040,
  FILEATTR_EVERYONE_READ = 0x00000080,
  FILEATTR_EVERYONE_EXEC = 0x00000100,
  FILEATTR_READONLY = 0x00000200,
  FILEATTR_ARCHIVE = 0x00000400,
  FILEATTR_SYSTEM = 0x00000800,
  FILEATTR_HIDDEN = 0x00001000,
  FILEATTR_WRITE = 0x00002000,
  FILEATTR_EXECUTE = 0x00004000
}

Functions

bool Exists (const std::string &file)
 return if file or directory exists
bool IsFile (const std::string &file)
 return if its a file
bool IsDirectory (const std::string &file)
 return if file is a directory
bool IsReadable (const std::string &file)
 return if the files/directory readable
bool IsWriteable (const std::string &file)
 return if the files/directory writeable
bool IsExecutable (const std::string &file)
 return if the files/directory executable
bool SetFileAttr (const std::string &file, uint32 attr)
 Change the mode flags for this file.
uint64 GetFileSize (const std::string &file)
 Get file size.
sint64 GetModificationTime (const std::string &file)
 returns time file was last modified
sint64 GetLastAccessTime (const std::string &file)
 returns time file was last accessed
sint64 GetCreationTime (const std::string &file)
 returns time when created
sint64 GetTouchedTime (const std::string &file)
 returns time when touched
std::string GetFileUser (const std::string &file)
 get name of file user
std::string GetFileGroup (const std::string &file)
 get name of file group
bool ChangeDirectory (const std::string &directoryIn)
 change to specified directory
std::string GetDirectory ()
 returns current directory
std::vector< std::string > GetFileListOfDirectory (const std::string &searchDirectory, const std::string &searchExtension="")
 returns all files with specified extension
void GetFileInfosOfDirectory (std::vector< FileInfo > &file_infos, const std::string &searchDirectory, const std::string &searchExtension="")
bool Create (const std::string &file, bool removeOld=true)
 create a empty file
bool Remove (const std::string &file)
 remove specified file
bool Copy (const std::string &source, const std::string &dest, SharedPtr< Progress > copy_status=SharedPtr< Progress >())
 copy source file to destination file
bool Move (const std::string &source, const std::string &dest)
 move source file to destination file
bool CreateDirectory (const std::string &path)
 create a directory
bool CreateDirectoryRecursive (const std::string &path)
 create a directory also if one of the parent directories does not exist


Detailed Description

Provides functions to get/create/set file information.


Enumeration Type Documentation

Enumerator:
FILEATTR_OWNER_WRITE 
FILEATTR_OWNER_READ 
FILEATTR_OWNER_EXEC 
FILEATTR_GROUP_WRITE 
FILEATTR_GROUP_READ 
FILEATTR_GROUP_EXEC 
FILEATTR_EVERYONE_WRITE 
FILEATTR_EVERYONE_READ 
FILEATTR_EVERYONE_EXEC 
FILEATTR_READONLY 
FILEATTR_ARCHIVE 
FILEATTR_SYSTEM 
FILEATTR_HIDDEN 
FILEATTR_WRITE 
FILEATTR_EXECUTE 

Definition at line 63 of file TCFile.h.


Function Documentation

bool TC::File::Exists ( const std::string &  file  ) 

return if file or directory exists

bool TC::File::IsFile ( const std::string &  file  ) 

return if its a file

bool TC::File::IsDirectory ( const std::string &  file  ) 

return if file is a directory

bool TC::File::IsReadable ( const std::string &  file  ) 

return if the files/directory readable

bool TC::File::IsWriteable ( const std::string &  file  ) 

return if the files/directory writeable

bool TC::File::IsExecutable ( const std::string &  file  ) 

return if the files/directory executable

bool TC::File::SetFileAttr ( const std::string &  file,
uint32  attr 
)

Change the mode flags for this file.

uint64 TC::File::GetFileSize ( const std::string &  file  ) 

Get file size.

sint64 TC::File::GetModificationTime ( const std::string &  file  ) 

returns time file was last modified

sint64 TC::File::GetLastAccessTime ( const std::string &  file  ) 

returns time file was last accessed

sint64 TC::File::GetCreationTime ( const std::string &  file  ) 

returns time when created

sint64 TC::File::GetTouchedTime ( const std::string &  file  ) 

returns time when touched

std::string TC::File::GetFileUser ( const std::string &  file  ) 

get name of file user

std::string TC::File::GetFileGroup ( const std::string &  file  ) 

get name of file group

bool TC::File::ChangeDirectory ( const std::string &  directoryIn  ) 

change to specified directory

std::string TC::File::GetDirectory (  ) 

returns current directory

std::vector<std::string> TC::File::GetFileListOfDirectory ( const std::string &  searchDirectory,
const std::string &  searchExtension = "" 
)

returns all files with specified extension

void TC::File::GetFileInfosOfDirectory ( std::vector< FileInfo > &  file_infos,
const std::string &  searchDirectory,
const std::string &  searchExtension = "" 
)

bool TC::File::Create ( const std::string &  file,
bool  removeOld = true 
)

create a empty file

bool TC::File::Remove ( const std::string &  file  ) 

remove specified file

bool TC::File::Copy ( const std::string &  source,
const std::string &  dest,
SharedPtr< Progress >  copy_status = SharedPtr< Progress >() 
)

copy source file to destination file

bool TC::File::Move ( const std::string &  source,
const std::string &  dest 
)

move source file to destination file

bool TC::File::CreateDirectory ( const std::string &  path  ) 

create a directory

bool TC::File::CreateDirectoryRecursive ( const std::string &  path  ) 

create a directory also if one of the parent directories does not exist


Copyright (c) Thomas Goessler 2003 - 2008