Some of the Object::equals now are const correct.
There's more to do. Why make this const-correct, instead of ditch it? Because whatever I replace it with has to be ready for const correctness.
This commit is contained in:
@ -47,15 +47,17 @@ Iterator::~Iterator()
|
||||
{
|
||||
}
|
||||
|
||||
bool Iterator::equals (Object *other)
|
||||
bool
|
||||
Iterator::equals( const Object *const other ) const
|
||||
{
|
||||
Iterator *otherIt = (Iterator*)other;
|
||||
Iterator *const otherIt = const_cast< Iterator * >( dynamic_cast< const Iterator * >( other ) );
|
||||
return
|
||||
this == otherIt ||
|
||||
(getWidget() == otherIt->getWidget() && compareTo(otherIt) == 0);
|
||||
(const_cast< Iterator * >( this )->getWidget() == otherIt->getWidget() && const_cast< Iterator * >( this )->compareTo(otherIt) == 0);
|
||||
}
|
||||
|
||||
void Iterator::intoStringBuffer(misc::StringBuffer *sb)
|
||||
void
|
||||
Iterator::intoStringBuffer(misc::StringBuffer *sb) const
|
||||
{
|
||||
sb->append ("{ widget = ");
|
||||
//widget->intoStringBuffer (sb);
|
||||
@ -68,7 +70,7 @@ void Iterator::intoStringBuffer(misc::StringBuffer *sb)
|
||||
Content::maskIntoStringBuffer (mask, sb);
|
||||
|
||||
sb->append (", content = ");
|
||||
Content::intoStringBuffer (&content, sb);
|
||||
Content::intoStringBuffer (const_cast< Content * >( &content ), sb);
|
||||
|
||||
sb->append (" }");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user