19 Path(
const std::string& path);
21 Path(
const char* path);
24 static std::string
strip(
const std::string& str);
72 std::vector<std::string>
split()
const;
157 operator std::string_view()
const;
159 bool operator==(std::string_view other)
const;
160 bool operator!=(std::string_view other)
const;
166std::ostream& operator<<(std::ostream& os,
const enzo::Path& other);
A default path class for creation and manipulation of tree-based paths.
Definition Path.h:14
Path makeRelativeTo(const Path &anchor) const
Makes a path relative to a given anchor path.
Definition Path.cpp:205
Path makeRelative() const
Converts an absolute path to relative, stripping the root character.
Definition Path.cpp:191
static std::string strip(const std::string &str)
Returns the string with surrounding whitespace removed.
Definition Path.cpp:25
std::string getName() const
Returns the name of the Path, ie, the last component of the path.
Definition Path.cpp:89
bool hasPrefix(const Path &prefix) const
Checks if the Path has any additional prefixes.
Definition Path.cpp:219
bool isAbsolute() const
Returns true if the Path is an absolute path.
Definition Path.cpp:40
static bool isValidName(const std::string &name)
Checks the given name to make sure it fits the alphanumeric guidelines.
Definition Path.cpp:44
std::vector< Path > getPrefixes() const
Returns every ancestor path leading up to this path, ordered from shortest to longest....
Definition Path.cpp:136
Path makeAbsolute() const
Converts a relative path to absolute, adding a root character.
Definition Path.cpp:198
bool isEmpty() const
Checks if the Path has no characters.
Definition Path.cpp:36
Path()
Constructs an empty enzo::Path object.
Definition Path.cpp:6
virtual bool isValid() const
Runs every validation check and returns true if the path is fully valid.
Definition Path.cpp:87
Path append(const enzo::Path &path) const
Returns a new path formed by appending the given path to this one.
Definition Path.cpp:158
bool isRoot() const
Returns true if the Path is "/".
Definition Path.cpp:38
std::vector< std::string > split() const
Splits all of the components of a Path and returns them as a vector of strings.
Definition Path.cpp:113
Path getParent() const
Returns the parent path as a Path if it exists.
Definition Path.cpp:100
static bool isValidFormatting(const std::string &pathString)
Checks the path to make sure it fits the alphanumeric guidelines.
Definition Path.cpp:57
bool isRelative() const
Returns true if the Path is a relative path.
Definition Path.cpp:42
const std::string & getString() const
Return the path of the Path as an std::string.
Definition Path.cpp:156
virtual Path increment(int increment=1) const
Increments the numerical suffix of the path's name by a given amount.
Definition Path.cpp:170