aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/winapi/process_io.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/winapi/process_io.hpp (renamed from include/winapi/stream.hpp)69
1 files changed, 31 insertions, 38 deletions
diff --git a/include/winapi/stream.hpp b/include/winapi/process_io.hpp
index ed5b40c..597cc08 100644
--- a/include/winapi/stream.hpp
+++ b/include/winapi/process_io.hpp
@@ -23,25 +23,13 @@ struct Stream {
Handle handle;
// VS 2013 won't generate these automatically.
-
- Stream(Stream&& other) BOOST_NOEXCEPT_OR_NOTHROW { swap(other); }
-
- Stream& operator=(Stream other) BOOST_NOEXCEPT_OR_NOTHROW {
- swap(other);
- return *this;
- }
-
- void swap(Stream& other) BOOST_NOEXCEPT_OR_NOTHROW {
- using std::swap;
- swap(handle, other.handle);
- }
-
+ Stream(Stream&& other) BOOST_NOEXCEPT_OR_NOTHROW;
+ Stream& operator=(Stream other) BOOST_NOEXCEPT_OR_NOTHROW;
+ void swap(Stream& other) BOOST_NOEXCEPT_OR_NOTHROW;
Stream(const Stream&) = delete;
};
-inline void swap(Stream& a, Stream& b) BOOST_NOEXCEPT_OR_NOTHROW {
- a.swap(b);
-}
+void swap(Stream& a, Stream& b) BOOST_NOEXCEPT_OR_NOTHROW;
struct Stdin : Stream {
Stdin();
@@ -50,14 +38,8 @@ struct Stdin : Stream {
explicit Stdin(Pipe&);
// VS 2013 won't generate these automatically.
-
- Stdin(Stdin&& other) BOOST_NOEXCEPT_OR_NOTHROW : Stream{std::move(other)} {}
-
- Stdin& operator=(Stdin other) BOOST_NOEXCEPT_OR_NOTHROW {
- Stream::operator=(std::move(other));
- return *this;
- }
-
+ Stdin(Stdin&& other) BOOST_NOEXCEPT_OR_NOTHROW;
+ Stdin& operator=(Stdin other) BOOST_NOEXCEPT_OR_NOTHROW;
Stdin(const Stdin&) = delete;
};
@@ -68,14 +50,8 @@ struct Stdout : Stream {
explicit Stdout(Pipe&);
// VS 2013 won't generate these automatically.
-
- Stdout(Stdout&& other) BOOST_NOEXCEPT_OR_NOTHROW : Stream{std::move(other)} {}
-
- Stdout& operator=(Stdout other) BOOST_NOEXCEPT_OR_NOTHROW {
- Stream::operator=(std::move(other));
- return *this;
- }
-
+ Stdout(Stdout&& other) BOOST_NOEXCEPT_OR_NOTHROW;
+ Stdout& operator=(Stdout other) BOOST_NOEXCEPT_OR_NOTHROW;
Stdout(const Stdout&) = delete;
};
@@ -86,17 +62,29 @@ struct Stderr : Stream {
explicit Stderr(Pipe&);
// VS 2013 won't generate these automatically.
+ Stderr(Stderr&& other) BOOST_NOEXCEPT_OR_NOTHROW;
+ Stderr& operator=(Stderr other) BOOST_NOEXCEPT_OR_NOTHROW;
+ Stderr(const Stderr&) = delete;
+};
- Stderr(Stderr&& other) BOOST_NOEXCEPT_OR_NOTHROW : Stream{std::move(other)} {}
+struct IO {
+ IO() = default;
- Stderr& operator=(Stderr other) BOOST_NOEXCEPT_OR_NOTHROW {
- Stream::operator=(std::move(other));
- return *this;
- }
+ void close();
- Stderr(const Stderr&) = delete;
+ process::Stdin std_in;
+ process::Stdout std_out;
+ process::Stderr std_err;
+
+ // VS 2013 won't generate these automatically.
+ IO(IO&& other) BOOST_NOEXCEPT_OR_NOTHROW;
+ IO& operator=(IO other) BOOST_NOEXCEPT_OR_NOTHROW;
+ void swap(IO& other) BOOST_NOEXCEPT_OR_NOTHROW;
+ IO(const IO&) = delete;
};
+void swap(IO& a, IO& b) BOOST_NOEXCEPT_OR_NOTHROW;
+
} // namespace process
} // namespace winapi
@@ -107,4 +95,9 @@ inline void swap(winapi::process::Stream& a, winapi::process::Stream& b) BOOST_N
a.swap(b);
}
+template <>
+inline void swap(winapi::process::IO& a, winapi::process::IO& b) BOOST_NOEXCEPT_OR_NOTHROW {
+ a.swap(b);
+}
+
} // namespace std