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

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

#include <FileName.hh>

Public Member Functions

 FileName ()
 Default constructor. More...
 
 FileName (std::string const &name_string)
 String constructor. More...
 
 FileName (std::string const &name_string, PathName const &use_path)
 Uses filename from string but path and vol from PathName. More...
 
 FileName (std::vector< FileName > const &file_names)
 FileName vector constructor. More...
 
 ~FileName ()=default
 Destructor. More...
 
FileName & operator= (std::string const &name_string)
 String assignment. More...
 
 operator std::string () const
 String conversion. More...
 
FileName & operator() (FileName const &name)
 Functor copy assignment. More...
 
FileName & operator() (std::string const &name_string)
 Functor string assignment. More...
 
FileName & vol (std::string const &vol_a)
 Volume assignment. More...
 
FileName & volume (std::string const &vol_a)
 Volume assignment. More...
 
FileName & path (std::string const &path_a)
 Path assignment. More...
 
FileName & base (std::string const &base_a)
 Base assignment. More...
 
FileName & ext (std::string const &ext_a)
 Extension assignment. More...
 
FileName & extension (std::string const &ext_a)
 Extension assignment. More...
 
FileName & version (std::string const &ver_a)
 Version assignment. More...
 
FileName & ver (std::string const &ver_a)
 Version assignment. More...
 
FileName & to_local_name ()
 Change to local name (without volume or path) More...
 
FileName & to_bare_name ()
 Change to bare name (without volume or path or version) More...
 
FileName & erase ()
 Erase the file name. More...
 
FileName & clear ()
 Clear the file name. 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. Does not include final /. More...
 
std::string const & base () const
 Base. More...
 
std::string const & ext () const
 Extension. More...
 
std::string extension () const
 Extension with separator. More...
 
std::string const & ver () const
 Version. More...
 
std::string version () const
 Version with separator. More...
 
std::string name () const
 File name string. More...
 
std::string operator() () const
 Functor. More...
 
std::string local_name () const
 Local name (without volume or path) More...
 
std::string bare_name () const
 Bare name (without volume or path or version) More...
 

Private Member Functions

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

Static Private Member Functions

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

Private Attributes

std::string vol_
 Volume (X:) (Windows only) More...
 
std::string path_
 Path (with trailing separator) More...
 
std::string base_
 Base name (without path or extension or version) More...
 
std::string ext_
 Extension (without separator) More...
 
std::string ver_
 Version (without separator) More...
 

Friends

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

Detailed Description

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

Constructor & Destructor Documentation

◆ FileName() [1/4]

utility::file::FileName::FileName ( )
inline

Default constructor.

◆ FileName() [2/4]

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

String constructor.

References assign().

◆ FileName() [3/4]

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

Uses filename from string but path and vol from PathName.

References assign(), path(), utility::file::PathName::path(), vol(), and utility::file::PathName::vol().

◆ FileName() [4/4]

utility::file::FileName::FileName ( std::vector< FileName > const &  file_names)
inline

FileName vector constructor.

References base_, begin, erase(), ext_, path_, ver_, and vol_.

◆ ~FileName()

utility::file::FileName::~FileName ( )
inlinedefault

Destructor.

Member Function Documentation

◆ absolute()

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

Absolute path?

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

Referenced by relative().

◆ assign()

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

Parse and assign a file name string.

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

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

◆ bare_name()

std::string utility::file::FileName::bare_name ( ) const
inline

Bare name (without volume or path or version)

References base_, and extension().

Referenced by basic::database::full_cache_name(), and main().

◆ base() [1/2]

std::string const& utility::file::FileName::base ( ) const
inline

Base.

References base_.

◆ base() [2/2]

FileName& utility::file::FileName::base ( std::string const &  base_a)
inline

◆ clear()

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

Clear the file name.

References base_, ext_, path_, ver_, and vol_.

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

◆ empty()

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

Empty?

References base_, ext_, path_, ver_, and vol_.

