Namespaces | Enumerations | Functions | Variables
File.h File Reference

Go to the source code of this file.

Namespaces

 AppSecInc
 
 AppSecInc::File
 Win32 File support functions.
 

Enumerations

enum  AppSecInc::File::DELETE_DIRECTORY_FLAGS {
  AppSecInc::File::DELETE_DIRECTORY_FILES = 1, AppSecInc::File::DELETE_DIRECTORY_FOLDERS = 2, AppSecInc::File::DELETE_DIRECTORY_SUBDIRECTORIES = 4, AppSecInc::File::DELETE_DIRECTORY_EMPTY = DELETE_DIRECTORY_FOLDERS | DELETE_DIRECTORY_SUBDIRECTORIES,
  AppSecInc::File::DELETE_DIRECTORY_ALL = DELETE_DIRECTORY_FILES | DELETE_DIRECTORY_FOLDERS | DELETE_DIRECTORY_SUBDIRECTORIES
}
 
enum  AppSecInc::File::FILESIZE_STRING_TYPE {
  AppSecInc::File::FILESIZE_AUTO = 0, AppSecInc::File::FILESIZE_BYTES = 2, AppSecInc::File::FILESIZE_KBYTES = 3, AppSecInc::File::FILESIZE_MBYTES = 4,
  AppSecInc::File::FILESIZE_GBYTES = 5
}
 
enum  AppSecInc::File::GET_FILES_FLAGS { AppSecInc::File::GET_FILES_FILES = 1, AppSecInc::File::GET_FILES_DIRECTORIES = 2, AppSecInc::File::GET_FILES_RECURSIVE = 4, AppSecInc::File::GET_FILES_ALL = GET_FILES_FILES | GET_FILES_DIRECTORIES | GET_FILES_RECURSIVE }
 

Functions

std::string AppSecInc::File::GetTemporaryFileNameA ()
 Create a temporary file and return its name. More...
 
std::wstring AppSecInc::File::GetTemporaryFileNameW ()
 
std::string AppSecInc::File::GetTemporaryDirectoryA ()
 Get the location of the temporary directory. More...
 
std::wstring AppSecInc::File::GetTemporaryDirectoryW ()
 
std::string AppSecInc::File::GetModuleFileNameA (HINSTANCE h=NULL)
 Get the full path to the module's filename. More...
 
std::wstring AppSecInc::File::GetModuleFileNameW (HINSTANCE h=NULL)
 
std::string AppSecInc::File::GetModuleDirectoryA ()
 Get the full path (directory) of the module's filename. More...
 
std::wstring AppSecInc::File::GetModuleDirectoryW ()
 
std::string AppSecInc::File::GetFileDirectoryA (const std::string &path)
 Get the directory portion of a full path. More...
 
std::wstring AppSecInc::File::GetFileDirectoryW (const std::wstring &path)
 
std::string AppSecInc::File::GetFileNameA (const std::string &path)
 Get the filename portion of a full path. More...
 
std::wstring AppSecInc::File::GetFileNameW (const std::wstring &path)
 
std::string AppSecInc::File::GetCurrentDirectoryA ()
 Get the current directory. More...
 
std::wstring AppSecInc::File::GetCurrentDirectoryW ()
 
bool AppSecInc::File::FileExists (const std::string &filename)
 Check whether a file exists. More...
 
bool AppSecInc::File::FileExists (const std::wstring &filename)
 
void AppSecInc::File::FileDelete (const std::string &filename)
 Delete a file. More...
 
void AppSecInc::File::FileDelete (const std::wstring &filename)
 
void AppSecInc::File::FileCopy (const std::string &src, const std::string &dest, bool overwrite=true)
 Copy a file. More...
 
void AppSecInc::File::FileCopy (const std::wstring &src, const std::wstring &dest, bool overwrite=true)
 
bool AppSecInc::File::DirectoryExists (const std::string &path)
 Check whether a directory exists. More...
 
bool AppSecInc::File::DirectoryExists (const std::wstring &path)
 
std::string AppSecInc::File::DirectoryCreate (const std::string &path)
 Create a directory. More...
 
