AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::Path Class Reference

Path class for performing basic path operations with a user-selectable delimiter character. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/src/axom/core/Path.hpp>

Public Member Functions

 Path (const std::string &path, const char delim='/')
 Constructs a path from a string. More...
 
 Path ()=default
 Default constructor for an empty path. More...
 
 operator std::string () const
 Converts a path to a string. More...
 
Path parent () const
 Returns a path representing the parent of the calling path If the calling path is the root, the root will be returned. More...
 
std::string baseName () const
 Returns the basename of the path (the last component) More...
 
std::string dirName () const
 Returns dirname of the path (all but the last component) More...
 
std::pair< std::string, std::string > split () const
 Splits the path into the "parent" (dirname) and the last component (basename) More...
 
const std::vector< std::string > & parts () const
 Returns a const reference to the parts of the path, to be iterated over. More...
 

Static Public Member Functions

static Path join (std::initializer_list< Path > paths, const char delim='/')
 Constructs a path by concatenating a set of paths. More...
 

Detailed Description

Path class for performing basic path operations with a user-selectable delimiter character.

Constructor & Destructor Documentation

◆ Path() [1/2]

axom::Path::Path ( const std::string &  path,
const char  delim = '/' 
)

Constructs a path from a string.

Parameters
[in]pathThe string representing the path
[in]delimThe character that delimits the path

Empty parts in path are removed

FIXME: Should this be marked explicit ?

◆ Path() [2/2]

axom::Path::Path ( )
default

Default constructor for an empty path.

Member Function Documentation

◆ join()

static Path axom::Path::join ( std::initializer_list< Path paths,
const char  delim = '/' 
)
static

Constructs a path by concatenating a set of paths.

Parameters
[in]pathsThe paths to concatenate/join
[in]delimThe character to join the paths with TODO: Should this be something easier-to-use, like the delimiter used by the first Path object in the list?

Empty paths ins paths will be ignored.

Returns
The joined paths

◆ operator std::string()

axom::Path::operator std::string ( ) const

Converts a path to a string.

FIXME: Should this be marked explicit ?

◆ parent()

Path axom::Path::parent ( ) const

Returns a path representing the parent of the calling path If the calling path is the root, the root will be returned.

◆ baseName()

std::string axom::Path::baseName ( ) const

Returns the basename of the path (the last component)

See also
basename(3)

◆ dirName()

std::string axom::Path::dirName ( ) const

Returns dirname of the path (all but the last component)

See also
dirname(3)

◆ split()

std::pair<std::string, std::string> axom::Path::split ( ) const

Splits the path into the "parent" (dirname) and the last component (basename)

Returns
A pair {dirname, basename}

◆ parts()

const std::vector<std::string>& axom::Path::parts ( ) const
inline

Returns a const reference to the parts of the path, to be iterated over.


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