mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
remove cell_reference comparisons
This commit is contained in:
parent
d1d9471e15
commit
5cdaa6ec6b
|
@ -390,12 +390,6 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
friend XLNT_FUNCTION bool operator==(std::nullptr_t, const cell &cell);
|
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>
|
/// <summary>
|
||||||
/// Convenience function for writing cell to an ostream.
|
/// Convenience function for writing cell to an ostream.
|
||||||
/// Uses cell::to_string() internally.
|
/// Uses cell::to_string() internally.
|
||||||
|
|
|
@ -232,12 +232,6 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const char *reference_string) const;
|
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:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Index of the column. Important: this is one-indexed to conform
|
/// Index of the column. Important: this is one-indexed to conform
|
||||||
|
|
|
@ -432,11 +432,6 @@ cell &cell::operator=(const cell &rhs)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(cell left, cell right)
|
|
||||||
{
|
|
||||||
return left.get_reference() < right.get_reference();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string cell::to_repr() const
|
std::string cell::to_repr() const
|
||||||
{
|
{
|
||||||
return "<Cell " + worksheet(d_->parent_).get_title() + "." + get_reference().to_string() + ">";
|
return "<Cell " + worksheet(d_->parent_).get_title() + "." + get_reference().to_string() + ">";
|
||||||
|
|
|
@ -276,44 +276,4 @@ bool cell_reference::operator==(const cell_reference &comparand) const
|
||||||
absolute_row_ == comparand.absolute_row_;
|
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
|
} // namespace xlnt
|
||||||
|
|
|
@ -608,7 +608,7 @@ public:
|
||||||
|
|
||||||
TS_ASSERT_EQUALS((xlnt::cell_reference("A1"), xlnt::cell_reference("B2")), xlnt::range_reference("A1:B2"));
|
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);
|
TS_ASSERT_THROWS(xlnt::cell_reference("A"), xlnt::cell_coordinates_error);
|
||||||
|
|
||||||
auto ref = xlnt::cell_reference("$B$7");
|
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") == "A1");
|
||||||
TS_ASSERT(xlnt::cell_reference("A1") != "A2");
|
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()
|
void test_anchor()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user