std::wstring AppSecInc::File::DirectoryCreate (const std::wstring &path)
 
bool AppSecInc::File::DirectoryDelete (const std::string &path, int flags=DELETE_DIRECTORY_ALL)
 Delete a directory. More...
 
bool AppSecInc::File::DirectoryDelete (const std::wstring &path, int flags=DELETE_DIRECTORY_ALL)
 
long AppSecInc::File::GetFileSize (const std::wstring &filename)
 Get file size. More...
 
long AppSecInc::File::GetFileSize (const std::string &filename)
 
std::pair< std::string,
std::string > 
AppSecInc::File::SizeToStringPairA (long size, FILESIZE_STRING_TYPE type=FILESIZE_AUTO, int precision=0)
 Convert a file size into a pair of strings. More...
 
std::pair< std::wstring,
std::wstring > 
AppSecInc::File::SizeToStringPairW (long size, FILESIZE_STRING_TYPE type=FILESIZE_AUTO, int precision=0)
 
std::string AppSecInc::File::SizeToStringA (long size, FILESIZE_STRING_TYPE type=FILESIZE_AUTO, int precision=0)
 Convert a file size into a string. More...
 
std::wstring AppSecInc::File::SizeToStringW (long size, FILESIZE_STRING_TYPE type=FILESIZE_AUTO, int precision=0)
 
std::wstring AppSecInc::File::DirectoryCombine (const std::wstring &dir, const std::wstring &file)
 Combine two directory paths and an optional file. More...
 
std::list< std::wstring > AppSecInc::File::GetFiles (const std::wstring &path, const std::wstring &wildcard=L"*.*", int flags=GET_FILES_FILES)
 Get a list of files in a directory structure. More...
 
std::list< std::wstring > AppSecInc::File::GetFiles (const std::wstring &path_and_wildcard, int flags)
 Get a list of files in a directory structure. More...
 
std::list< std::wstring > AppSecInc::File::GetDirectoryFiles (const std::wstring &path, const std::wstring &wildcard=L"*.*")
 Get a list of file names in path. More...
 
void AppSecInc::File::ReadToEnd (const std::wstring &filename, std::wstring &data)
 Read the entire contents of file. More...
 
void AppSecInc::File::ReadToEnd (const std::wstring &filename, std::string &data)
 Read the entire contents of file. More...
 
void AppSecInc::File::ReadToEnd (const std::wstring &filename, std::vector< char > &data)
 Read the entire contents of file. More...
 
bool AppSecInc::File::ReadAndConvertToEnd (const std::wstring &filename, std::wstring &data)
 Read the entire contents of file and convert to UNICODE depending on the file marker. More...
 
void AppSecInc::File::FileWrite (const std::wstring &filename, const std::vector< char > &data, DWORD dwShareMode=GENERIC_READ|GENERIC_WRITE, DWORD dwCreationDisposition=CREATE_ALWAYS, DWORD dwFlagsAndAttributes=FILE_ATTRIBUTE_NORMAL)
 Write data to a file. More...
 
void AppSecInc::File::FileCreate (const std::wstring &filename, DWORD dwShareMode=GENERIC_READ|GENERIC_WRITE, DWORD dwCreationDisposition=CREATE_ALWAYS, DWORD dwFlagsAndAttributes=FILE_ATTRIBUTE_NORMAL)
 Create an empty file. More...
 
std::string AppSecInc::File::GetParentDirectory (const std::string &path)
 Get the parent directory of a path. More...
 
std::wstring AppSecInc::File::GetParentDirectory (const std::wstring &path)
 Get the parent directory of a path. More...
 
std::wstring AppSecInc::File::GetSpecialFolderPath (int csidl, BOOL create=FALSE)
 Takes the CSIDL of a folder and returns the path. More...
 
bool AppSecInc::File::IsAbsolutePath (const std::wstring &path)
 returns true if provided path is absolute, false otherwise More...
 

Variables

const long AppSecInc::File::BYTE = 1
 
const long AppSecInc::File::KBYTE = BYTE * 1024
 
const long AppSecInc::File::MBYTE = KBYTE * 1024
 
const long AppSecInc::File::GBYTE = MBYTE * 1024
 


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com