Make assorted arguments pass-by-reference.

This commit is contained in:
Jared Boone 2016-02-06 16:23:20 -08:00
parent a9451c17b4
commit 3172fb1ad6
7 changed files with 13 additions and 13 deletions

View File

@ -25,7 +25,7 @@ File::~File() {
close();
}
bool File::open_for_append(const std::string file_path) {
bool File::open_for_append(const std::string& file_path) {
const auto open_result = f_open(&f, file_path.c_str(), FA_WRITE | FA_OPEN_ALWAYS);
if( open_result == FR_OK ) {
const auto seek_result = f_lseek(&f, f_size(&f));
@ -60,7 +60,7 @@ bool File::write(const void* const data, const size_t bytes_to_write) {
return (result == FR_OK) && (bytes_written == bytes_to_write);
}
bool File::puts(const std::string string) {
bool File::puts(const std::string& string) {
const auto result = f_puts(string.c_str(), &f);
return (result >= 0);
}

View File

@ -31,7 +31,7 @@ class File {
public:
~File();
bool open_for_append(const std::string file_path);
bool open_for_append(const std::string& file_path);
bool close();
bool is_ready();
@ -39,7 +39,7 @@ public:
bool read(void* const data, const size_t bytes_to_read);
bool write(const void* const data, const size_t bytes_to_write);
bool puts(const std::string string);
bool puts(const std::string& string);
bool sync();

View File

@ -35,7 +35,7 @@ void Console::clear() {
display.scroll_set_position(0);
}
void Console::write(const std::string message) {
void Console::write(const std::string& message) {
const Style& s = style();
const Font& font = s.font;
const auto rect = screen_rect();
@ -58,7 +58,7 @@ void Console::write(const std::string message) {
}
}
void Console::writeln(const std::string message) {
void Console::writeln(const std::string& message) {
write(message);
crlf();
}

View File

@ -33,8 +33,8 @@ namespace ui {
class Console : public Widget {
public:
void clear();
void write(const std::string message);
void writeln(const std::string message);
void write(const std::string& message);
void writeln(const std::string& message);
void paint(Painter& painter) override;

View File

@ -70,7 +70,7 @@ public:
void add_item(const MenuItem item);
template<size_t N>
void add_items(const std::array<MenuItem, N> items) {
void add_items(const std::array<MenuItem, N>& items) {
for(const auto& item : items) {
add_item(item);
}

View File

@ -82,7 +82,7 @@ void SetDateTimeView::focus() {
button_cancel.focus();
}
void SetDateTimeView::form_init(const SetDateTimeModel model) {
void SetDateTimeView::form_init(const SetDateTimeModel& model) {
field_year.set_value(model.year);
field_month.set_value(model.month);
field_day.set_value(model.day);
@ -134,7 +134,7 @@ void SetFrequencyCorrectionView::focus() {
button_cancel.focus();
}
void SetFrequencyCorrectionView::form_init(const SetFrequencyCorrectionModel model) {
void SetFrequencyCorrectionView::form_init(const SetFrequencyCorrectionModel& model) {
field_ppm.set_value(model.ppm);
}

View File

@ -128,7 +128,7 @@ private:
"Cancel",
};
void form_init(const SetDateTimeModel model);
void form_init(const SetDateTimeModel& model);
SetDateTimeModel form_collect();
};
@ -172,7 +172,7 @@ private:
"Cancel",
};
void form_init(const SetFrequencyCorrectionModel model);
void form_init(const SetFrequencyCorrectionModel& model);
SetFrequencyCorrectionModel form_collect();
};