LogCabin
|
A File object is just a wrapper around a file descriptor; it represents either an open file, an open directory, or an empty placeholder. More...
#include <FilesystemUtil.h>
Public Member Functions | |
File () | |
Default constructor. | |
File (File &&other) | |
Move constructor. | |
File (int fd, std::string path) | |
Constructor. | |
~File () | |
Destructor. | |
File & | operator= (File &&other) |
Move assignment. | |
void | close () |
Close the file. | |
int | release () |
Disassociate the file descriptor from this object. | |
File (const File &) | |
File & | operator= (const File &) |
Public Attributes | |
int | fd |
The open file descriptor, or -1 otherwise. | |
std::string | path |
The path used to open fd, or empty. |
A File object is just a wrapper around a file descriptor; it represents either an open file, an open directory, or an empty placeholder.
It takes charge of closing the file descriptor when it is done and tracks the path used to open the file descriptor in order to provide useful error messages.
Definition at line 44 of file FilesystemUtil.h.
Default constructor.
Definition at line 38 of file FilesystemUtil.cc.
LogCabin::Storage::FilesystemUtil::File::File | ( | File && | other | ) |
Move constructor.
Definition at line 44 of file FilesystemUtil.cc.
LogCabin::Storage::FilesystemUtil::File::File | ( | int | fd, |
std::string | path | ||
) |
Constructor.
fd | An open file descriptor. |
path | The path used to open fd; used for error messages. |
Definition at line 52 of file FilesystemUtil.cc.
Destructor.
Closes file unless it's already been closed.
Definition at line 58 of file FilesystemUtil.cc.
LogCabin::Storage::FilesystemUtil::File::File | ( | const File & | ) |
Move assignment.
Definition at line 64 of file FilesystemUtil.cc.
Close the file.
This object's fd and path are cleared.
Definition at line 72 of file FilesystemUtil.cc.
Disassociate the file descriptor from this object.
The caller is in charge of closing the file descriptor. This object's fd and path are cleared.
Definition at line 85 of file FilesystemUtil.cc.
The open file descriptor, or -1 otherwise.
Definition at line 85 of file FilesystemUtil.h.
std::string LogCabin::Storage::FilesystemUtil::File::path |
The path used to open fd, or empty.
Used for error messages.
Definition at line 89 of file FilesystemUtil.h.