more bugfixing

This commit is contained in:
Jonas Zeunert
2022-06-06 18:15:24 +02:00
parent fa194c0ede
commit 7de0238d2a
5 changed files with 7 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ public:
virtual ~Display() = default; virtual ~Display() = default;
virtual void write_score(uint64_t score) = 0; virtual void write_score(uint64_t score) = 0;
virtual void write_content(std::string & content) = 0; virtual void write_content(const std::string content) = 0;
}; };
} }

View File

@@ -54,12 +54,13 @@ std::string Display::fit_score_string(std::string & score_string, const unsigned
return score_string; return score_string;
} }
void Display::write_content(std::string & content, const unsigned int & length) void Display::write_content(const std::string content, const unsigned int & length)
{ {
if(content.size() > length) if(content.size() > length)
{ {
CLOG(WARNING, OUTPUT_LOGGER) << "Cannot write more than " << length << " digits on " << length << "-Digit Display. Truncating!"; CLOG(WARNING, OUTPUT_LOGGER) << "Cannot write more than " << length << " digits on " << length << "-Digit Display. Truncating!";
content = content.substr(0, length); this->content = content.substr(0, length);
return;
} }
this->content = content; this->content = content;

View File

@@ -28,7 +28,7 @@ public:
virtual ~Display() = default; virtual ~Display() = default;
void write_score(const uint64_t & score, const unsigned int & length); void write_score(const uint64_t & score, const unsigned int & length);
void write_content(std::string & content, const unsigned int & length); void write_content(const std::string content, const unsigned int & length);
std::string get_content() const override; std::string get_content() const override;
uint8_t get_address() const override; uint8_t get_address() const override;

View File

@@ -36,7 +36,7 @@ public:
detail::Display::write_score(score, 8); detail::Display::write_score(score, 8);
} }
void write_content(std::string & content) override void write_content(const std::string content) override
{ {
detail::Display::write_content(content, 8); detail::Display::write_content(content, 8);
} }

View File

@@ -31,7 +31,7 @@ public:
{ {
detail::Display::write_score(score, 7); detail::Display::write_score(score, 7);
} }
void write_content(std::string & content) override void write_content(const std::string content) override
{ {
detail::Display::write_content(content, 7); detail::Display::write_content(content, 7);
} }