Class that provides RAII for file handling.
More...
#include <file_utils.hpp>
|
| | FileWrapper (std::string const &file_path, std::string const &flags, bool o_direct, mode_t mode) |
| | Open file. More...
|
| |
|
| FileWrapper () noexcept=default |
| | Construct an empty file wrapper object without opening a file.
|
| |
|
| FileWrapper (FileWrapper const &)=delete |
| |
|
FileWrapper & | operator= (FileWrapper const &)=delete |
| |
|
| FileWrapper (FileWrapper &&o) noexcept |
| |
|
FileWrapper & | operator= (FileWrapper &&o) noexcept |
| |
| void | open (std::string const &file_path, std::string const &flags, bool o_direct, mode_t mode) |
| | Open file using open(2) More...
|
| |
| bool | opened () const noexcept |
| | Check if the file has been opened. More...
|
| |
|
void | close () noexcept |
| | Close the file if it is opened; do nothing otherwise.
|
| |
| int | fd () const noexcept |
| | Return the file descriptor. More...
|
| |
Class that provides RAII for file handling.
Definition at line 16 of file file_utils.hpp.
◆ FileWrapper()
| kvikio::FileWrapper::FileWrapper |
( |
std::string const & |
file_path, |
|
|
std::string const & |
flags, |
|
|
bool |
o_direct, |
|
|
mode_t |
mode |
|
) |
| |
Open file.
- Parameters
-
| file_path | File path. |
| flags | Open flags given as a string. |
| o_direct | Append O_DIRECT to flags. |
| mode | Access modes. |
◆ fd()
| int kvikio::FileWrapper::fd |
( |
| ) |
const |
|
noexcept |
Return the file descriptor.
- Returns
- File descriptor.
◆ open()
| void kvikio::FileWrapper::open |
( |
std::string const & |
file_path, |
|
|
std::string const & |
flags, |
|
|
bool |
o_direct, |
|
|
mode_t |
mode |
|
) |
| |
Open file using open(2)
- Parameters
-
| file_path | File path. |
| flags | Open flags given as a string. |
| o_direct | Append O_DIRECT to flags. |
| mode | Access modes. |
◆ opened()
| bool kvikio::FileWrapper::opened |
( |
| ) |
const |
|
noexcept |
Check if the file has been opened.
- Returns
- A boolean answer indicating if the file has been opened.
The documentation for this class was generated from the following file: