From def5c50960eea4c112647f88361a3ae7155901a8 Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Tue, 4 Jul 2023 00:48:00 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/wina?= =?UTF-8?q?pi-common@0c196cbe8b4927c78c02b2c7312fc69a507db845=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process__io_8cpp_source.html | 143 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 process__io_8cpp_source.html (limited to 'process__io_8cpp_source.html') diff --git a/process__io_8cpp_source.html b/process__io_8cpp_source.html new file mode 100644 index 0000000..8890791 --- /dev/null +++ b/process__io_8cpp_source.html @@ -0,0 +1,143 @@ + + + + + + + +winapi_common: src/process_io.cpp Source File + + + + + + + + + +
+
+ + + + + + +
+
winapi_common +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
process_io.cpp
+
+
+
1 // Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
+
2 // This file is part of the "winapi-common" project.
+
3 // For details, see https://github.com/egor-tensin/winapi-common.
+
4 // Distributed under the MIT License.
+
5 
+
6 #include <winapi/file.hpp>
+
7 #include <winapi/handle.hpp>
+
8 #include <winapi/path.hpp>
+
9 #include <winapi/process_io.hpp>
+
10 
+
11 #include <string>
+
12 #include <utility>
+
13 
+
14 namespace winapi {
+
15 namespace process {
+
16 
+
17 Stdin::Stdin() : Stream{Handle::std_in()} {}
+
18 
+
19 Stdout::Stdout() : Stream{Handle::std_out()} {}
+
20 
+
21 Stderr::Stderr() : Stream{Handle::std_err()} {}
+
22 
+
23 Stdin::Stdin(const std::string& path) : Stream{File::open_r(path)} {}
+
24 
+
25 Stdin::Stdin(const CanonicalPath& path) : Stream{File::open_r(path)} {}
+
26 
+
27 Stdout::Stdout(const std::string& path) : Stream{File::open_w(path)} {}
+
28 
+
29 Stdout::Stdout(const CanonicalPath& path) : Stream{File::open_w(path)} {}
+
30 
+
31 Stderr::Stderr(const std::string& path) : Stream{File::open_w(path)} {}
+
32 
+
33 Stderr::Stderr(const CanonicalPath& path) : Stream{File::open_w(path)} {}
+
34 
+
35 Stdin::Stdin(Pipe& pipe) : Stream{std::move(pipe.read_end())} {
+
36  pipe.write_end().dont_inherit();
+
37 }
+
38 
+
39 Stdout::Stdout(Pipe& pipe) : Stream{std::move(pipe.write_end())} {
+
40  pipe.read_end().dont_inherit();
+
41 }
+
42 
+
43 Stderr::Stderr(Pipe& pipe) : Stream{std::move(pipe.write_end())} {
+
44  pipe.read_end().dont_inherit();
+
45 }
+
46 
+
47 void IO::close() {
+
48  std_in.handle.close();
+
49  std_out.handle.close();
+
50  std_err.handle.close();
+
51 }
+
52 
+
53 } // namespace process
+
54 } // namespace winapi
+
Absolute, canonical path.
Definition: path.hpp:13
+
File I/O.
Definition: file.hpp:29
+
HANDLE wrapper.
Definition: handle.hpp:25
+
void close()
Definition: handle.cpp:47
+
Anonymous pipe wrapper.
Definition: pipe.hpp:15
+
Handle & read_end()
Definition: pipe.hpp:21
+
Handle & write_end()
Definition: pipe.hpp:25
+ + + + +
+ + + + -- cgit v1.2.3