equality test functions are const

RTFSprms::equals and RTFValue::equals
are mutually dependent, which is insane.

Change-Id: Ib6de7954e97d5a1620ea3f8db92fe9a989ee8667
Signed-off-by: Adrien Ollier <adr.ollier@hotmail.fr>
Reviewed-on: https://gerrit.libreoffice.org/76211
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Adrien Ollier 2019-07-24 04:14:58 +02:00 committed by Noel Grandin
parent d53144e9d1
commit e1c7cb5d27
4 changed files with 5 additions and 5 deletions

View File

@ -374,9 +374,9 @@ RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& rReference, Id const nStyleType
return ret;
}
bool RTFSprms::equals(RTFValue& rOther)
bool RTFSprms::equals(const RTFValue& rOther) const
{
return std::all_of(m_pSprms->begin(), m_pSprms->end(),
return std::all_of(m_pSprms->cbegin(), m_pSprms->cend(),
[&](const std::pair<Id, RTFValue::Pointer_t>& raPair) -> bool {
return raPair.second->equals(rOther);
});

View File

@ -75,7 +75,7 @@ public:
Iterator_t begin() { return m_pSprms->begin(); }
Iterator_t end() { return m_pSprms->end(); }
void clear();
bool equals(RTFValue& rOther);
bool equals(const RTFValue& rOther) const;
private:
void ensureCopyBeforeWrite();

View File

@ -186,7 +186,7 @@ RTFValue* RTFValue::CloneWithSprms(RTFSprms const& rAttributes, RTFSprms const&
m_bForceString, *m_pShape, *m_pPicture);
}
bool RTFValue::equals(RTFValue& rOther)
bool RTFValue::equals(const RTFValue& rOther) const
{
if (m_nValue != rOther.m_nValue)
return false;

View File

@ -73,7 +73,7 @@ public:
RTFSprms& getSprms();
RTFShape& getShape() const;
RTFPicture& getPicture() const;
bool equals(RTFValue& rOther);
bool equals(const RTFValue& rOther) const;
RTFValue& operator=(RTFValue const& rOther) = delete;
private: