From 73c5cc279f6252afcefd30b40d67b7bbb5b540de Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 16 Oct 2020 23:45:36 +0300 Subject: File: refactoring --- src/file.cpp | 8 ++++---- src/stream.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/file.cpp b/src/file.cpp index a299d70..c6a4ff4 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -71,19 +71,19 @@ Handle open_file(const std::wstring& path, const CreateFileParams& params) { } // namespace -Handle File::open_for_reading(const std::string& path) { +Handle File::open_r(const std::string& path) { return open_file(to_system_path(path), CreateFileParams::read()); } -Handle File::open_for_reading(const CanonicalPath& path) { +Handle File::open_r(const CanonicalPath& path) { return open_file(to_system_path(path), CreateFileParams::read()); } -Handle File::open_for_writing(const std::string& path) { +Handle File::open_w(const std::string& path) { return open_file(to_system_path(path), CreateFileParams::write()); } -Handle File::open_for_writing(const CanonicalPath& path) { +Handle File::open_w(const CanonicalPath& path) { return open_file(to_system_path(path), CreateFileParams::write()); } diff --git a/src/stream.cpp b/src/stream.cpp index f9285e6..76dd5a5 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -20,17 +20,17 @@ Stdout::Stdout() : Stream{Handle::std_out()} {} Stderr::Stderr() : Stream{Handle::std_err()} {} -Stdin::Stdin(const std::string& path) : Stream{File::open_for_reading(path)} {} +Stdin::Stdin(const std::string& path) : Stream{File::open_r(path)} {} -Stdin::Stdin(const CanonicalPath& path) : Stream{File::open_for_reading(path)} {} +Stdin::Stdin(const CanonicalPath& path) : Stream{File::open_r(path)} {} -Stdout::Stdout(const std::string& path) : Stream{File::open_for_writing(path)} {} +Stdout::Stdout(const std::string& path) : Stream{File::open_w(path)} {} -Stdout::Stdout(const CanonicalPath& path) : Stream{File::open_for_writing(path)} {} +Stdout::Stdout(const CanonicalPath& path) : Stream{File::open_w(path)} {} -Stderr::Stderr(const std::string& path) : Stream{File::open_for_writing(path)} {} +Stderr::Stderr(const std::string& path) : Stream{File::open_w(path)} {} -Stderr::Stderr(const CanonicalPath& path) : Stream{File::open_for_writing(path)} {} +Stderr::Stderr(const CanonicalPath& path) : Stream{File::open_w(path)} {} Stdin::Stdin(Pipe& pipe) : Stream{std::move(pipe.read_end())} { pipe.write_end().dont_inherit(); -- cgit v1.2.3