From 3a967fed3cbbb706fd723b7752d28094fea7fcb1 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 5 Jun 2026 00:03:59 +0200 Subject: upgrade to nested namespaces --- include/winapi/error.hpp | 6 ++---- include/winapi/process_io.hpp | 6 ++---- src/error.cpp | 6 ++---- src/process_io.cpp | 6 ++---- test/unit_tests/shared/test_data.hpp | 6 ++---- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/include/winapi/error.hpp b/include/winapi/error.hpp index 30237e3..259c18b 100644 --- a/include/winapi/error.hpp +++ b/include/winapi/error.hpp @@ -18,8 +18,7 @@ #include #include -namespace winapi { -namespace error { +namespace winapi::error { class CategoryWindows : public std::error_category { public: @@ -47,5 +46,4 @@ std::runtime_error custom(Ret ret, const char* function) { return std::runtime_error{std::format("Function {} failed with error code {}", function, ret)}; } -} // namespace error -} // namespace winapi +} // namespace winapi::error diff --git a/include/winapi/process_io.hpp b/include/winapi/process_io.hpp index 9da442f..ac678e6 100644 --- a/include/winapi/process_io.hpp +++ b/include/winapi/process_io.hpp @@ -12,8 +12,7 @@ #include #include -namespace winapi { -namespace process { +namespace winapi::process { struct Stream { Stream(Handle&& handle) : handle{std::move(handle)} {} @@ -68,5 +67,4 @@ struct IO { Stderr std_err; }; -} // namespace process -} // namespace winapi +} // namespace winapi::process diff --git a/src/error.cpp b/src/error.cpp index afc33f3..7266e63 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -14,8 +14,7 @@ #include #include -namespace winapi { -namespace error { +namespace winapi::error { namespace { std::wstring trim_trailing_newline(std::wstring_view s) { @@ -64,5 +63,4 @@ std::system_error windows(DWORD code, const char* function) { static_cast(code), category_windows(), build_what(code, function)}; } -} // namespace error -} // namespace winapi +} // namespace winapi::error diff --git a/src/process_io.cpp b/src/process_io.cpp index 1162049..dd227b3 100644 --- a/src/process_io.cpp +++ b/src/process_io.cpp @@ -11,8 +11,7 @@ #include #include -namespace winapi { -namespace process { +namespace winapi::process { Stdin::Stdin() : Stream{Handle::std_in()} {} @@ -50,5 +49,4 @@ void IO::close() { std_err.handle.close(); } -} // namespace process -} // namespace winapi +} // namespace winapi::process diff --git a/test/unit_tests/shared/test_data.hpp b/test/unit_tests/shared/test_data.hpp index 1c8316a..7b8caf6 100644 --- a/test/unit_tests/shared/test_data.hpp +++ b/test/unit_tests/shared/test_data.hpp @@ -7,8 +7,7 @@ #include -namespace worker { -namespace test_data { +namespace worker::test_data { static constexpr auto str = "Test output."; @@ -20,5 +19,4 @@ inline std::string err() { return "stderr: " + std::string{str}; } -} // namespace test_data -} // namespace worker +} // namespace worker::test_data -- cgit v1.3