DotNameLib
Loading...
Searching...
No Matches
IPathResolver.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <filesystem>
5#include <string>
6#include <vector>
7
8namespace dotnamecpp::utils {
9
16 public:
17 virtual ~IPathResolver() = default;
18
25 [[nodiscard]]
27 getAbsolutePath(const std::filesystem::path &path) const = 0;
28
35 [[nodiscard]]
37 getCanonicalPath(const std::filesystem::path &path) const = 0;
38
46 [[nodiscard]]
48 const std::filesystem::path &target,
49 const std::filesystem::path &base = std::filesystem::current_path()) const = 0;
50
58 [[nodiscard]]
59 virtual bool isAbsolute(const std::filesystem::path &path) const = 0;
60
68 [[nodiscard]]
69 virtual bool isRelative(const std::filesystem::path &path) const = 0;
70
77 [[nodiscard]]
78 virtual std::filesystem::path getParent(const std::filesystem::path &path) const = 0;
79
86 [[nodiscard]]
87 virtual std::string getFilename(const std::filesystem::path &path) const = 0;
88
95 [[nodiscard]]
96 virtual std::string getExtension(const std::filesystem::path &path) const = 0;
97
104 [[nodiscard]]
105 virtual std::string getStem(const std::filesystem::path &path) const = 0;
106
113 [[nodiscard]]
114 virtual std::filesystem::path join(const std::vector<std::string> &parts) const = 0;
115 };
116
117} // namespace dotnamecpp::utils
Interface for path resolution and manipulation.
Definition IPathResolver.hpp:15
virtual bool isRelative(const std::filesystem::path &path) const =0
Check if path is relative.
virtual Result< std::filesystem::path, FileError > getAbsolutePath(const std::filesystem::path &path) const =0
Get the Absolute Path object.
virtual std::string getExtension(const std::filesystem::path &path) const =0
Get the Extension object.
virtual std::string getFilename(const std::filesystem::path &path) const =0
Get the Filename object.
virtual ~IPathResolver()=default
virtual std::string getStem(const std::filesystem::path &path) const =0
Get the Stem object.
virtual std::filesystem::path join(const std::vector< std::string > &parts) const =0
Join multiple path components.
virtual Result< std::filesystem::path, FileError > getRelativePath(const std::filesystem::path &target, const std::filesystem::path &base=std::filesystem::current_path()) const =0
Get the Relative Path object.
virtual Result< std::filesystem::path, FileError > getCanonicalPath(const std::filesystem::path &path) const =0
Get the Canonical Path object.
virtual bool isAbsolute(const std::filesystem::path &path) const =0
Check if path is absolute.
virtual std::filesystem::path getParent(const std::filesystem::path &path) const =0
Get the Parent object.
Definition UtilsError.hpp:93
Definition DirectoryManager.cpp:5