Changed displays from id to name
This commit is contained in:
@@ -28,7 +28,7 @@ public:
|
||||
virtual ~OutputDisplay() = default;
|
||||
|
||||
virtual uint8_t get_address() const = 0;
|
||||
virtual uint8_t get_id() const = 0;
|
||||
virtual std::string get_name() const = 0;
|
||||
virtual std::string get_content() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -17,16 +17,16 @@ namespace items
|
||||
namespace detail
|
||||
{
|
||||
|
||||
Display::Display(const uint8_t & address, const uint8_t & id) :
|
||||
address(address),
|
||||
id(id)
|
||||
Display::Display(const uint8_t & address, const std::string & name) :
|
||||
address{address},
|
||||
name{name}
|
||||
{
|
||||
CLOG(DEBUG, OUTPUT_LOGGER) << "Created display with id " << int{id} << " and address " << int{address} << ".";
|
||||
CLOG(DEBUG, OUTPUT_LOGGER) << "Created display " << name << " with address " << int{address} << ".";
|
||||
}
|
||||
|
||||
uint8_t Display::get_id() const
|
||||
std::string Display::get_name() const
|
||||
{
|
||||
return this->id;
|
||||
return this->name;
|
||||
}
|
||||
|
||||
void Display::write_score(const unsigned int & score, const unsigned int & length)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace detail
|
||||
class Display : public virtual items::OutputDisplay
|
||||
{
|
||||
public:
|
||||
Display(const uint8_t & address, const uint8_t & id);
|
||||
Display(const uint8_t & address, const std::string & name);
|
||||
virtual ~Display() = default;
|
||||
|
||||
void write_score(const unsigned int & score, const unsigned int & length);
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
|
||||
std::string get_content() const override;
|
||||
uint8_t get_address() const override;
|
||||
uint8_t get_id() const override;
|
||||
std::string get_name() const override;
|
||||
|
||||
private:
|
||||
std::string fit_score_string(std::string & score_string, const unsigned int & length);
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
std::string content;
|
||||
|
||||
protected:
|
||||
const uint8_t id;
|
||||
const std::string name;
|
||||
const uint8_t address;
|
||||
|
||||
};
|
||||
|
||||
@@ -23,10 +23,10 @@ namespace detail
|
||||
class EightDigitDisplay : public virtual items::detail::Display, public virtual items::EightDigitDisplay
|
||||
{
|
||||
public:
|
||||
EightDigitDisplay(uint8_t address, uint8_t id) :
|
||||
detail::Display(address, id)
|
||||
EightDigitDisplay(const uint8_t & address, const std::string & name) :
|
||||
detail::Display(address, name)
|
||||
{
|
||||
CLOG(DEBUG, OUTPUT_LOGGER) << "Created EightDigitDisplay with address " << int{this->address} << " and id: " << int{id};
|
||||
CLOG(DEBUG, OUTPUT_LOGGER) << "Created EightDigitDisplay " << name << " with address " << int{this->address};
|
||||
}
|
||||
|
||||
~EightDigitDisplay() override = default;
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
|
||||
std::string get_name() const override
|
||||
{
|
||||
return "EightDigitDisplay " + this->id;
|
||||
return "EightDigitDisplay " + name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -21,17 +21,17 @@ namespace detail
|
||||
class SevenDigitDisplay : public virtual items::detail::Display, public virtual items::SevenDigitDisplay
|
||||
{
|
||||
public:
|
||||
SevenDigitDisplay(uint8_t address, uint8_t id) :
|
||||
detail::Display(address, id)
|
||||
SevenDigitDisplay(const uint8_t & address, const std::string & name) :
|
||||
detail::Display(address, name)
|
||||
{
|
||||
CLOG(DEBUG, OUTPUT_LOGGER) << "Created SevenDigitDisplay with address " << int{this->address} << " and id: " << int{id};
|
||||
CLOG(DEBUG, OUTPUT_LOGGER) << "Created SevenDigitDisplay " << name << " with address " << int{this->address};
|
||||
}
|
||||
|
||||
void write_score(unsigned int score) override
|
||||
{
|
||||
detail::Display::write_score(score, 7);
|
||||
}
|
||||
void write_content(std::string content) override
|
||||
void write_content(std::string & content) override
|
||||
{
|
||||
detail::Display::write_content(content, 7);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
std::string get_name() const override
|
||||
{
|
||||
return "EightDigitDisplay " + this->id;
|
||||
return "EightDigitDisplay " + name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user