diff options
author | Max Kellermann <max@musicpd.org> | 2018-08-20 16:38:27 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-08-20 16:38:27 +0200 |
commit | 5e512763d3ff9d53034e146b3a876014ad717b94 (patch) | |
tree | 5ceb20e10ccf73723d10e4982db3fe4072b761f6 /src | |
parent | a65d02d3aec7d6b5b2dac07cfc90b59e4dacd4fb (diff) |
system/UniqueFileDescriptor: make the base class public
Diffstat (limited to 'src')
-rw-r--r-- | src/system/UniqueFileDescriptor.hxx | 60 |
1 files changed, 5 insertions, 55 deletions
diff --git a/src/system/UniqueFileDescriptor.hxx b/src/system/UniqueFileDescriptor.hxx index d78e1d0d0..936791df0 100644 --- a/src/system/UniqueFileDescriptor.hxx +++ b/src/system/UniqueFileDescriptor.hxx @@ -34,10 +34,12 @@ #include <utility> +#include <assert.h> + /** * An OO wrapper for a UNIX file descriptor. */ -class UniqueFileDescriptor : protected FileDescriptor { +class UniqueFileDescriptor : public FileDescriptor { public: UniqueFileDescriptor() noexcept :FileDescriptor(FileDescriptor::Undefined()) {} @@ -51,6 +53,8 @@ public: explicit UniqueFileDescriptor(FileDescriptor _fd) noexcept :FileDescriptor(_fd) {} + UniqueFileDescriptor(const UniqueFileDescriptor &) = delete; + UniqueFileDescriptor(UniqueFileDescriptor &&other) noexcept :FileDescriptor(other.Steal()) {} @@ -63,20 +67,6 @@ public: return *this; } - /** - * Convert this object to its #FileDescriptor base type. - */ - const FileDescriptor &ToFileDescriptor() const noexcept { - return *this; - } - - using FileDescriptor::IsDefined; -#ifndef _WIN32 - using FileDescriptor::IsValid; -#endif - using FileDescriptor::Get; - using FileDescriptor::Steal; - protected: void Set(int _fd) noexcept { assert(!IsDefined()); @@ -86,57 +76,17 @@ protected: } public: - using FileDescriptor::Open; - using FileDescriptor::OpenReadOnly; - #ifndef _WIN32 - using FileDescriptor::OpenNonBlocking; - static bool CreatePipe(UniqueFileDescriptor &r, UniqueFileDescriptor &w) noexcept { return FileDescriptor::CreatePipe(r, w); } - using FileDescriptor::SetNonBlocking; - using FileDescriptor::SetBlocking; - using FileDescriptor::Duplicate; - using FileDescriptor::CheckDuplicate; - static bool CreatePipe(FileDescriptor &r, FileDescriptor &w) noexcept; #endif - using FileDescriptor::EnableCloseOnExec; - using FileDescriptor::DisableCloseOnExec; - -#ifdef USE_EVENTFD - using FileDescriptor::CreateEventFD; -#endif - -#ifdef USE_SIGNALFD - using FileDescriptor::CreateSignalFD; -#endif - -#ifdef HAVE_INOTIFY_INIT - using FileDescriptor::CreateInotify; -#endif - bool Close() noexcept { return IsDefined() && FileDescriptor::Close(); } - - using FileDescriptor::Rewind; - using FileDescriptor::Seek; - using FileDescriptor::Skip; - using FileDescriptor::Tell; - using FileDescriptor::GetSize; - using FileDescriptor::Read; - using FileDescriptor::Write; - -#ifndef _WIN32 - using FileDescriptor::Poll; - using FileDescriptor::WaitReadable; - using FileDescriptor::WaitWritable; - using FileDescriptor::IsReadyForWriting; -#endif }; #endif |