bool FormatExpression::operator==(const Expression& e) const { if (e.getKind() == Kind::FormatExpression) { auto rhs = static_cast<const FormatExpression*>(&e); if (sections.size() != rhs->sections.size()) { return false; } for (std::size_t i = 0; i < sections.size(); i++) { const auto& lhsSection = sections.at(i); const auto& rhsSection = rhs->sections.at(i); if (*lhsSection.text != *rhsSection.text) { return false; } if ((lhsSection.fontScale && (!rhsSection.fontScale || **lhsSection.fontScale != **rhsSection.fontScale)) || (!lhsSection.fontScale && rhsSection.fontScale)) { return false; } if ((lhsSection.textFont && (!rhsSection.textFont || **lhsSection.textFont != **rhsSection.textFont)) || (!lhsSection.textFont && rhsSection.textFont)) { return false; } if ((lhsSection.textColor && (!rhsSection.textColor || **lhsSection.textColor != **rhsSection.textColor)) || (!lhsSection.textColor && rhsSection.textColor)) { return false; } } return true; } return false; }
bool operator==(const Expression& e) const override { if (e.getKind() == Kind::Var) { auto rhs = static_cast<const Var*>(&e); return *value == *(rhs->value); } return false; }
bool operator==(const Expression& e) const override { if (e.getKind() == Kind::Let) { auto rhs = static_cast<const Let*>(&e); return *result == *(rhs->result); } return false; }
bool Match<T>::operator==(const Expression& e) const { if (e.getKind() == Kind::Match) { auto rhs = static_cast<const Match*>(&e); return (*input == *(rhs->input) && *otherwise == *(rhs->otherwise) && Expression::childrenEqual(branches, rhs->branches)); } return false; }
bool CollatorExpression::operator==(const Expression& e) const { if (e.getKind() == Kind::CollatorExpression) { auto rhs = static_cast<const CollatorExpression*>(&e); if ((locale && (!rhs->locale || **locale != **(rhs->locale))) || (!locale && rhs->locale)) { return false; } return *caseSensitive == *(rhs->caseSensitive) && *diacriticSensitive == *(rhs->diacriticSensitive); } return false; }