MEPP2 Project
|
Functions | |
std::string | get_file_extension (const std::string &file_name) |
std::string | get_file_extension (const char *file_name) |
bool | has_extension (const std::string &file_name) |
bool | has_extension (const char *file_name) |
bool | has_extension (const std::string &file_name, const std::string &ext_name, bool case_sensitive=false) |
bool | has_extension (const char *file_name, const char *ext_name, bool case_sensitive=false) |
bool | has_extension (const std::string &file_name, const std::vector< std::string > &ext_names, bool case_sensitive=false) |
std::string | get_file_name (const std::string &file_name) |
std::string | get_file_name (const char *file_name) |
std::string | get_file_full_name (const std::string &file_name) |
unsigned int | count_file_lines (const std::string &file_name) |
unsigned int | count_file_lines (const char *file_name) |
std::string | get_parent_directory (const std::string &file_name) |
std::ifstream & | safe_getline (std::ifstream &input, std::string &str) |
bool | getline_skip_comment (std::istream &input, std::string &line) |
bool | getline_skip_comment (std::istream &input, std::string &line, std::istringstream &line_ss) |
void | copy_file (const std::string &from, const std::string &to) |
void | create_dir (const std::string &dirname) |
void | remove_dir (const std::string &dirname) |
std::string | get_wdir (void) |
void | change_wdir (const std::string &dirname) |
std::string | load_file (const std::string &file_name) |
|
inline |
Change the current working directory.
dir_path | the path/name of the directory |
Definition at line 338 of file FileUtilities.hpp.
|
inline |
Copy a file. Display a warning if destination file exists and do not overwrite it.
from | the name of the file to be copied |
to | the name of the target file |
Definition at line 281 of file FileUtilities.hpp.
|
inline |
Returns the number of lines in the file.
Definition at line 180 of file FileUtilities.hpp.
|
inline |
Returns the number of lines in the file.
Definition at line 163 of file FileUtilities.hpp.
|
inline |
Create a directory.
dir_path | the path/name of the directory |
Definition at line 301 of file FileUtilities.hpp.
|
inline |
Returns the file name extension or an empty string if the file name has no extension.
Definition at line 47 of file FileUtilities.hpp.
|
inline |
Returns the file name extension or an empty string if the file name has no extension.
Definition at line 36 of file FileUtilities.hpp.
|
inline |
Returns the file name with no path. Example: for '/path/foo.bar', returns 'foo.bar'.
Definition at line 152 of file FileUtilities.hpp.
|
inline |
Returns the file name with no path and no extension. Example: for '/path/foo.bar', returns 'foo'.
Definition at line 141 of file FileUtilities.hpp.
|
inline |
Returns the file name with no path and no extension. Example: for '/path/foo.bar', returns 'foo'.
Definition at line 128 of file FileUtilities.hpp.
|
inline |
Returns the file path. Example: for '/dir1/dir2/foo.bar', returns '/dir1/dir2'.
Definition at line 191 of file FileUtilities.hpp.
|
inline |
Get the current working directory.
Definition at line 325 of file FileUtilities.hpp.
|
inline |
Get a line from the input stream skipping any commented or empty line. To be used in the same way as std::getline(stream, string).
input | the input stream to read from |
line | the string that will be filled with the line being read |
Definition at line 230 of file FileUtilities.hpp.
|
inline |
Get a line from the input stream skipping any commented line. To be used in the same way as std::getline(stream, string).
input | the input stream to read from |
line | the string that will be filled with the line being read |
line_ss | the stringstream based on the read line |
Definition at line 260 of file FileUtilities.hpp.
|
inline |
Returns true if the file name has an extension, aka ends up with '.something'.
Definition at line 69 of file FileUtilities.hpp.
|
inline |
Returns true if the file name ends up with the provided extension.
Definition at line 99 of file FileUtilities.hpp.
|
inline |
Returns true if the file name has an extension, aka ends up with '.something'.
Definition at line 58 of file FileUtilities.hpp.
|
inline |
Returns true if the file name ends up with the provided extension.
Definition at line 79 of file FileUtilities.hpp.
|
inline |
Returns true if the file name ends up with one of the provided extensions.
Definition at line 112 of file FileUtilities.hpp.
|
inline |
Load a whole file into a string.
file_name | the name of the file to read. |
Definition at line 354 of file FileUtilities.hpp.
|
inline |
Remove a directory and its content.
dir_path | the path/name of the directory |
Definition at line 314 of file FileUtilities.hpp.
|
inline |
Get a line from the file and fix DOS end of line extra character if any. To be used in the same way as std::getline(stream, string).
input | the file-stream to read from |
str | the string that will be filled with the line being read |
Definition at line 208 of file FileUtilities.hpp.