From 61377c582e0f2675baa5f5e6e30a35d1a4164b33 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 1 May 2017 16:08:43 +0300 Subject: Add hxx extension for headers and lib prefix for library dir --- butl/fdstream.ixx | 266 ------------------------------------------------------ 1 file changed, 266 deletions(-) delete mode 100644 butl/fdstream.ixx (limited to 'butl/fdstream.ixx') diff --git a/butl/fdstream.ixx b/butl/fdstream.ixx deleted file mode 100644 index 884d190..0000000 --- a/butl/fdstream.ixx +++ /dev/null @@ -1,266 +0,0 @@ -// file : butl/fdstream.ixx -*- C++ -*- -// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include - -namespace butl -{ - // auto_fd - // - inline void auto_fd:: - reset (int fd) noexcept - { - if (fd_ >= 0) - fdclose (fd_); // Don't check for an error as not much we can do here. - - fd_ = fd; - } - - inline auto_fd& auto_fd:: - operator= (auto_fd&& fd) noexcept - { - reset (fd.release ()); - return *this; - } - - inline auto_fd:: - ~auto_fd () noexcept - { - reset (); - } - - // fdbuf - // - inline auto_fd fdbuf:: - release () - { - return std::move (fd_); - } - - // ifdstream - // - inline ifdstream:: - ifdstream (auto_fd&& fd, iostate e) - : fdstream_base (std::move (fd)), std::istream (&buf_) - { - assert (e & badbit); - exceptions (e); - } - - inline ifdstream:: - ifdstream (iostate e) - : ifdstream (auto_fd (), e) // Delegate. - { - } - - inline ifdstream:: - ifdstream (auto_fd&& fd, fdstream_mode m, iostate e) - : fdstream_base (std::move (fd), m), - std::istream (&buf_), - skip_ ((m & fdstream_mode::skip) == fdstream_mode::skip) - { - assert (e & badbit); - exceptions (e); - } - - inline ifdstream:: - ifdstream (const std::string& f, openmode m, iostate e) - : ifdstream (f.c_str (), m, e) // Delegate. - { - } - - inline ifdstream:: - ifdstream (const path& f, openmode m, iostate e) - : ifdstream (f.string (), m, e) // Delegate. - { - } - - inline ifdstream:: - ifdstream (const std::string& f, fdopen_mode m, iostate e) - : ifdstream (f.c_str (), m, e) // Delegate. - { - } - - inline ifdstream:: - ifdstream (const path& f, fdopen_mode m, iostate e) - : ifdstream (f.string (), m, e) // Delegate. - { - } - - inline void ifdstream:: - open (const std::string& f, openmode m) - { - open (f.c_str (), m); - } - - inline void ifdstream:: - open (const path& f, openmode m) - { - open (f.string (), m); - } - - inline void ifdstream:: - open (const std::string& f, fdopen_mode m) - { - open (f.c_str (), m); - } - - inline void ifdstream:: - open (const path& f, fdopen_mode m) - { - open (f.string (), m); - } - - inline auto_fd ifdstream:: - release () - { - return buf_.release (); - } - - // ofdstream - // - inline ofdstream:: - ofdstream (auto_fd&& fd, iostate e) - : fdstream_base (std::move (fd)), std::ostream (&buf_) - { - assert (e & badbit); - exceptions (e); - } - - inline ofdstream:: - ofdstream (iostate e) - : ofdstream (auto_fd (), e) // Delegate. - { - } - - inline ofdstream:: - ofdstream (auto_fd&& fd, fdstream_mode m, iostate e) - : fdstream_base (std::move (fd), m), std::ostream (&buf_) - { - assert (e & badbit); - exceptions (e); - } - - inline ofdstream:: - ofdstream (const std::string& f, openmode m, iostate e) - : ofdstream (f.c_str (), m, e) // Delegate. - { - } - - inline ofdstream:: - ofdstream (const path& f, openmode m, iostate e) - : ofdstream (f.string (), m, e) // Delegate. - { - } - - inline ofdstream:: - ofdstream (const std::string& f, fdopen_mode m, iostate e) - : ofdstream (f.c_str (), m, e) // Delegate. - { - } - - inline ofdstream:: - ofdstream (const path& f, fdopen_mode m, iostate e) - : ofdstream (f.string (), m, e) // Delegate. - { - } - - inline void ofdstream:: - open (const std::string& f, openmode m) - { - open (f.c_str (), m); - } - - inline void ofdstream:: - open (const path& f, openmode m) - { - open (f.string (), m); - } - - inline void ofdstream:: - open (const std::string& f, fdopen_mode m) - { - open (f.c_str (), m); - } - - inline void ofdstream:: - open (const path& f, fdopen_mode m) - { - open (f.string (), m); - } - - inline auto_fd ofdstream:: - release () - { - if (is_open ()) - flush (); - - return buf_.release (); - } - - // fdopen() - // - inline auto_fd - fdopen (const std::string& f, fdopen_mode m, permissions p) - { - return fdopen (f.c_str (), m, p); - } - - inline auto_fd - fdopen (const path& f, fdopen_mode m, permissions p) - { - return fdopen (f.string (), m, p); - } - - // fdstream_mode - // - inline fdstream_mode - operator& (fdstream_mode x, fdstream_mode y) - { - return x &= y; - } - - inline fdstream_mode - operator| (fdstream_mode x, fdstream_mode y) - { - return x |= y; - } - - inline fdstream_mode - operator&= (fdstream_mode& x, fdstream_mode y) - { - return x = static_cast ( - static_cast (x) & - static_cast (y)); - } - - inline fdstream_mode - operator|= (fdstream_mode& x, fdstream_mode y) - { - return x = static_cast ( - static_cast (x) | - static_cast (y)); - } - - // fdopen_mode - // - inline fdopen_mode operator& (fdopen_mode x, fdopen_mode y) {return x &= y;} - inline fdopen_mode operator| (fdopen_mode x, fdopen_mode y) {return x |= y;} - - inline fdopen_mode - operator&= (fdopen_mode& x, fdopen_mode y) - { - return x = static_cast ( - static_cast (x) & - static_cast (y)); - } - - inline fdopen_mode - operator|= (fdopen_mode& x, fdopen_mode y) - { - return x = static_cast ( - static_cast (x) | - static_cast (y)); - } -} -- cgit v1.1