Rosetta  2020.11
 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::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...
 
FileNameoperator= (std::string const &name_string)
 String assignment. More...
 
 operator std::string () const
 String conversion. More...
 
FileNameoperator() (FileName const &name)
 Functor copy assignment. More...
 
FileNameoperator() (std::string const &name_string)
 Functor string assignment. More...
 
FileNamevol (std::string const &vol_a)
 Volume assignment. More...
 
FileNamevolume (std::string const &vol_a)
 Volume assignment. More...
 
FileNamepath (std::string const &path_a)
 Path assignment. More...
 
FileNamebase (std::string const &base_a)
 Base assignment. More...
 
FileNameext (std::string const &ext_a)
 Extension assignment. More...
 
FileNameextension (std::string const &ext_a)
 Extension assignment. More...
 
FileNameversion (std::string const &ver_a)
 Version assignment. More...
 
FileNamever (std::string const &ver_a)
 Version assignment. More...
 
FileNameto_local_name ()
 Change to local name (without volume or path) More...
 
FileNameto_bare_name ()
 Change to bare name (without volume or path or version) More...
 
FileNameerase ()
 Erase the file name. More...
 
FileNameclear ()
 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

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

Default constructor.

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

String constructor.

References assign().

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(), utility::file::PathName::path(), path(), utility::file::PathName::vol(), and vol().

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

FileName vector constructor.

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

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

Destructor.

Member Function Documentation

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

Absolute path?

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

Referenced by relative().

void utility::file::FileName::assign ( std::string const &  name_string)
private
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().

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

Base.

References base_.

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

Clear the file name.

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

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

Empty?

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

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

Erase the file name.

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

Referenced by FileName().

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

Extension assignment.

References ext_.

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

Extension.

References ext_.

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

Extension assignment.

References ext_.

Referenced by utility::filename().

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

Extension with separator.

References ext_.

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

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

Local name (without volume or path)

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

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

String conversion.

References name().

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

Functor copy assignment.

References operator=().

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

Functor string assignment.

References assign().

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

Functor.

References name().

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

String assignment.

References assign().

Referenced by operator()().

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

Path. Does not include final /.

References path_.

Referenced by FileName().

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

Relative path?

References absolute().

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

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

References path_, ver_, and vol_.

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

Change to local name (without volume or path)

References path_, and vol_.

Referenced by HBondReporter::load_job_data().

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

Version assignment.

References ver_.

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

Version.

References ver_.

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

Version assignment.

References ver_.

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

Version with separator.

References ver_.

Referenced by local_name(), and name().

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

Volume assignment.

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

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

Volume.

References vol_.

Referenced by FileName(), and volume().

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

Volume assignment.

References vol().

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

Volume.

References vol_.

Friends And Related Function Documentation

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

Output to stream.

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

Input from stream.

Member Data Documentation

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

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

Extension (without separator)

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

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

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

Version (without separator)

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

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: