posix/fd: add std::string overloads for paths

This commit is contained in:
Danny Robson 2016-10-07 18:14:56 +11:00
parent 98732179a7
commit 51c8ee84ca
2 changed files with 16 additions and 0 deletions

View File

@ -43,6 +43,18 @@ fd::fd (const char *path, int flags, mode_t mode):
}
//-----------------------------------------------------------------------------
fd::fd (const std::string &path, int flags):
fd (path.c_str (), flags)
{ ; }
//-----------------------------------------------------------------------------
fd::fd (const std::string &path, int flags, mode_t mode):
fd (path.c_str (), flags, mode)
{ ; }
///////////////////////////////////////////////////////////////////////////////
fd::fd (fd &&rhs):
m_fd (-1)

View File

@ -17,6 +17,8 @@
#ifndef __CRUFT_UTIL_POSIX_FD_HPP
#define __CRUFT_UTIL_POSIX_FD_HPP
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
@ -26,6 +28,8 @@ namespace util::posix {
class fd {
public:
///////////////////////////////////////////////////////////////////////
fd (const std::string &path, int flags);
fd (const std::string &path, int flags, mode_t);
fd (const char *path, int flags);
fd (const char *path, int flags, mode_t);