* added FileManager that keeps track of the files analyzed by the project. It therefore checks if files get added, updated or deleted from the source- and include folders. * refactored ASTVisitor::hasValidLocation() and implemented one version that search for the location in the currently parsed file and one that searches in all the project's source files. * quickfix: switched order in FileManager so that header files are parsed first. * created folder for helper classes used in tests. * added test code for FileManager * adjusted test code for Parser Tests.
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#ifndef FILE_SYSTEM_H
|
|
#define FILE_SYSTEM_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "utility/file/FileInfo.h"
|
|
|
|
class FileSystem
|
|
{
|
|
public:
|
|
static std::vector<std::string> getFileNamesFromDirectory(
|
|
const std::string& path, const std::vector<std::string>& extensions);
|
|
static std::vector<std::string> getFileNamesFromDirectoryUpdatedAfter(
|
|
const std::string& path, const std::vector<std::string>& extensions, const std::string& timeString);
|
|
|
|
static std::vector<FileInfo> getFileInfosFromDirectoryPaths(
|
|
const std::vector<std::string>& directoryPaths, const std::vector<std::string>& fileExtensions);
|
|
|
|
static std::string getTimeStringNow();
|
|
|
|
static bool exists(const std::string& path);
|
|
static std::string fileName(const std::string& path);
|
|
static std::string extension(const std::string& path);
|
|
static std::string filePathWithoutExtension(const std::string& path);
|
|
static std::string absoluteFilePath(const std::string& path);
|
|
|
|
static bool equivalent(const std::string& pathA, const std::string& pathB);
|
|
|
|
private:
|
|
static bool isValidExtension(const std::string& filepath, const std::vector<std::string>& extensions);
|
|
};
|
|
|
|
#endif // FILE_SYSTEM_H
|