My Project
D:/source/c++/Programme/sally/sally/sallyAPI/FileHelper.h
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 #pragma once
00029 #include "Define.h"
00030 #include "FileActionController.h"
00031 #include "DateHelper.h"
00032 #include "PathHelper.h"
00033 #include "StringHelper.h"
00034 #include <string>
00035 #include <vector>
00036 #include <map>
00037 #include <sys/stat.h>
00038 #include <sys/types.h>
00039 
00040 namespace SallyAPI
00041 {
00042         namespace File
00043         {
00044                 enum DRIVE_TYPE {DRIVE_TYPE_UNKNOWN, DRIVE_TYPE_NO_ROOT_DIR, DRIVE_TYPE_REMOVABLE, DRIVE_TYPE_FIXED, DRIVE_TYPE_REMOTE, DRIVE_TYPE_CDROM, DRIVE_TYPE_RAMDISK, DRIVE_TYPE_DVDROM };
00045 
00054 
00055                 class DLL_API_SALLY FileHelper
00056                 {
00057                 private:
00058                         FileHelper();
00059                         ~FileHelper();
00060                 public:
00061                         static bool FileExists(std::string fileName);
00062                         static bool FileExistsAndNotEmpty(const std::string& fileName);
00063                         static std::vector<std::string> ReadFileToVector(const std::string& file, std::vector<std::string>* addToVector = NULL);
00064                         static bool AddLineToFile(const std::string& filePath, const std::string &line);
00065                         static std::string GetFormatedFileSize(const std::string& fileName);
00066                         static std::string GetFormatedFileCreateDate(const std::string& fileName);
00067                         static std::string GetFormatedFileAccessDate(const std::string& fileName);
00068                         static std::string GetFormatedFileWriteDate(const std::string& fileName);
00069                         static std::map<std::string, SallyAPI::File::DRIVE_TYPE> GetDriveList();
00070                         static bool IsDirectory(const std::string& filename);
00071                         static std::string FormatFileTime(FILETIME filetime);
00072                         static long CountFilesInFolder(const std::string& sourcePath, long fileCount = 0);
00073                         static bool FileAction(SallyAPI::File::CFileActionController* fileActionController, const std::string& sourcePath,
00074                                 const std::string& destinationPath);
00075                 };
00076         }
00077 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines