Rosetta  2019.07
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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

Default constructor.

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

String constructor.

References assign().

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

Destructor.

Member Function Documentation

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

Absolute path?

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

Referenced by relative().

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

Clear the path name.

References path_, and vol_.

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

Empty?

References path_, and vol_.

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_.

Referenced by utility::file::operator!=(), and utility::file::operator==().

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

Erase the path name.

References path_, and vol_.

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

String conversion.

References name().

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

Functor copy assignment.

References operator=().

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

Functor string assignment.

References assign().

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

Functor.

References name().

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

String assignment.

References assign().

Referenced by operator()().

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().

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

Path.

References path_.

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

Relative path?

References absolute().

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().

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

Volume.

References vol_.

Referenced by volume().

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

Volume assignment.

References vol().

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

Volume.

References vol_.

Friends And Related Function Documentation

bool operator!= ( PathName const &  name1,
PathName const &  name2 
)
friend
bool operator< ( PathName const &  name1,
PathName const &  name2 
)
friend
std::ostream& operator<< ( std::ostream &  stream,
PathName const &  name 
)
friend

Output to stream.

bool operator<= ( PathName const &  name1,
PathName const &  name2 
)
friend
bool operator== ( PathName const &  name1,
PathName const &  name2 
)
friend
bool operator> ( PathName const &  name1,
PathName const &  name2 
)
friend
bool operator>= ( PathName const &  name1,
PathName const &  name2 
)
friend
std::istream& operator>> ( std::istream &  stream,
PathName name 
)
friend

Input from stream.

Member Data Documentation

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

Path (with trailing separator)

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

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: