LogCabin
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Public Attributes
LogCabin::Storage::FilesystemUtil::File Class Reference

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>

List of all members.

Public Member Functions

 File ()
 Default constructor.
 File (File &&other)
 Move constructor.
 File (int fd, std::string path)
 Constructor.
 ~File ()
 Destructor.
Fileoperator= (File &&other)
 Move assignment.
void close ()
 Close the file.
int release ()
 Disassociate the file descriptor from this object.
 File (const File &)
Fileoperator= (const File &)

Public Attributes

int fd
 The open file descriptor, or -1 otherwise.
std::string path
 The path used to open fd, or empty.

Detailed Description

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.


Constructor & Destructor Documentation

Default constructor.

Definition at line 38 of file FilesystemUtil.cc.

Move constructor.

Definition at line 44 of file FilesystemUtil.cc.

LogCabin::Storage::FilesystemUtil::File::File ( int  fd,
std::string  path 
)

Constructor.

Parameters:
fdAn open file descriptor.
pathThe 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.


Member Function Documentation

File & LogCabin::Storage::FilesystemUtil::File::operator= ( File &&  other)

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.

Returns:
The file descriptor.

Definition at line 85 of file FilesystemUtil.cc.

File& LogCabin::Storage::FilesystemUtil::File::operator= ( const File )

Member Data Documentation

The open file descriptor, or -1 otherwise.

Definition at line 85 of file FilesystemUtil.h.

The path used to open fd, or empty.

Used for error messages.

Definition at line 89 of file FilesystemUtil.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines