More virtual base fixups.
This commit is contained in:
@ -709,7 +709,7 @@ dnl -----------
|
|||||||
dnl
|
dnl
|
||||||
|
|
||||||
if eval "test x$GCC = xyes"; then
|
if eval "test x$GCC = xyes"; then
|
||||||
CXXFLAGS="$CXXFLAGS -Wall -W -Wno-unused-parameter -pedantic -D_POSIX_C_SOURCE=200112L -std=c++23"
|
CXXFLAGS="$CXXFLAGS -Wall -W -Wno-unused-parameter -pedantic -D_POSIX_C_SOURCE=200112L -std=c++23 -Werror=overloaded-virtual"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl ----------------------------------
|
dnl ----------------------------------
|
||||||
|
@ -220,9 +220,9 @@ EmptyIterator::EmptyIterator (EmptyIterator &it): Iterator (it)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
object::Object *EmptyIterator::clone ()
|
object::Object *EmptyIterator::clone () const
|
||||||
{
|
{
|
||||||
return new EmptyIterator (*this);
|
return new EmptyIterator (const_cast< EmptyIterator & >( *this ));
|
||||||
}
|
}
|
||||||
|
|
||||||
int EmptyIterator::compareTo (object::Comparable *other)
|
int EmptyIterator::compareTo (object::Comparable *other)
|
||||||
@ -595,7 +595,7 @@ DeepIterator::~DeepIterator ()
|
|||||||
//printf ("Deleting DeepIterator %p ...\n", this);
|
//printf ("Deleting DeepIterator %p ...\n", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
object::Object *DeepIterator::clone ()
|
object::Object *DeepIterator::clone () const
|
||||||
{
|
{
|
||||||
DeepIterator *it = new DeepIterator ();
|
DeepIterator *it = new DeepIterator ();
|
||||||
|
|
||||||
@ -762,7 +762,7 @@ CharIterator::~CharIterator ()
|
|||||||
delete it;
|
delete it;
|
||||||
}
|
}
|
||||||
|
|
||||||
object::Object *CharIterator::clone()
|
object::Object *CharIterator::clone() const
|
||||||
{
|
{
|
||||||
CharIterator *cloned = new CharIterator ();
|
CharIterator *cloned = new CharIterator ();
|
||||||
cloned->it = it->cloneDeepIterator ();
|
cloned->it = it->cloneDeepIterator ();
|
||||||
|
@ -34,8 +34,9 @@ public:
|
|||||||
void intoStringBuffer(lout::misc::StringBuffer *sb) const override;
|
void intoStringBuffer(lout::misc::StringBuffer *sb) const override;
|
||||||
|
|
||||||
inline Widget *getWidget () { return widget; }
|
inline Widget *getWidget () { return widget; }
|
||||||
|
inline const Widget *getWidget () const { return widget; }
|
||||||
inline Content *getContent () { return &content; }
|
inline Content *getContent () { return &content; }
|
||||||
inline Content::Type getMask () { return mask; }
|
inline Content::Type getMask () const { return mask; }
|
||||||
|
|
||||||
virtual void unref ();
|
virtual void unref ();
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
EmptyIterator (Widget *widget, Content::Type mask, bool atEnd);
|
EmptyIterator (Widget *widget, Content::Type mask, bool atEnd);
|
||||||
|
|
||||||
lout::object::Object *clone();
|
lout::object::Object *clone() const override;
|
||||||
int compareTo(lout::object::Comparable *other);
|
int compareTo(lout::object::Comparable *other);
|
||||||
bool next ();
|
bool next ();
|
||||||
bool prev ();
|
bool prev ();
|
||||||
@ -183,7 +184,7 @@ public:
|
|||||||
DeepIterator(Iterator *it);
|
DeepIterator(Iterator *it);
|
||||||
~DeepIterator();
|
~DeepIterator();
|
||||||
|
|
||||||
lout::object::Object *clone ();
|
lout::object::Object *clone () const override;
|
||||||
|
|
||||||
DeepIterator *createVariant(Iterator *it);
|
DeepIterator *createVariant(Iterator *it);
|
||||||
inline Iterator *getTopIterator () { return stack.getTop(); }
|
inline Iterator *getTopIterator () { return stack.getTop(); }
|
||||||
@ -244,7 +245,7 @@ public:
|
|||||||
CharIterator (Widget *widget, bool followReferences);
|
CharIterator (Widget *widget, bool followReferences);
|
||||||
~CharIterator ();
|
~CharIterator ();
|
||||||
|
|
||||||
lout::object::Object *clone();
|
lout::object::Object *clone() const override;
|
||||||
int compareTo(lout::object::Comparable *other);
|
int compareTo(lout::object::Comparable *other);
|
||||||
|
|
||||||
bool next ();
|
bool next ();
|
||||||
|
@ -97,7 +97,7 @@ protected:
|
|||||||
virtual void getContentInFlow (int index, core::Content *content) = 0;
|
virtual void getContentInFlow (int index, core::Content *content) = 0;
|
||||||
|
|
||||||
void setValues (int sectionIndex, int index);
|
void setValues (int sectionIndex, int index);
|
||||||
inline void cloneValues (OOFAwareWidgetIterator *other)
|
inline void cloneValues (OOFAwareWidgetIterator *other) const
|
||||||
{ other->setValues (sectionIndex, index); }
|
{ other->setValues (sectionIndex, index); }
|
||||||
|
|
||||||
inline bool inFlow () { return sectionIndex == 0; }
|
inline bool inFlow () { return sectionIndex == 0; }
|
||||||
@ -110,7 +110,7 @@ protected:
|
|||||||
OOFAwareWidgetIterator (OOFAwareWidget *widget, core::Content::Type mask,
|
OOFAwareWidgetIterator (OOFAwareWidget *widget, core::Content::Type mask,
|
||||||
bool atEnd, int numContentsInFlow);
|
bool atEnd, int numContentsInFlow);
|
||||||
|
|
||||||
void intoStringBuffer(lout::misc::StringBuffer *sb);
|
void intoStringBuffer(lout::misc::StringBuffer *sb) const override;
|
||||||
int compareTo(lout::object::Comparable *other);
|
int compareTo(lout::object::Comparable *other);
|
||||||
|
|
||||||
bool next ();
|
bool next ();
|
||||||
|
@ -106,7 +106,7 @@ void OOFAwareWidget::OOFAwareWidgetIterator::getPart (int sectionIndex,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OOFAwareWidget::OOFAwareWidgetIterator::intoStringBuffer (StringBuffer *sb)
|
void OOFAwareWidget::OOFAwareWidgetIterator::intoStringBuffer (StringBuffer *sb) const
|
||||||
{
|
{
|
||||||
Iterator::intoStringBuffer (sb);
|
Iterator::intoStringBuffer (sb);
|
||||||
sb->append (", sectionIndex = ");
|
sb->append (", sectionIndex = ");
|
||||||
|
@ -354,7 +354,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
TableIterator (Table *table, core::Content::Type mask, bool atEnd);
|
TableIterator (Table *table, core::Content::Type mask, bool atEnd);
|
||||||
|
|
||||||
lout::object::Object *clone();
|
lout::object::Object *clone() const override;
|
||||||
|
|
||||||
void highlight (int start, int end, core::HighlightLayer layer);
|
void highlight (int start, int end, core::HighlightLayer layer);
|
||||||
void unhighlight (int direction, core::HighlightLayer layer);
|
void unhighlight (int direction, core::HighlightLayer layer);
|
||||||
|
@ -32,7 +32,7 @@ Table::TableIterator::TableIterator (Table *table,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
object::Object *Table::TableIterator::clone()
|
object::Object *Table::TableIterator::clone() const
|
||||||
{
|
{
|
||||||
TableIterator *tIt =
|
TableIterator *tIt =
|
||||||
new TableIterator ((Table*)getWidget(), getMask(), false);
|
new TableIterator ((Table*)getWidget(), getMask(), false);
|
||||||
|
@ -522,7 +522,7 @@ protected:
|
|||||||
static TextblockIterator *createWordIndexIterator
|
static TextblockIterator *createWordIndexIterator
|
||||||
(Textblock *textblock, core::Content::Type mask, int wordIndex);
|
(Textblock *textblock, core::Content::Type mask, int wordIndex);
|
||||||
|
|
||||||
lout::object::Object *clone();
|
lout::object::Object *clone() const override;
|
||||||
|
|
||||||
void highlight (int start, int end, core::HighlightLayer layer);
|
void highlight (int start, int end, core::HighlightLayer layer);
|
||||||
void unhighlight (int direction, core::HighlightLayer layer);
|
void unhighlight (int direction, core::HighlightLayer layer);
|
||||||
|
@ -48,7 +48,7 @@ Textblock::TextblockIterator
|
|||||||
return tbIt;
|
return tbIt;
|
||||||
}
|
}
|
||||||
|
|
||||||
object::Object *Textblock::TextblockIterator::clone()
|
object::Object *Textblock::TextblockIterator::clone() const
|
||||||
{
|
{
|
||||||
TextblockIterator *tbIt =
|
TextblockIterator *tbIt =
|
||||||
new TextblockIterator ((Textblock*)getWidget(), getMask(), false);
|
new TextblockIterator ((Textblock*)getWidget(), getMask(), false);
|
||||||
|
@ -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("{ ");
|
sb->append("{ ");
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ public:
|
|||||||
HashTable(bool ownerOfKeys, bool ownerOfValues, int tableSize = 251);
|
HashTable(bool ownerOfKeys, bool ownerOfValues, int tableSize = 251);
|
||||||
~HashTable();
|
~HashTable();
|
||||||
|
|
||||||
void intoStringBuffer(misc::StringBuffer *sb);
|
void intoStringBuffer(misc::StringBuffer *sb) const override;
|
||||||
|
|
||||||
void put (object::Object *key, object::Object *value);
|
void put (object::Object *key, object::Object *value);
|
||||||
object::Object *get (object::Object *key) const;
|
object::Object *get (object::Object *key) const;
|
||||||
@ -456,11 +456,11 @@ public:
|
|||||||
|
|
||||||
int hashValue() { return this->base->hashValue (); }
|
int hashValue() { return this->base->hashValue (); }
|
||||||
|
|
||||||
void intoStringBuffer(misc::StringBuffer *sb)
|
void intoStringBuffer(misc::StringBuffer *sb) const override
|
||||||
{ this->base->intoStringBuffer(sb); }
|
{ this->base->intoStringBuffer(sb); }
|
||||||
inline Iterator<T> iterator() {
|
inline Iterator<T> iterator() {
|
||||||
Iterator<T> it; it.base = this->base->iterator(); return it; }
|
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 (); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ int Object::hashValue()
|
|||||||
/**
|
/**
|
||||||
* \brief Return an exact copy of the object.
|
* \brief Return an exact copy of the object.
|
||||||
*/
|
*/
|
||||||
Object *Object::clone()
|
Object *Object::clone() const
|
||||||
{
|
{
|
||||||
misc::assertNotReached ();
|
misc::assertNotReached ();
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -177,7 +177,7 @@ int Pointer::hashValue()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pointer::intoStringBuffer(misc::StringBuffer *sb)
|
void Pointer::intoStringBuffer(misc::StringBuffer *sb) const
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
snprintf(buf, sizeof(buf), "%p", value);
|
snprintf(buf, sizeof(buf), "%p", value);
|
||||||
@ -198,7 +198,7 @@ int Integer::hashValue()
|
|||||||
return (int)value;
|
return (int)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Integer::intoStringBuffer(misc::StringBuffer *sb)
|
void Integer::intoStringBuffer(misc::StringBuffer *sb) const
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
sprintf(buf, "%d", value);
|
sprintf(buf, "%d", value);
|
||||||
@ -226,7 +226,7 @@ int Boolean::hashValue()
|
|||||||
return value ? 1 : 0;
|
return value ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Boolean::intoStringBuffer(misc::StringBuffer *sb)
|
void Boolean::intoStringBuffer(misc::StringBuffer *sb) const
|
||||||
{
|
{
|
||||||
sb->append(value ? "true" : "false");
|
sb->append(value ? "true" : "false");
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ int ConstString::hashValue(const char *str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConstString::intoStringBuffer(misc::StringBuffer *sb)
|
void ConstString::intoStringBuffer(misc::StringBuffer *sb) const
|
||||||
{
|
{
|
||||||
sb->append(str);
|
sb->append(str);
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,8 @@ class Object
|
|||||||
public:
|
public:
|
||||||
virtual ~Object();
|
virtual ~Object();
|
||||||
virtual bool equals(const Object *other) const;
|
virtual bool equals(const Object *other) const;
|
||||||
virtual bool equals(Object *other) final { return equals( &std::as_const( *other ) ); }
|
|
||||||
virtual int hashValue();
|
virtual int hashValue();
|
||||||
virtual Object *clone();
|
virtual Object *clone() const;
|
||||||
virtual void intoStringBuffer(misc::StringBuffer *sb) const;
|
virtual void intoStringBuffer(misc::StringBuffer *sb) const;
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
virtual size_t sizeOf();
|
virtual size_t sizeOf();
|
||||||
@ -108,7 +107,7 @@ public:
|
|||||||
Pointer(void *value) { this->value = value; }
|
Pointer(void *value) { this->value = value; }
|
||||||
bool equals(const Object *other) const override;
|
bool equals(const Object *other) const override;
|
||||||
int hashValue();
|
int hashValue();
|
||||||
void intoStringBuffer(misc::StringBuffer *sb);
|
void intoStringBuffer(misc::StringBuffer *sb) const override;
|
||||||
inline void *getValue() { return value; }
|
inline void *getValue() { return value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -134,7 +133,7 @@ public:
|
|||||||
Integer(int value) { this->value = value; }
|
Integer(int value) { this->value = value; }
|
||||||
bool equals(const Object *other) const override;
|
bool equals(const Object *other) const override;
|
||||||
int hashValue();
|
int hashValue();
|
||||||
void intoStringBuffer(misc::StringBuffer *sb);
|
void intoStringBuffer(misc::StringBuffer *sb) const override;
|
||||||
int compareTo(Comparable *other);
|
int compareTo(Comparable *other);
|
||||||
inline int getValue() { return value; }
|
inline int getValue() { return value; }
|
||||||
};
|
};
|
||||||
@ -151,7 +150,7 @@ public:
|
|||||||
Boolean(bool value) { this->value = value; }
|
Boolean(bool value) { this->value = value; }
|
||||||
bool equals(const Object *other) const override;
|
bool equals(const Object *other) const override;
|
||||||
int hashValue();
|
int hashValue();
|
||||||
void intoStringBuffer(misc::StringBuffer *sb);
|
void intoStringBuffer(misc::StringBuffer *sb) const override;
|
||||||
int compareTo(Comparable *other);
|
int compareTo(Comparable *other);
|
||||||
inline bool getValue() { return value; }
|
inline bool getValue() { return value; }
|
||||||
};
|
};
|
||||||
@ -172,7 +171,7 @@ public:
|
|||||||
bool equals(const Object *other) const override;
|
bool equals(const Object *other) const override;
|
||||||
int hashValue();
|
int hashValue();
|
||||||
int compareTo(Comparable *other);
|
int compareTo(Comparable *other);
|
||||||
void intoStringBuffer(misc::StringBuffer *sb);
|
void intoStringBuffer(misc::StringBuffer *sb) const override;
|
||||||
|
|
||||||
inline const char *chars() { return str; }
|
inline const char *chars() { return str; }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user