remove cell_reference comparisons

This commit is contained in:
Thomas Fussell 2016-07-22 23:41:57 -04:00
parent d1d9471e15
commit 5cdaa6ec6b
5 changed files with 1 additions and 62 deletions

View File

@ -390,12 +390,6 @@ public:
/// </summary>
friend XLNT_FUNCTION bool operator==(std::nullptr_t, const cell &cell);
/// <summary>
/// Return the result of left.get_reference() < right.get_reference().
/// What's the point of this?
/// </summary>
friend XLNT_FUNCTION bool operator<(cell left, cell right);
/// <summary>
/// Convenience function for writing cell to an ostream.
/// Uses cell::to_string() internally.

View File

@ -232,12 +232,6 @@ public:
/// </summary>
bool operator!=(const char *reference_string) const;
// TODO: are these useful? maybe get rid of them
bool operator<(const cell_reference &other);
bool operator>(const cell_reference &other);
bool operator<=(const cell_reference &other);
bool operator>=(const cell_reference &other);
private:
/// <summary>
/// Index of the column. Important: this is one-indexed to conform

View File

@ -432,11 +432,6 @@ cell &cell::operator=(const cell &rhs)
return *this;
}
bool operator<(cell left, cell right)
{
return left.get_reference() < right.get_reference();
}
std::string cell::to_repr() const
{
return "<Cell " + worksheet(d_->parent_).get_title() + "." + get_reference().to_string() + ">";

View File

@ -276,44 +276,4 @@ bool cell_reference::operator==(const cell_reference &comparand) const
absolute_row_ == comparand.absolute_row_;
}
bool cell_reference::operator<(const cell_reference &other)
{
if (row_ != other.row_)
{
return row_ < other.row_;
}
return column_ < other.column_;
}
bool cell_reference::operator>(const cell_reference &other)
{
if (row_ != other.row_)
{
return row_ > other.row_;
}
return column_ > other.column_;
}
bool cell_reference::operator<=(const cell_reference &other)
{
if (row_ != other.row_)
{
return row_ < other.row_;
}
return column_ <= other.column_;
}
bool cell_reference::operator>=(const cell_reference &other)
{
if (row_ != other.row_)
{
return row_ > other.row_;
}
return column_ >= other.column_;
}
} // namespace xlnt

View File

@ -608,7 +608,7 @@ public:
TS_ASSERT_EQUALS((xlnt::cell_reference("A1"), xlnt::cell_reference("B2")), xlnt::range_reference("A1:B2"));
TS_ASSERT_THROWS(xlnt::cell_reference("A1A"), xlnt::cell_coordinates_error);
TS_ASSERT_THROWS(xlnt::cell_reference("A1&"), xlnt::cell_coordinates_error);
TS_ASSERT_THROWS(xlnt::cell_reference("A"), xlnt::cell_coordinates_error);
auto ref = xlnt::cell_reference("$B$7");
@ -617,10 +617,6 @@ public:
TS_ASSERT(xlnt::cell_reference("A1") == "A1");
TS_ASSERT(xlnt::cell_reference("A1") != "A2");
TS_ASSERT(xlnt::cell_reference("A1") < xlnt::cell_reference("A2"));
TS_ASSERT(xlnt::cell_reference("A2") <= xlnt::cell_reference("A2"));
TS_ASSERT(xlnt::cell_reference("A2") > xlnt::cell_reference("A1"));
TS_ASSERT(xlnt::cell_reference("A2") >= xlnt::cell_reference("A2"));
}
void test_anchor()