◆ equal()

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

FileNames equal on this platform?

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

◆ erase()

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

Erase the file name.

References base_, ext_, path_, ver_, and vol_.

Referenced by FileName().

◆ ext() [1/2]

std::string const& utility::file::FileName::ext ( ) const
inline

Extension.

References ext_.

◆ ext() [2/2]

FileName& utility::file::FileName::ext ( std::string const &  ext_a)
inline

Extension assignment.

References ext_.

Referenced by main().

◆ extension() [1/2]

std::string utility::file::FileName::extension ( ) const
inline

Extension with separator.

References ext_.

Referenced by bare_name(), local_name(), and name().

◆ extension() [2/2]

FileName& utility::file::FileName::extension ( std::string const &  ext_a)
inline

Extension assignment.

References ext_.

◆ local_name()

std::string utility::file::FileName::local_name ( ) const
inline

Local name (without volume or path)

References base_, extension(), and version().

◆ name()

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

◆ operator std::string()

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

◆ operator()() [1/3]

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

Functor.

References name().

◆ operator()() [2/3]

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

Functor copy assignment.

References name(), and operator=().

◆ operator()() [3/3]

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

Functor string assignment.

References assign().

◆ operator=()

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

String assignment.

References assign().

Referenced by operator()().

◆ path() [1/2]

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

◆ path() [2/2]

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

◆ relative()

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

Relative path?

References absolute().

◆ to_bare_name()

FileName& utility::file::FileName::to_bare_name ( )
inline

Change to bare name (without volume or path or version)

References path_, ver_, and vol_.

◆ to_local_name()

FileName& utility::file::FileName::to_local_name ( )
inline

Change to local name (without volume or path)

References path_, and vol_.

Referenced by HBondReporter::apply(), and HBondReporter::load_job_data().

◆ ver() [1/2]

std::string const& utility::file::FileName::ver ( ) const
inline

Version.

References ver_.

◆ ver() [2/2]

FileName& utility::file::FileName::ver ( std::string const &  ver_a)
inline

Version assignment.

References ver_.

◆ version() [1/2]

std::string utility::file::FileName::version ( ) const
inline

Version with separator.

References ver_.

Referenced by pyrosetta.EnergyMethod::__call__(), local_name(), and name().

◆ version() [2/2]

FileName& utility::file::FileName::version ( std::string const &  ver_a)
inline

Version assignment.

References ver_.

Referenced by pyrosetta.EnergyMethod::__call__().

◆ vol() [1/2]

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

Volume.

References vol_.

Referenced by FileName(), and volume().

◆ vol() [2/2]

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

Volume assignment.

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

◆ volume() [1/2]

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

Volume.

References vol_.

◆ volume() [2/2]

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

Volume assignment.

References vol().

Friends And Related Function Documentation

◆ operator!=

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

◆ operator<

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

◆ operator<<

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

Output to stream.

◆ operator<=

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

◆ operator==

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

◆ operator>

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

◆ operator>=

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

◆ operator>>

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

Input from stream.

Member Data Documentation

◆ base_

std::string utility::file::FileName::base_
private

Base name (without path or extension or version)

Referenced by assign(), bare_name(), base(), clear(), empty(), equal(), erase(), FileName(), local_name(), and name().

◆ ext_

std::string utility::file::FileName::ext_
private

Extension (without separator)

Referenced by assign(), clear(), empty(), equal(), erase(), ext(), extension(), and FileName().

◆ path_

std::string utility::file::FileName::path_
private

Path (with trailing separator)

Referenced by absolute(), assign(), clear(), empty(), equal(), erase(), FileName(), name(), path(), to_bare_name(), and to_local_name().

◆ ver_

std::string utility::file::FileName::ver_
private

Version (without separator)

Referenced by assign(), clear(), empty(), equal(), erase(), FileName(), to_bare_name(), ver(), and version().

◆ vol_

std::string utility::file::FileName::vol_
private

Volume (X:) (Windows only)

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


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