summaryrefslogtreecommitdiffstatshomepage
path: root/src/cmd_line.cpp
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-06-04 22:39:44 +0200
committerEgor Tensin <egor@tensin.name>2026-06-04 22:42:12 +0200
commit7fcbd6e474235957f2785c3d9b5344b2acf3ff77 (patch)
tree4c1a2d5971a9db5330963ac7d77501638efeb4c0 /src/cmd_line.cpp
parentupgrade to `using` instead of typedef (diff)
downloadwinapi-common-7fcbd6e474235957f2785c3d9b5344b2acf3ff77.tar.gz
winapi-common-7fcbd6e474235957f2785c3d9b5344b2acf3ff77.zip
upgrade to std::string_view
Diffstat (limited to 'src/cmd_line.cpp')
-rw-r--r--src/cmd_line.cpp7
1 files changed, 4 insertions, 3 deletions
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 <sstream>
#include <stdexcept>
#include <string>
+#include <string_view>
#include <utility>
#include <vector>
@@ -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<std::string> 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{"^!\"%&()<>|"};