Rosetta 3.3
Classes | Functions
utility::file Namespace Reference

Classes

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

Functions

bool file_exists (std::string const &path)
 Does File Exist?
int file_delete (std::string const &path)
 Delete File.
std::string file_extension (std::string const &filename)
 Extension of a File Name.
std::string file_basename (std::string const &filename)
 Basename of a File Name.
long file_size (std::string const &filename)
 Platform independent way of getting file size.
bool create_blank_file (std::string const &blank_file)
 Create a blank file if it doesn't already exist.
bool create_directory (std::string const &dir_path)
 Create a directory if it doesn't already exist.
bool create_directory_recursive (std::string const &dir_path)
 Create a directory and its parent directories if they doesn't already exist.
bool trytry_ifstream_open (std::ifstream &ifstream_, std::string const &name, std::ios_base::openmode open_mode)
 Try to open file a few times just in case it is locked (from BOINC LIB)
bool trytry_ofstream_open (std::ofstream &ofstream_, std::string const &name, std::ios_base::openmode open_mode)
 Try to open file a few times just in case it is locked (from BOINC LIB)
int list_dir (std::string dir, utility::vector1< std::string > &files)
FileName combine_names (std::vector< std::string > file_name_strings)
std::istream & operator>> (std::istream &stream, FileName &name)
 Input from stream.
std::ostream & operator<< (std::ostream &stream, FileName const &name)
 Output to stream.
bool char_equali (char c, char d)
 Characters equal case-insensitively?
bool equali (std::string const &s, std::string const &t)
 Strings equal case-insensitively?
bool operator== (FileName const &name1, FileName const &name2)
 FileName == FileName.
bool operator!= (FileName const &name1, FileName const &name2)
 FileName != FileName.
bool operator< (FileName const &name1, FileName const &name2)
 FileName < FileName.
bool operator<= (FileName const &name1, FileName const &name2)
 FileName <= FileName.
bool operator>= (FileName const &name1, FileName const &name2)
 FileName >= FileName.
bool operator> (FileName const &name1, FileName const &name2)
 FileName > FileName.
long gzip (std::string const &uncompressedfile, bool overwrite)
 gzip: file compression
long gunzip (std::string const &compressedfile, bool overwrite)
 gunzip: file decompression
std::istream & operator>> (std::istream &stream, PathName &name)
 Input from stream.
std::ostream & operator<< (std::ostream &stream, PathName const &name)
 Output to stream.
bool operator== (PathName const &name1, PathName const &name2)
 PathName == PathName.
bool operator!= (PathName const &name1, PathName const &name2)
 PathName != PathName.
bool operator< (PathName const &name1, PathName const &name2)
 PathName < PathName.
bool operator<= (PathName const &name1, PathName const &name2)
 PathName <= PathName.
bool operator>= (PathName const &name1, PathName const &name2)
 PathName >= PathName.
bool operator> (PathName const &name1, PathName const &name2)
 PathName > PathName.

Function Documentation

bool utility::file::char_equali ( char  c,
char  d 
) [inline]

Characters equal case-insensitively?

Referenced by equali().

FileName utility::file::combine_names ( std::vector< std::string >  file_name_strings)

References begin.

bool utility::file::create_blank_file ( std::string const &  blank_file)
bool utility::file::create_directory ( std::string const &  dir_path)

Create a directory if it doesn't already exist.

Code is based on a discussion on this web site:

http://www.brainbell.com/tutorials/C++/Creating_A_Directory.htm

On non-Windows systems, the permissions are solely determined by the umask. If directory creation is successful, the function returns true.

Currently untested on Windows! If you find it works, remove this warning. Thanks. ***

Referenced by create_directory_recursive(), and RunPepSpec().

bool utility::file::create_directory_recursive ( std::string const &  dir_path)

Create a directory and its parent directories if they doesn't already exist.

Based on the above create_directory() function. If directory creation is successful or the directory already exists, the function returns true.

Currently untested on Windows! If you find it works, remove this warning. Thanks. ***

References create_directory(), utility::file::PathName::name(), utility::file::PathName::parent(), and loops_kic::success.

bool utility::file::equali ( std::string const &  s,
std::string const &  t 
) [inline]

Strings equal case-insensitively?

References char_equali(), and ObjexxFCL::equal().

std::string utility::file::file_basename ( std::string const &  filename)

Basename of a File Name.

Prefix of a file name.

References utility::filename().

Referenced by composite_sequences_from_cmd_line(), poses_from_cmd_line(), and sequences_from_cmd_line().

int utility::file::file_delete ( std::string const &  path)

Delete File.

Delete file.

References utility::drand(), file_exists(), color_pdb::i, and utility::sys_sleep().

Referenced by gunzip(), gzip(), and main().

bool utility::file::file_exists ( std::string const &  path)
std::string utility::file::file_extension ( std::string const &  filename)

Extension of a File Name.

Extension of a file name.

Referenced by gunzip(), gzip(), utility::io::ozstream::open(), utility::io::izstream::open(), and utility::io::ozstream::open_append().

long utility::file::file_size ( std::string const &  filename)
long utility::file::gunzip ( std::string const &  compressedfile,
bool  overwrite 
)
long utility::file::gzip ( std::string const &  uncompressedfile,
bool  overwrite 
)
int utility::file::list_dir ( std::string  dir,
utility::vector1< std::string > &  files 
)
bool utility::file::operator!= ( FileName const &  name1,
FileName const &  name2 
)
bool utility::file::operator!= ( PathName const &  name1,
PathName const &  name2 
)
bool utility::file::operator< ( FileName const &  name1,
FileName const &  name2 
)
bool utility::file::operator< ( PathName const &  name1,
PathName const &  name2 
)
std::ostream& utility::file::operator<< ( std::ostream &  stream,
FileName const &  name 
)

Output to stream.

References utility::file::FileName::name().

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

Output to stream.

References utility::file::PathName::name().

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

Input from stream.

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

Input from stream.

bool utility::file::trytry_ifstream_open ( std::ifstream &  ifstream_,
std::string const &  name,
std::ios_base::openmode  open_mode 
)

Try to open file a few times just in case it is locked (from BOINC LIB)

Try to open file for read a few times just in case it is locked (from BOINC LIB)

References utility::drand(), file_exists(), color_pdb::i, basic::options::OptionKeys::in::in, and utility::sys_sleep().

Referenced by file_size(), gzip(), and utility::io::izstream::open().

bool utility::file::trytry_ofstream_open ( std::ofstream &  ofstream_,
std::string const &  name,
std::ios_base::openmode  open_mode 
)

Try to open file a few times just in case it is locked (from BOINC LIB)

Try to open file for write a few times just in case it is locked (from BOINC LIB)

References utility::drand(), file_exists(), color_pdb::i, basic::options::OptionKeys::in::in, and utility::sys_sleep().

Referenced by create_blank_file(), gunzip(), utility::io::ozstream::open(), and utility::io::ozstream::open_append().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines