From 7fcbd6e474235957f2785c3d9b5344b2acf3ff77 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 4 Jun 2026 22:39:44 +0200 Subject: upgrade to std::string_view --- src/cmd_line.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/cmd_line.cpp') diff --git a/src/cmd_line.cpp b/src/cmd_line.cpp index dd33bb4..46281e2 100644 --- a/src/cmd_line.cpp +++ b/src/cmd_line.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -76,7 +77,7 @@ CommandLine CommandLine::query() { return do_parse(::GetCommandLineW()); } -CommandLine CommandLine::parse(const std::string& src) { +CommandLine CommandLine::parse(std::string_view src) { return do_parse(widen(src)); } @@ -90,7 +91,7 @@ CommandLine::CommandLine(std::vector argv) : m_args{std::move(argv) m_argv0 = split_argv0(m_args); } -std::string CommandLine::escape(const std::string& arg) { +std::string CommandLine::escape(std::string_view arg) { std::ostringstream safe; safe << '"'; @@ -122,7 +123,7 @@ std::string CommandLine::escape(const std::string& arg) { return safe.str(); } -std::string CommandLine::escape_cmd(const std::string& arg) { +std::string CommandLine::escape_cmd(std::string_view arg) { static constexpr auto escape_symbol = '^'; static const std::string dangerous_symbols{"^!\"%&()<>|"}; -- cgit v1.3