diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-11-24 14:44:21 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-11-24 14:44:21 +0200 |
commit | 90fbede55256cb672a67d8181b4f0435047d4e13 (patch) | |
tree | 912917cdd3034d906b8e026153e901405d9a8227 /libbutl/fdstream.ixx | |
parent | 582940c789fd767d9e8c09cb4147d48b596261be (diff) |
Add fdtruncate(), fdseek(), file position to [io]fdstream ctors
Diffstat (limited to 'libbutl/fdstream.ixx')
-rw-r--r-- | libbutl/fdstream.ixx | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/libbutl/fdstream.ixx b/libbutl/fdstream.ixx index 50e2018..4323954 100644 --- a/libbutl/fdstream.ixx +++ b/libbutl/fdstream.ixx @@ -30,6 +30,13 @@ namespace butl // fdbuf // + inline fdbuf:: + fdbuf (auto_fd&& fd, std::uint64_t pos) + { + if (fd.get () >= 0) + open (std::move (fd), pos); + } + inline auto_fd fdbuf:: release () { @@ -39,8 +46,8 @@ namespace butl // ifdstream // inline ifdstream:: - ifdstream (auto_fd&& fd, iostate e) - : fdstream_base (std::move (fd)), std::istream (&buf_) + ifdstream (auto_fd&& fd, iostate e, std::uint64_t pos) + : fdstream_base (std::move (fd), pos), std::istream (&buf_) { assert (e & badbit); exceptions (e); @@ -53,8 +60,8 @@ namespace butl } inline ifdstream:: - ifdstream (auto_fd&& fd, fdstream_mode m, iostate e) - : fdstream_base (std::move (fd), m), + ifdstream (auto_fd&& fd, fdstream_mode m, iostate e, std::uint64_t pos) + : fdstream_base (std::move (fd), m, pos), std::istream (&buf_), skip_ ((m & fdstream_mode::skip) == fdstream_mode::skip) { @@ -141,8 +148,8 @@ namespace butl // ofdstream // inline ofdstream:: - ofdstream (auto_fd&& fd, iostate e) - : fdstream_base (std::move (fd)), std::ostream (&buf_) + ofdstream (auto_fd&& fd, iostate e, std::uint64_t pos) + : fdstream_base (std::move (fd), pos), std::ostream (&buf_) { assert (e & badbit); exceptions (e); @@ -155,8 +162,8 @@ namespace butl } inline ofdstream:: - ofdstream (auto_fd&& fd, fdstream_mode m, iostate e) - : fdstream_base (std::move (fd), m), std::ostream (&buf_) + ofdstream (auto_fd&& fd, fdstream_mode m, iostate e, std::uint64_t pos) + : fdstream_base (std::move (fd), m, pos), std::ostream (&buf_) { assert (e & badbit); exceptions (e); |