Enzo
Loading...
Searching...
No Matches
enzo::NetworkPath Class Reference

A path that references a network entity, either a node or a parameter on a node. More...

#include <NetworkPath.h>

Inheritance diagram for enzo::NetworkPath:
enzo::Path

Public Member Functions

 NetworkPath ()=default
 Constructs an empty NetworkPath.
 
 NetworkPath (const std::string &path)
 Constructs a NetworkPath from a given std::string.
 
 NetworkPath (const char *path)
 Constructs a NetworkPath from a C string.
 
bool isValid () const override
 Runs every validation check and returns true if the path is a valid node or parameter reference.
 
bool hasParameter () const
 Checks whether the path carries a parameter component.
 
std::string getParameter () const
 Returns the parameter name, or an empty string when the path references a node.
 
NetworkPath getNode () const
 Returns the node portion of the path with any parameter removed.
 
- Public Member Functions inherited from enzo::Path
 Path ()
 Constructs an empty enzo::Path object.
 
 Path (const std::string &path)
 Constructs an enzo::Path object from a given std::string.
 
 Path (const char *path)
 Constructs an enzo::Path object from a C string.
 
bool isEmpty () const
 Checks if the Path has no characters.
 
bool isRoot () const
 Returns true if the Path is "/".
 
bool isAbsolute () const
 Returns true if the Path is an absolute path.
 
bool isRelative () const
 Returns true if the Path is a relative path.
 
std::string getName () const
 Returns the name of the Path, ie, the last component of the path.
 
Path getParent () const
 Returns the parent path as a Path if it exists.
 
std::vector< PathgetPrefixes () const
 Returns every ancestor path leading up to this path, ordered from shortest to longest. The path itself is not included.
 
std::vector< std::string > split () const
 Splits all of the components of a Path and returns them as a vector of strings.
 
const std::string & getString () const
 Return the path of the Path as an std::string.
 
Path append (const enzo::Path &path) const
 Returns a new path formed by appending the given path to this one.
 
virtual Path increment (int increment=1) const
 Increments the numerical suffix of the path's name by a given amount.
 
Path makeRelative () const
 Converts an absolute path to relative, stripping the root character.
 
Path makeAbsolute () const
 Converts a relative path to absolute, adding a root character.
 
Path makeRelativeTo (const Path &anchor) const
 Makes a path relative to a given anchor path.
 
bool hasPrefix (const Path &prefix) const
 Checks if the Path has any additional prefixes.
 
 operator std::string_view () const
 Allows a Path to be viewed as its underlying string, e.g. for comparisons against string_views.
 
bool operator== (std::string_view other) const
 
bool operator!= (std::string_view other) const
 

Static Public Member Functions

static bool isValidFormatting (const std::string &pathString)
 Checks whether a string is a valid node or parameter reference.
 
- Static Public Member Functions inherited from enzo::Path
static std::string strip (const std::string &str)
 Returns the string with surrounding whitespace removed.
 
static bool isValidFormatting (const std::string &pathString)
 Checks the path to make sure it fits the alphanumeric guidelines.
 
static bool isValidName (const std::string &name)
 Checks the given name to make sure it fits the alphanumeric guidelines.
 

Additional Inherited Members

- Protected Attributes inherited from enzo::Path
std::string path_
 

Detailed Description

A path that references a network entity, either a node or a parameter on a node.

A node is written as a plain path. A parameter adds a "." and the parameter name onto the final component of an otherwise ordinary node path.

Examples "/geo/mesh" references a node "/geo/mesh.tx" references the "tx" parameter on that node

Member Function Documentation

◆ getNode()

NetworkPath enzo::NetworkPath::getNode ( ) const

Returns the node portion of the path with any parameter removed.

A path that already references a node returns an equivalent copy.

E.g. "/geo/mesh.tx" returns "/geo/mesh"

◆ isValid()

bool enzo::NetworkPath::isValid ( ) const
overridevirtual

Runs every validation check and returns true if the path is a valid node or parameter reference.

The node portion follows the same component rules as Path and the optional parameter must be a valid name.

See also
Path::isValidName for the per component character rules.

Reimplemented from enzo::Path.

◆ isValidFormatting()

bool enzo::NetworkPath::isValidFormatting ( const std::string & pathString)
static

Checks whether a string is a valid node or parameter reference.

Parameters
pathStringA std::string representation of the path.
Returns
true when the node portion and any parameter are both valid.

The documentation for this class was generated from the following files: