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:
2025-08-22 13:58:05 -04:00
parent f6841f59e0
commit e4f1102e32
8 changed files with 38 additions and 32 deletions

View File

@ -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 (" }");
}