Initial commit
This commit is contained in:
41
TestGenerator/src/file_utils.h
Normal file
41
TestGenerator/src/file_utils.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef FILE_UTILS_H
|
||||
#define FILE_UTILS_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// File utility functions
|
||||
class FileUtils {
|
||||
public:
|
||||
// Read entire file content
|
||||
static std::string readFile(const std::string& filepath);
|
||||
|
||||
// Write content to file
|
||||
static bool writeFile(const std::string& filepath, const std::string& content);
|
||||
|
||||
// Check if file exists
|
||||
static bool fileExists(const std::string& filepath);
|
||||
|
||||
// Create directory if it doesn't exist (recursive)
|
||||
static bool createDirectory(const std::string& dirpath);
|
||||
|
||||
// Delete all files in a directory
|
||||
static bool cleanDirectory(const std::string& dirpath);
|
||||
|
||||
// Join paths with proper separators
|
||||
static std::string joinPath(const std::string& path1, const std::string& path2);
|
||||
|
||||
// Get files in directory matching pattern
|
||||
static std::vector<std::string> listFiles(const std::string& dirpath, const std::string& extension = "");
|
||||
|
||||
// Replace all occurrences in string
|
||||
static std::string replaceAll(const std::string& str, const std::string& from, const std::string& to);
|
||||
|
||||
// Trim whitespace from string
|
||||
static std::string trim(const std::string& str);
|
||||
|
||||
// Split string by delimiter
|
||||
static std::vector<std::string> split(const std::string& str, char delimiter);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user