added const to some operators

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12943 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-06-03 19:31:26 +00:00
parent 11f97ed147
commit 7aca21e6bf
2 changed files with 23 additions and 9 deletions

View File

@ -67,8 +67,11 @@ public:
const RGBColor & operator=(const RGBColor &col);
const RGBColor & operator=(const rgb_color &col);
bool operator==(const rgb_color &col);
bool operator==(const RGBColor &col);
bool operator==(const rgb_color &col) const;
bool operator==(const RGBColor &col) const;
bool IsTransparentMagic() const;
protected:
rgb_color color32;

View File

@ -338,19 +338,30 @@ void RGBColor::PrintToStream(void) const
\brief Overloaded comaparison
\return true if all color elements are exactly equal
*/
bool RGBColor::operator==(const rgb_color &col)
bool RGBColor::operator==(const rgb_color &col) const
{
return (color32.red==col.red && color32.green==col.green
&& color32.blue==col.blue && color32.alpha==col.alpha)?true:false;
return color32.red == col.red &&
color32.green == col.green &&
color32.blue == col.blue &&
color32.alpha == col.alpha;
}
/*!
\brief Overloaded comaparison
\return true if all color elements are exactly equal
*/
bool RGBColor::operator==(const RGBColor &col)
bool RGBColor::operator==(const RGBColor &col) const
{
return (color32.red==col.color32.red && color32.green==col.color32.green
&& color32.blue==col.color32.blue
&& color32.alpha==col.color32.alpha)?true:false;
return color32.red == col.color32.red &&
color32.green == col.color32.green &&
color32.blue == col.color32.blue &&
color32.alpha == col.color32.alpha;
}
// IsTransparentMagic
bool
RGBColor::IsTransparentMagic() const
{
// TODO: validate this for B_CMAP8 for example
return *this == B_TRANSPARENT_COLOR;
}