Skip to content

Commit 1de25b1

Browse files
committed
switched prompt arguments to use copy by reference
1 parent e536270 commit 1de25b1

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

cpp-terminal/prompt.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#include "private/conversion.hpp"
66
#include "private/platform.hpp"
77

8-
Term::Result Term::prompt_blocking(std::string message,
9-
std::string first_option,
10-
std::string second_option,
11-
std::string prompt_indicator) {
8+
Term::Result Term::prompt_blocking(const std::string& message,
9+
const std::string& first_option,
10+
const std::string& second_option,
11+
const std::string& prompt_indicator) {
1212
Terminal term(false, true, true);
1313
std::cout << message << " [" << first_option << '/' << second_option << ']'
1414
<< prompt_indicator << ' ' << std::flush;
@@ -65,10 +65,10 @@ Term::Result Term::prompt_blocking(std::string message,
6565
return Result::ERROR;
6666
}
6767

68-
Term::Result Term::prompt_non_blocking(std::string message,
69-
std::string first_option,
70-
std::string second_option,
71-
std::string prompt_indicator) {
68+
Term::Result Term::prompt_non_blocking(const std::string& message,
69+
const std::string& first_option,
70+
const std::string& second_option,
71+
const std::string& prompt_indicator) {
7272
Terminal term(false, true, true);
7373
std::cout << message << " [" << first_option << '/' << second_option << ']'
7474
<< prompt_indicator << ' ' << std::flush;

cpp-terminal/prompt.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ enum class Result_simple { YES, NO, ABORT };
2323

2424
// A simple yes/no prompt, requires the user to press the ENTER key to continue
2525
// The arguments are used like this: 1 [2/3]4 <user Input>
26-
Result prompt_blocking(std::string message,
27-
std::string first_option,
28-
std::string second_option,
29-
std::string prompt_indicator);
26+
Result prompt_blocking(const std::string& message,
27+
const std::string& first_option,
28+
const std::string& second_option,
29+
const std::string& prompt_indicator);
3030

3131
// A simple yes/no prompt, returns immediately after the first key press
3232
// The arguments are used like this: 1 [2/3]4 <user Input>
33-
Result prompt_non_blocking(std::string message,
34-
std::string first_option,
35-
std::string second_option,
36-
std::string prompt_indicator);
33+
Result prompt_non_blocking(const std::string& message,
34+
const std::string& first_option,
35+
const std::string& second_option,
36+
const std::string& prompt_indicator);
3737

3838
// The most simple prompt possible, requires the user to press enter to continue
3939
// The arguments are used like this: 1 [y/N]:

0 commit comments

Comments
 (0)