From 32ab71b4b52c4d3836055f6701148a0c3f06c510 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Tue, 15 Apr 2008 15:10:52 +0200 Subject: [PATCH] Add a getter/setter for 'ansi' in Colour. --- src/DB/Savables/Colour.cpp | 12 ++++++++++++ src/DB/Savables/Colour.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/DB/Savables/Colour.cpp b/src/DB/Savables/Colour.cpp index 064fad5..86bb08b 100644 --- a/src/DB/Savables/Colour.cpp +++ b/src/DB/Savables/Colour.cpp @@ -46,6 +46,11 @@ const std::string& Colour::getCode() const return m_colour->getValue(db::TableImpls::Get()->COLOURS->CODE)->getStringValue(); } +bool Colour::isAnsi() const +{ + return m_colour->getValue(db::TableImpls::Get()->COLOURS->ANSI)->getBoolValue(); +} + void Colour::setName(const std::string& name) { Lock(); @@ -67,6 +72,13 @@ void Colour::setCode(const std::string& code) m_colour->setValue(value); } +void Colour::setAnsi(bool ansi) +{ + Lock(); + ValuePtr value(new FieldValue(db::TableImpls::Get()->COLOURS->ANSI, ansi ? 1 : 0)); + m_colour->setValue(value); +} + std::string Colour::getColourString() { std::string restore = "\x1B[0;0m"; diff --git a/src/DB/Savables/Colour.h b/src/DB/Savables/Colour.h index 709b995..b7fdbed 100644 --- a/src/DB/Savables/Colour.h +++ b/src/DB/Savables/Colour.h @@ -35,6 +35,7 @@ namespace mud const std::string& getName() const; std::string getColourString(); const std::string& getCode() const; + bool isAnsi() const; /* * Setters @@ -42,6 +43,7 @@ namespace mud void setName(const std::string& name); void setColourString(const std::string& colourstring); void setCode(const std::string& code); + void setAnsi(bool ansi); /* * Utilities -- 2.11.4.GIT