Skip to content

Commit

Permalink
<QtPDF> Add more operator== overloads
Browse files Browse the repository at this point in the history
to make C++20 happy
  • Loading branch information
stloeffler committed Dec 21, 2024
1 parent 1bef728 commit 7f72d55
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/QtPDF/src/PDFAnnotations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ bool Markup::operator==(const AbstractAnnotation & o) const
if (!AbstractAnnotation::operator==(o)) {
return false;
}
const Markup & m(dynamic_cast<const Markup &>(o));
return (*this == dynamic_cast<const Markup &>(o));
}

bool Markup::operator==(const Markup & m) const
{
if (title() != m.title() || author() != m.author() ||
richContents() != m.richContents() || creationDate() != m.creationDate() ||
subject() != m.subject()) {
Expand Down Expand Up @@ -126,7 +129,11 @@ bool Link::operator==(const AbstractAnnotation & o) const
if (!(AbstractAnnotation::operator==(o))) {
return false;
}
const Link & l(dynamic_cast<const Link&>(o));
return (*this == dynamic_cast<const Link&>(o));
}

bool Link::operator==(const Link & l) const
{
if (highlightingMode() != l.highlightingMode() || quadPoints() != l.quadPoints()) {
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions modules/QtPDF/src/PDFAnnotations.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class Markup : public AbstractAnnotation
virtual void setPopup(Popup * popup);

bool operator==(const AbstractAnnotation & o) const override;
bool operator==(const Markup & m) const;

protected:
QString _title; // optional; since PDF 1.1; by convention identifies the annotation author
Expand Down Expand Up @@ -186,6 +187,7 @@ class Link : public AbstractAnnotation
void setActionOnActivation(PDFAction * const action);

bool operator==(const AbstractAnnotation & o) const override;
bool operator==(const Link & l) const;

private:
// Note: the PA member of the link annotation dict is deliberately ommitted
Expand Down

0 comments on commit 7f72d55

Please sign in to comment.