You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
//
// Created by zhaohe on 19-5-31.
//
#pragma once
#include <pthread.h>
#include <unistd.h>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include "iflytopcpp/core/spdlogfactory/logger.hpp"
namespace iflytop { namespace core { using namespace std;
class FileUtils { ENABLE_LOGGER(FileUtils);
public: // judegefile
bool exist(const string &path); bool isDirectory(const string &path); // bool delFile(const string &filePath);
// mkfile
bool makeDirIfNoExist(const string &path); // readfile
string readFileAsString(const string &filePath); std::vector<char> readFileAsBuffer(const string &filePath); // write file
bool writeToFile(const string &fileName, const string &buf); bool writeToFile(const string &fileName, const char *buf, size_t size);
shared_ptr<ofstream> openTrunc(const string &fileName);
// filename operat
// bool getRepetitionFileName(string fileName, string suffix, string &outfilename, int maxNum = -1);
// bool getRepetitionDirName(string fileName, string &outfilename, int maxNum = -1);
}; } // namespace core
} // namespace iflytop
|