19 Path(
const std::string& path);
21 Path(
const char* path);
24 static std::string
strip(
const std::string& str);
74 std::vector<std::string>
split()
const;
182 operator std::string_view()
const;
184 bool operator==(std::string_view other)
const;
185 bool operator!=(std::string_view other)
const;
191std::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:213
Path makeRelative() const
Converts an absolute path to relative, stripping the root character.
Definition Path.cpp:199
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:94
bool hasPrefix(const Path &prefix) const
Checks if the Path has any additional prefixes.
Definition Path.cpp:249
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:141
Path makeAbsolute() const
Converts a relative path to absolute, adding a root character.
Definition Path.cpp:206
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:92
Path append(const enzo::Path &path) const
Returns a new path formed by appending the given path to this one.
Definition Path.cpp:163
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:118
static bool isValidComponent(const std::string &component)
Checks whether a single path component is a name or the ".." parent step.
Definition Path.cpp:57
Path getParent() const
Returns the parent path as a Path if it exists.
Definition Path.cpp:105
static bool isValidFormatting(const std::string &pathString)
Checks the path to make sure it fits the alphanumeric guidelines.
Definition Path.cpp:62
bool isRelative() const
Returns true if the Path is a relative path.
Definition Path.cpp:42
Path makeAbsoluteFrom(const Path &anchor) const
Returns the absolute path this one names when read from an anchor.
Definition Path.cpp:227
const std::string & getString() const
Return the path of the Path as an std::string.
Definition Path.cpp:161
virtual Path increment(int increment=1) const
Increments the numerical suffix of the path's name by a given amount.
Definition Path.cpp:178