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
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef __CXUTILS_FILE_IO_H
00041 #define __CXUTILS_FILE_IO_H
00042
00043 #include <vector>
00044 #include <string>
00045 #include <fstream>
00046 #include "cxbase.h"
00047
00048 namespace CxUtils
00049 {
00057 class CX_UTILS_DLL FileIO
00058 {
00059 public:
00060 static int CreateDir(const std::string& fname);
00061 static int DeleteDir(const std::string& fname);
00062 static int DeleteFiles(const std::string& fname);
00063 static int DeleteFiles(const std::vector<std::string>& files);
00064 static int GetPath(const std::string& src, std::string& path);
00065 static int GetFiles(std::vector<std::string>& files,
00066 const std::string& ext = "*.*",
00067 const std::string& path = "",
00068 const bool extractPath = true,
00069 const bool recursive = false);
00070 static int GetDirectories(std::vector<std::string>& dirs,
00071 const std::string& path,
00072 const bool extractPath = false);
00073 static int GetFilesAndDirectories(std::vector<std::string>& files,
00074 const std::string& path = "",
00075 const bool extractPath = true);
00076 static FILE* Open(const std::string& name, const std::string& mode = "wt");
00077 static bool IsDir(const std::string& path);
00078 static int RenameFile(const std::string& originalName, const std::string& newName);
00079 static int CopyFileTo(const std::string& existingFile, const std::string& newFile);
00080 static unsigned int GetFileSizeBytes(const std::string& fileName);
00081 static unsigned int ParseDelimitedLine(FILE* fp,
00082 std::vector<std::string>& columns,
00083 const char delimiter = ',',
00084 const char end = '\n',
00085 const bool skipBlankEntriesFlag = true);
00086 static unsigned int ReadLine(FILE* fp, std::string& line);
00087 static unsigned int ReadLine(std::fstream& str, std::string& line);
00088 static std::vector<std::string> Tokenize(const std::string& str,
00089 const std::string& delimter);
00090 static bool FileExists(const std::string& fname);
00091 };
00092 }
00093
00094 #endif
00095