From bb0a9dbdccded5975974da855e3a72081e31df20 Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Sat, 31 Aug 2013 20:32:00 -0400 Subject: [PATCH] Add operators == and !=, for testing purposes (cherry picked from commit 2c75ed5b7165a9c27b1dfaaf09dce613ee8bff8f) --- src/CharacterColor.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/CharacterColor.h b/src/CharacterColor.h index a0a7eb4f..44f03ab2 100644 --- a/src/CharacterColor.h +++ b/src/CharacterColor.h @@ -84,8 +84,30 @@ public: * This is not applicable when the color is used to draw a character's background. */ FontWeight fontWeight; + + /** + * Compares two color entries and returns true if they represent the same + * color and font weight. + */ + friend bool operator == (const ColorEntry& a, const ColorEntry& b); + /** + * Compares two color entries and returns true if they represent different + * color and font weight. + */ + friend bool operator != (const ColorEntry& a, const ColorEntry& b); + }; +inline bool operator == (const ColorEntry& a, const ColorEntry& b) +{ + return a.color == b.color && + a.fontWeight == b.fontWeight; +} + +inline bool operator != (const ColorEntry& a, const ColorEntry& b) +{ + return !operator==(a, b); +} // Attributed Character Representations ///////////////////////////////