File indexing completed on 2026-06-02 08:43:50
0001 #ifndef FILE_UTILS_H
0002 #define FILE_UTILS_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <fstream> // needed
0013 #include <iostream>
0014 #include <string>
0015 #include <vector>
0016
0017
0018
0019
0020 namespace ElemUtils {
0021
0022
0023
0024
0025
0026
0027 class FileUtils {
0028 public:
0029
0030 static bool isReadable(const std::string & filePath);
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 static bool open(std::ofstream &fileOutputStream,
0042 const std::string & filePath,
0043 const std::ios_base::openmode &openMode = std::ios_base::out
0044 | std::ios_base::trunc);
0045 static void writeAndFlush(std::ofstream & fileOutputStream,
0046 const std::string & str);
0047 static void write(std::ofstream& fileOutputStream, const std::string& str);
0048 static void flush(std::ofstream& fileOutputStream);
0049
0050 static void close(std::ofstream & fileOutputStream);
0051
0052
0053
0054 static std::string read(const std::string & filePath);
0055 static std::vector<std::string> readByLine(const std::string & filePath);
0056 static std::ifstream::pos_type getFileSize(const std::string & filetPath);
0057
0058 static bool remove(const std::string &filePath);
0059 }
0060 ;
0061
0062 }
0063
0064 #endif