#include <cpp-terminal/private/file.hpp>
Definition at line 25 of file file.hpp.
◆ Handle
◆ FileHandler() [1/3]
Term::Private::FileHandler::FileHandler |
( |
std::recursive_mutex & | mutex, |
|
|
const std::string & | file, |
|
|
const std::string & | mode ) |
|
noexcept |
Definition at line 48 of file file.cpp.
50{
51#if defined(_WIN32)
52 m_handle = {CreateFile(
file.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
nullptr)};
54 {
57 }
60#else
61 std::size_t flag{O_ASYNC | O_DSYNC | O_NOCTTY | O_SYNC | O_NDELAY};
62 flag &= ~static_cast<std::size_t>(O_NONBLOCK);
63 if(mode.find('r') != std::string::npos) { flag |= O_RDONLY; }
64 else if(mode.find('w') != std::string::npos) { flag |= O_WRONLY; }
65 else { flag |= O_RDWR; }
66 m_fd = {::open(
file.c_str(),
static_cast<int>(flag))};
68 {
71 }
74#endif
76}
77catch(...)
78{
80}
void throw_exception(const std::string &str={}) const
Errno & check_if(const bool &ret) noexcept
std::recursive_mutex & m_mutex
std::FILE * file() const noexcept
WindowsError & check_if(const bool &ret) noexcept
void throw_exception(const std::string &str=std::string()) const
void ExceptionHandler(const ExceptionDestination &destination=ExceptionDestination::StdErr) noexcept
◆ FileHandler() [2/3]
Term::Private::FileHandler::FileHandler |
( |
const FileHandler & | | ) |
|
|
delete |
◆ FileHandler() [3/3]
Term::Private::FileHandler::FileHandler |
( |
FileHandler && | | ) |
|
|
delete |
◆ ~FileHandler()
Term::Private::FileHandler::~FileHandler |
( |
| ) |
|
|
virtualnoexcept |
Definition at line 82 of file file.cpp.
84{
87}
88catch(...)
89{
91}
◆ fd()
std::int32_t Term::Private::FileHandler::fd |
( |
| ) |
const |
|
noexcept |
◆ file()
std::FILE * Term::Private::FileHandler::file |
( |
| ) |
const |
|
noexcept |
◆ flush()
void Term::Private::FileHandler::flush |
( |
| ) |
|
◆ handle()
◆ lockIO()
void Term::Private::FileHandler::lockIO |
( |
| ) |
|
◆ null()
bool Term::Private::FileHandler::null |
( |
| ) |
const |
|
noexcept |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ unlockIO()
void Term::Private::FileHandler::unlockIO |
( |
| ) |
|
◆ m_fd
std::int32_t Term::Private::FileHandler::m_fd {-1} |
|
private |
◆ m_file
FILE* Term::Private::FileHandler::m_file {nullptr} |
|
private |
◆ m_handle
Handle Term::Private::FileHandler::m_handle {nullptr} |
|
private |
◆ m_mutex
std::recursive_mutex& Term::Private::FileHandler::m_mutex |
|
private |
◆ m_null
bool Term::Private::FileHandler::m_null {false} |
|
private |
The documentation for this class was generated from the following files: