More virtual base fixups.

This commit is contained in:
2025-08-23 08:55:48 -04:00
parent 0bc863faf1
commit 13f931d82e
13 changed files with 31 additions and 31 deletions

View File

@ -674,7 +674,7 @@ void HashTable::clearNode(HashSet::Node *node)
}
}
void HashTable::intoStringBuffer(misc::StringBuffer *sb)
void HashTable::intoStringBuffer(misc::StringBuffer *sb) const
{
sb->append("{ ");

View File

@ -344,7 +344,7 @@ public:
HashTable(bool ownerOfKeys, bool ownerOfValues, int tableSize = 251);
~HashTable();
void intoStringBuffer(misc::StringBuffer *sb);
void intoStringBuffer(misc::StringBuffer *sb) const override;
void put (object::Object *key, object::Object *value);
object::Object *get (object::Object *key) const;
@ -456,11 +456,11 @@ public:
int hashValue() { return this->base->hashValue (); }
void intoStringBuffer(misc::StringBuffer *sb)
void intoStringBuffer(misc::StringBuffer *sb) const override
{ this->base->intoStringBuffer(sb); }
inline Iterator<T> iterator() {
Iterator<T> it; it.base = this->base->iterator(); return it; }
inline int size() { return this->base->size (); }
inline int size() const { return this->base->size (); }
};

View File

@ -67,7 +67,7 @@ int Object::hashValue()
/**
* \brief Return an exact copy of the object.
*/
Object *Object::clone()
Object *Object::clone() const
{
misc::assertNotReached ();
return NULL;
@ -177,7 +177,7 @@ int Pointer::hashValue()
#endif
}
void Pointer::intoStringBuffer(misc::StringBuffer *sb)
void Pointer::intoStringBuffer(misc::StringBuffer *sb) const
{
char buf[64];
snprintf(buf, sizeof(buf), "%p", value);
@ -198,7 +198,7 @@ int Integer::hashValue()
return (int)value;
}
void Integer::intoStringBuffer(misc::StringBuffer *sb)
void Integer::intoStringBuffer(misc::StringBuffer *sb) const
{
char buf[64];
sprintf(buf, "%d", value);
@ -226,7 +226,7 @@ int Boolean::hashValue()
return value ? 1 : 0;
}
void Boolean::intoStringBuffer(misc::StringBuffer *sb)
void Boolean::intoStringBuffer(misc::StringBuffer *sb) const
{
sb->append(value ? "true" : "false");
}
@ -281,7 +281,7 @@ int ConstString::hashValue(const char *str)
return 0;
}
void ConstString::intoStringBuffer(misc::StringBuffer *sb)
void ConstString::intoStringBuffer(misc::StringBuffer *sb) const
{
sb->append(str);
}

View File

@ -28,9 +28,8 @@ class Object
public:
virtual ~Object();
virtual bool equals(const Object *other) const;
virtual bool equals(Object *other) final { return equals( &std::as_const( *other ) ); }
virtual int hashValue();
virtual Object *clone();
virtual Object *clone() const;
virtual void intoStringBuffer(misc::StringBuffer *sb) const;
std::string toString() const;
virtual size_t sizeOf();
@ -108,7 +107,7 @@ public:
Pointer(void *value) { this->value = value; }
bool equals(const Object *other) const override;
int hashValue();
void intoStringBuffer(misc::StringBuffer *sb);
void intoStringBuffer(misc::StringBuffer *sb) const override;
inline void *getValue() { return value; }
};
@ -134,7 +133,7 @@ public:
Integer(int value) { this->value = value; }
bool equals(const Object *other) const override;
int hashValue();
void intoStringBuffer(misc::StringBuffer *sb);
void intoStringBuffer(misc::StringBuffer *sb) const override;
int compareTo(Comparable *other);
inline int getValue() { return value; }
};
@ -151,7 +150,7 @@ public:
Boolean(bool value) { this->value = value; }
bool equals(const Object *other) const override;
int hashValue();
void intoStringBuffer(misc::StringBuffer *sb);
void intoStringBuffer(misc::StringBuffer *sb) const override;
int compareTo(Comparable *other);
inline bool getValue() { return value; }
};
@ -172,7 +171,7 @@ public:
bool equals(const Object *other) const override;
int hashValue();
int compareTo(Comparable *other);
void intoStringBuffer(misc::StringBuffer *sb);
void intoStringBuffer(misc::StringBuffer *sb) const override;
inline const char *chars() { return str; }