class FileCache { public: FileCache(std::string_view path); FileCache(FileCache&) = delete; FileCache& operator=(FileCache&) = delete; ~FileCache() = default; void CacheFile(std::string_view path, bool ignoreExtInFileName = false); std::filesystem::path FilePath() const; std::filesystem::path DirPath() const; std::string DirName() const; std::string FileName() const; std::string Extenstion() const; // Helper Functions void SetFilePath(const std::filesystem::path& newPath); void SetFileDir(const std::string& newDir); void SetFileName(const std::string& newName); void SetExtension(const std::string& newExt); protected: std::filesystem::path filePath; std::string fileDir; std::string fileName; std::string extension; std::filesystem::path dirPath; };
| Public Functions | |||||
|---|---|---|---|---|---|
|
FileCache(std::string_view path);
This is the only constructor available for this class.
|
|||||
| void |
CacheFile(std::string_view path, bool
ignoreExtInFileName=false);
This function is called in the FileCache constructor and is used to break the path up into
parts to store.
|
||||
| std::filesystem::path |
FilePath() const
This function returns the file path that was cached as a std::filesystem::path object.
|
||||
| std::filesystem::path |
DirPath() const;
This function returns the log directory path that was cached as a std::filesystem::path
object.
|
||||
| std::string |
DirName() const;
This function returns the log directory name that was cached as a std::string object.
|
||||
| std::string |
FileName() const;
This function returns the file name that was cached as a std::string object.
|
||||
| std::string |
Extenstion() const;
This function returns the extension format that was cached as a std::string object.
|
||||
| void |
SetFilePath(const std::filesystem::path&
newPath);
This is a helper function that simply sets the member variable `filePath` to what `newPath` is without changing anything else.
|
||||
| void |
SetFileDir(const std::string& newDir);
This is a helper function that simply sets the member variable `fileDir` to what `newDir` is without changing anything else..
|
||||
| void |
SetFileName(const std::string& newName);
This is a helper function that simply sets the member variable `fileName` to what `newName` is without changing anything else.
|
||||
| void |
SetExtension(const std::string& newExt);
This is a helper function that simply sets the member variable `extension` to what `newExt` is without changing anything else.
|
||||
| FileCache(std::string_view path); |
|---|
|
This is the only constructor available for this class.
It passes the `path` parameter into CacheFile() for caching with the default value of `ignoreExtInFileName`. Essentially calling: CacheFile(path, false); |
| void CacheFile(std::string_view path, bool ignoreExtInFileName = false); |
|
This function is called in the FileCache constructor.
This function does the following:
|
| std::filesystem::path FilePath() const; |
| This function returns the file path that was cached as a std::filesystem::path object. |
| std::filesystem::path DirPath() const; |
| This function returns the directory path that was cached as a std::filesystem::path object. |
| std::string DirName() const; |
| This function returns the log directory folder name that was cached as a std::string. |
| std::string FileName() const; |
| This function returns the log file's name that was cached as a std::string. |
| std::string Extenstion() const; |
| This function returns the log file's extension that was cached as a std::string. |
| void SetFilePath(const std::filesystem::path& newPath); |
| This is a helper function that simply sets the member variable `filePath` to what `newPath` is without changing anything else. |
| void SetFileDir(const std::string& newDir); |
| This is a helper function that simply sets the member variable `fileDir` to what `newDir` is without changing anything else. |
| void SetFileName(const std::string& newName); |
| This is a helper function that simply sets the member variable `fileName` to what `newName` is without changing anything else. |
| void SetExtension(const std::string& newExt); |
| This is a helper function that simply sets the member variable `extension` to what `newExt` is without changing anything else. |