Namespaces | Enumerations | Functions | Variables

src/Common/File/File.h File Reference

Go to the source code of this file.

Namespaces

namespace  AppSecInc
namespace  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.
std::wstring AppSecInc::File::GetTemporaryFileNameW ()
std::string AppSecInc::File::GetTemporaryDirectoryA ()
 Get the location of the temporary directory.
std::wstring AppSecInc::File::GetTemporaryDirectoryW ()
std::string AppSecInc::File::GetModuleFileNameA (HINSTANCE h=NULL)
 Get the full path to the module's filename.
std::wstring AppSecInc::File::GetModuleFileNameW (HINSTANCE h=NULL)
std::string AppSecInc::File::GetModuleDirectoryA ()
 Get the full path (directory) of the module's filename.
std::wstring AppSecInc::File::GetModuleDirectoryW ()
std::string AppSecInc::File::GetFileDirectoryA (const std::string &path)
 Get the directory portion of a full path.
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.
std::wstring AppSecInc::File::GetFileNameW (const std::wstring &path)
std::string AppSecInc::File::GetCurrentDirectoryA ()
 Get the current directory.
std::wstring AppSecInc::File::GetCurrentDirectoryW ()
bool AppSecInc::File::FileExists (const std::string &filename)
 Check whether a file exists.
bool AppSecInc::File::FileExists (const std::wstring &filename)
void AppSecInc::File::FileDelete (const std::string &filename)
 Delete a file.
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.
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.
bool AppSecInc::File::DirectoryExists (const std::wstring &path)
std::string AppSecInc::File::DirectoryCreate (const std::string &path)
 Create a directory.
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.
bool AppSecInc::File::DirectoryDelete (const std::wstring &path, int flags=DELETE_DIRECTORY_ALL)
long AppSecInc::File::GetFileSize (const std::wstring &filename)
 Get file size.
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.
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.
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.
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.
std::list< std::wstring > AppSecInc::File::GetFiles (const std::wstring &path_and_wildcard, int flags)
 Get a list of files in a directory structure.
std::list< std::wstring > AppSecInc::File::GetDirectoryFiles (const std::wstring &path, const std::wstring &wildcard=L"*.*")
 Get a list of file names in path.
void AppSecInc::File::ReadToEnd (const std::wstring &filename, std::wstring &data)
 Read the entire contents of file.
void AppSecInc::File::ReadToEnd (const std::wstring &filename, std::string &data)
 Read the entire contents of file.
void AppSecInc::File::ReadToEnd (const std::wstring &filename, std::vector< char > &data)
 Read the entire contents of file.
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.
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.
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.
std::string AppSecInc::File::GetParentDirectory (const std::string &path)
 Get the parent directory of a path.
std::wstring AppSecInc::File::GetParentDirectory (const std::wstring &path)
 Get the parent directory of a path.
std::wstring AppSecInc::File::GetSpecialFolderPath (int csidl, BOOL create=FALSE)
 Takes the CSIDL of a folder and returns the path.
bool AppSecInc::File::IsAbsolutePath (const std::wstring &path)
 returns true if provided path is absolute, false otherwise

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