Rosetta
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
utility::file::PathName Class Reference

Path name class supporting Windows and UN*X/Linux format names. More...

#include <PathName.hh>

Public Member Functions

 PathName ()
 Default constructor. More...
 
 PathName (std::string const &name_string)
 String constructor. More...
 
 ~PathName ()=default
 Destructor. More...
 
PathNameoperator= (std::string const &name_string)
 String assignment. More...
 
 operator std::string () const
 String conversion. More...
 
PathNameoperator() (PathName const &name)
 Functor copy assignment. More...
 
PathNameoperator() (std::string const &name_string)
 Functor string assignment. More...
 
PathNamevol (std::string const &vol_a)
 Volume assignment. More...
 
PathNamevolume (std::string const &vol_a)
 Volume assignment. More...
 
PathNamepath (std::string const &path_a)
 Path assignment. More...
 
PathNameerase ()
 Erase the path name. More...
 
PathNameclear ()
 Clear the path name. More...
 
PathName parent () const
 Returns the parent of this directory, or itself if no parent is available. More...
 
bool empty () const
 Empty? More...
 
bool absolute () const
 Absolute path? More...
 
bool relative () const
 Relative path? More...
 
std::string const & vol () const
 Volume. More...
 
std::string const & volume () const
 Volume. More...
 
std::string const & path () const
 Path. More...
 
std::string name () const
 Path name string. More...
 
std::string operator() () const
 Functor. More...
 

Private Member Functions

void assign (std::string const &name_string)
 Parse and assign a path name string. More...
 

Static Private Member Functions

static bool equal (PathName const &name1, PathName const &name2)
 PathNames equal on this platform? More...
 

Private Attributes

std::string vol_
 Volume (X:) (Windows only) More...
 
std::string path_
 Path (with trailing separator) More...
 

Friends

bool operator== (PathName const &name1, PathName const &name2)
 PathName == PathName. More...
 
bool operator!= (PathName const &name1, PathName const &name2)
 PathName != PathName. More...
 
bool operator< (PathName const &name1, PathName const &name2)
 PathName < PathName. More...
 
bool operator<= (PathName const &name1, PathName const &name2)
 PathName <= PathName. More...
 
bool operator>= (PathName const &name1, PathName const &name2)
 PathName >= PathName. More...
 
bool operator> (PathName const &name1, PathName const &name2)
 PathName > PathName. More...
 
std::istream & operator>> (std::istream &stream, PathName &name)
 Input from stream. More...
 
std::ostream & operator<< (std::ostream &stream, PathName const &name)
 Output to stream. More...
 

Detailed Description

Path name class supporting Windows and UN*X/Linux format names.

Constructor & Destructor Documentation

◆ PathName() [1/2]

utility::file::PathName::PathName ( )
inline

Default constructor.

◆ PathName() [2/2]

utility::file::PathName::PathName ( std::string const &  name_string)
inline

String constructor.

References assign().

◆ ~PathName()

utility::file::PathName::~PathName ( )
inlinedefault

Destructor.

Member Function Documentation

◆ absolute()

bool utility::file::PathName::absolute ( ) const

Absolute path?

References path_, and platform::file::PATH_SEPARATOR().

Referenced by relative().

◆ assign()

void utility::file::PathName::assign ( std::string const &  name_string)
private

Parse and assign a path name string.

References path_, platform::file::PATH_SEPARATOR(), binder::replace(), vol_, and platform::file::VOLUME_USED().

Referenced by operator()(), operator=(), and PathName().

◆ clear()

PathName& utility::file::PathName::clear ( )
inline

Clear the path name.

References path_, and vol_.

Referenced by pyrosetta.bindings.pose.ResidueLabelAccessor::discard().

◆ empty()

bool utility::file::PathName::empty ( ) const
inline

Empty?

References path_, and vol_.

◆ equal()

bool utility::file::PathName::equal ( PathName const &  name1,
PathName const &  name2 
)
staticprivate

PathNames equal on this platform?

References platform::file::CASE_SENSITIVE(), utility::file::equali(), path_, and vol_.

◆ erase()

PathName& utility::file::PathName::erase ( )
inline

Erase the path name.

References path_, and vol_.

◆ name()

std::string utility::file::PathName::name ( ) const
inline

◆ operator std::string()

utility::file::PathName::operator std::string ( ) const
inline

String conversion.

References name().

◆ operator()() [1/3]

std::string utility::file::PathName::operator() ( ) const
inline

Functor.

References name().

◆ operator()() [2/3]

PathName& utility::file::PathName::operator() ( PathName const &  name)
inline

Functor copy assignment.

References name(), and operator=().

◆ operator()() [3/3]

PathName& utility::file::PathName::operator() ( std::string const &  name_string)
inline

Functor string assignment.

References assign().

◆ operator=()

PathName& utility::file::PathName::operator= ( std::string const &  name_string)
inline

String assignment.

References assign().

Referenced by operator()().

◆ parent()

PathName utility::file::PathName::parent ( ) const

Returns the parent of this directory, or itself if no parent is available.

For relative paths, this will stop when it reaches the empty string – no "../" will be prepended to possibly go further up the directory tree.

References name(), path(), path_, and platform::file::PATH_SEPARATOR().

Referenced by utility::file::create_directory_recursive().

◆ path() [1/2]

std::string const& utility::file::PathName::path ( ) const
inline

◆ path() [2/2]

PathName & utility::file::PathName::path ( std::string const &  path_a)

◆ relative()

bool utility::file::PathName::relative ( ) const

Relative path?

References absolute().

◆ vol() [1/2]

std::string const& utility::file::PathName::vol ( ) const
inline

Volume.

References vol_.

Referenced by volume().

◆ vol() [2/2]

PathName & utility::file::PathName::vol ( std::string const &  vol_a)

Volume assignment.

References runtime_assert, vol_, and platform::file::VOLUME_USED().

Referenced by utility::file::FileName::FileName().

◆ volume() [1/2]

std::string const& utility::file::PathName::volume ( ) const
inline

Volume.

References vol_.

◆ volume() [2/2]

PathName& utility::file::PathName::volume ( std::string const &  vol_a)
inline

Volume assignment.

References vol().

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( PathName const &  name1,
PathName const &  name2 
)
friend

◆ operator<

bool operator< ( PathName const &  name1,
PathName const &  name2 
)
friend

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
PathName const &  name 
)
friend

Output to stream.

◆ operator<=

bool operator<= ( PathName const &  name1,
PathName const &  name2 
)
friend

◆ operator==

bool operator== ( PathName const &  name1,
PathName const &  name2 
)
friend

◆ operator>

bool operator> ( PathName const &  name1,
PathName const &  name2 
)
friend

◆ operator>=

bool operator>= ( PathName const &  name1,
PathName const &  name2 
)
friend

◆ operator>>

std::istream& operator>> ( std::istream &  stream,
PathName name 
)
friend

Input from stream.

Member Data Documentation

◆ path_

std::string utility::file::PathName::path_
private

Path (with trailing separator)

Referenced by absolute(), assign(), clear(), empty(), equal(), erase(), name(), parent(), and path().

◆ vol_

std::string utility::file::PathName::vol_
private

Volume (X:) (Windows only)

Referenced by assign(), clear(), empty(), equal(), erase(), name(), vol(), and volume().


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