Fawkes API
Fawkes Development Version
|
#include <utils/system/file.h>
Public Types | |
enum | FileOpenMethod { OVERWRITE, APPEND, ADD_SUFFIX } |
What to do when a file with the same name already exists. More... | |
Public Member Functions | |
File (const char *filename, FileOpenMethod method=APPEND) | |
Constructor. | |
~File () | |
Destructor. | |
FILE * | stream () const |
Get access to the file stream. | |
const char * | filename () const |
Get the file's name. | |
Static Public Member Functions | |
static bool | exists (const char *filename) |
Check if a file exists. | |
static bool | is_regular (const char *filename) |
Check if a file is a regular file. |
File utility methods.
Allows for opening a file and provides utilities to check if a file exists or whether it is a regular file (and not a symbolic link/directory).
fawkes::File::File | ( | const char * | filename, |
FileOpenMethod | method = APPEND |
||
) |
Constructor.
Independent of the FileOpenMethod files are created with permissions 660
filename | the filename |
method | the method determines what is done if a file with the specified name already exists |
Definition at line 71 of file file.cpp.
References OVERWRITE, APPEND, ADD_SUFFIX, and exists().
bool fawkes::File::exists | ( | const char * | filename | ) | [static] |
const char * fawkes::File::filename | ( | ) | const |
bool fawkes::File::is_regular | ( | const char * | filename | ) | [static] |
Check if a file is a regular file.
filename | the name of the file to check |
Definition at line 160 of file file.cpp.
Referenced by fawkes::ModuleDL::open().
FILE * fawkes::File::stream | ( | ) | const |
Get access to the file stream.
Definition at line 129 of file file.cpp.
Referenced by fawkes::FileLogger::log_debug(), fawkes::FileLogger::log_info(), fawkes::FileLogger::log_warn(), fawkes::FileLogger::log_error(), fawkes::FileLogger::vlog_debug(), fawkes::FileLogger::vlog_info(), fawkes::FileLogger::vlog_warn(), fawkes::FileLogger::vlog_error(), fawkes::FileLogger::tlog_debug(), fawkes::FileLogger::tlog_info(), fawkes::FileLogger::tlog_warn(), fawkes::FileLogger::tlog_error(), fawkes::FileLogger::vtlog_debug(), fawkes::FileLogger::vtlog_info(), fawkes::FileLogger::vtlog_warn(), and fawkes::FileLogger::vtlog_error().